#mod_development
1 messages Β· Page 148 of 1
thank you
I think it was ISInventoryPaneContextMenu that had this part
it is
I think it was a bool you had to set but no idea which one it was
i'm just not sure how to actually use it because i'm not using the default tooltip at all
its hidden and replaced with a custom one
function UI.ISInventoryPane_drawItemDetails_patch(drawItemDetails)
local NewColorInfo = ColorInfo:new()
return function(self,item, y, xoff, yoff, red,...)
if not item then return end
--if not (item:getModData().ISA_maxCapacity or isa.maxBatteryCapacity[item:getType()]) then
if not (item:getModData().ISA_maxCapacity) then
return drawItemDetails(self,item, y, xoff, yoff, red,...)
else
local hdrHgt = self.headerHgt
local top = hdrHgt + y * self.itemHgt + yoff
rgbBad.ColorInfo:interp(rgbGood.ColorInfo, item:getCondition()/100, NewColorInfo)
local fgBar = {r=NewColorInfo:getR(),g=NewColorInfo:getG(),b=NewColorInfo:getB(),a=1}
local fgText = red and {r=0.0, g=0.0, b=0.5, a=0.7} or {r=0.6, g=0.8, b=0.5, a=0.6}
self:drawTextAndProgressBar(getText("Tooltip_weapon_Condition") .. ":", item:getCondition()/100, xoff, top, fgText, fgBar)
end
end
end```
i found this relevant code (towards the bottom)
i'm just not sure how it really works lol
ChatGPT-4 is magnificent to make up mod's name:
You're free to guess part of what name I'm using for my mod π
For reference: IDF is Independent Defense Force, an organization that also Type V Kardashev scale civilization from "Fight For Universe" series of my mods.
nice, you can change it and call it getClosestVehicle as well.
And this is mod's cover (Midjorney did good job making zombie infested city background):
for context you change the option properties. 'option.notAvailbable' to disable and option.tooltip for tooltip text. You can see examples in vanilla.
Hello there!
What's the best possible solution to implement setting option that will allow players to change sound volume of the certain vehicle. Changing Volume just for players, not that one responsible for attracting zombies.
Just what I needed, thank you!
i think v2 of my mod is finally ready
can't think of anything else to do really
I'm thinking of adding something like zombie evolution over time in my mod. I.e. zombies get stronger, faster & etc over time.
check ZedEvolution, hopefully v42 makes these mods easier.
https://steamcommunity.com/workshop/filedetails/?id=2729417044
Updated year+ ago.
game updated a year ago too
Well, according to patch notes: last December was last patch.
I want to verify something: basically, in order for my mod to properly load profession icon, I need to put it into media/textures/?
I too filter mods by update date, but there's no reason to update mod if nothing changed in the base game that affects it.
The version bump that required changes was in 2021?
True.
honestly both mods that were working on this quit, maybe you can figure out what they couldn't.
Im trying to build my first mod and im trying to make a vape mod where you need to use both batteries and vape juice to use it. I am having trouble trying to figure out how to make this.
any help or guidance would be greatly appreciated
Are there any mods that add vehicle animations?
For me it will be more to make sure that OP specialist from my mod won't relax overtime.
If you want all zombies to evolve equally, you can probably make it work. I'm trying to give examples so you can figure it out faster. There's other mods that affect the zombie stats for the whole map, that can probably be useful too.
- Is there a way to get and check the models of a vehicle part?
I may have an alternate solution.
Its been done by maemento
I know but I'm trying to make my own to kind of get the idea of making mods. I'll check his out see if I like it
ok i just checked his out i like how it has the remaining but i want mine to be able to be refillable and use batteries
so mine is different
i'm updating mine today lol
with that exact function
update is ready to go i'm just waiting until morning
now it uses both battery and juice level
new vapes added
stress functions changed
new ui
suddenly everybody is making vape mods π
I know right
i'm a trendsetter
I don't even know what a GnomeBar is

I don't vape nor smoke
theres a very ppopular brand of vapes called elfbar
to get around trademarks i named mine gnomebars
Don't worry you won't get Trademarked
It's a mod
more fun to come up with stuff than just copy
You're not profiting it for money
So you will be fine
Mods do it everytime
I mean It's your mod
huh
sorry i was just trying to learn
thanks ill take a look to see what im doing wrong. I can get the dang thing to use the battery but i cant get it to actually insert the battery like it does for a flashlight. same with the flavor
so i pretty much copied the vanilla flashlight battery removal / insertion functions
{
destroy GnomeBarRB/GnomeBarRB/GnomeBarBlueRazz/GnomeBarWatermelonIce/GnomeBarPinkLemonade/GnomeBarBlackIce/GnomeBarCoolMint/GnomeBarBananaIce/GnomeBarLemonMint/GnomeBarStrawNana/GnomeBarCherryIce/GnomeBarAppleIce/GnomeBarGlitch/GBEmpty/GnomeBarGolden,
Result:Battery,
Time:30,
OnTest:Recipe.OnTest.VapeBatteryRemoval,
OnCreate:Recipe.OnCreate.VapeBatteryRemoval,
StopOnWalk:false,
AllowOnlyOne:true,
Prop2:Source=1,
}```
then there's an insert recipe for each flavor
{
destroy GnomeBarRB,
destroy Battery,
Result:GnomeBarRB,
Time:30,
OnTest:Recipe.OnTest.VapeBatteryInsert,
OnCreate:Recipe.OnCreate.VapeBatteryInsert,
StopOnWalk:false,
Prop2:Source=1,
}```
-- !! When creating item in result box of crafting panel.
function Recipe.OnCreate.VapeBatteryRemoval(items, result, player)
for i=0, items:size()-1 do
local item = items:get(i)
if item:getModule() == "GnomeBars" then
result:setUsedDelta(item:getUsedDelta()); -- !! Set the battery used delta to the used delta of the GnomeBar
-- xx item:setUsedDelta(0); -- xx !! Set GnomeBar used delta (Charge) to 0% because the battery has been removed
local gnomeType = item:getFullType(); -- get the full type of the item (Required by item factory below)
local modDataOld = item:getModData(); -- Get the old vapes modDate
modDataOld.Flavor = modDataOld.Flavor or 60; -- Get the old vapes flavor level remaining
local newGnomeBar = InventoryItemFactory.CreateItem(gnomeType); -- Create a new GnomeBar of the same type of the old one
if(newGnomeBar ~= nil)then -- If the new GnomeBar actually exists
newGnomeBar:setUsedDelta(0); -- Set the charge level to 0% since the battery was removed
local modDataNew = newGnomeBar:getModData(); -- Get the new vapes modData
modDataNew.Flavor = modDataOld.Flavor; -- Copy the old flavor level onto the new vape
player:getInventory():AddItem(newGnomeBar); -- Add the new vape item to the players inventory
end
end
end
end```
then in your recipecode.lua you have something like this
i tried doing something like that but i couldnt get it to work right
except for thatr last one
-- !! Return true if recipe is valid, false otherwise
function Recipe.OnTest.VapeBatteryInsert(sourceItem, result)
if sourceItem:getModule() == "GnomeBars" then
return sourceItem:getUsedDelta() == 0; -- !! Only allow the battery inserting if the vape has no battery left in it.
end
return true -- the battery
end```
-- !! When creating item in result box of crafting panel.
function Recipe.OnCreate.VapeBatteryInsert(items, result, player)
for i=0, items:size()-1 do
if items:get(i):getType() == "Battery" then
result:setUsedDelta(items:get(i):getUsedDelta()); -- !! Set the vape to the charge level that the battery had
end
if items:get(i):getModule() == "GnomeBars" then
local modDataOld = items:get(i):getModData() -- !! Get the mod data
modDataOld.Flavor = modDataOld.Flavor or 60 -- !! Get the old flavor level
local modDataNew = result:getModData() -- !! Get the mod data for the new replacement item
modDataNew.Flavor = modDataOld.Flavor -- !! Set the new item's flavor level to the old item's level
-- // print("Kept flavor value on transfer")
end
end
end```
-- !! Return true if recipe is valid, false otherwise
function Recipe.OnTest.VapeBatteryRemoval (sourceItem, result)
return sourceItem:getUsedDelta() > 0; -- !! Checks if there's actually a battery with charge in the vape
end```
those are the functions I use in my recipe code
so where would i create a recipe code i didnt even know about that
media\lua\server\items\yournamehere_recipeCode.lua
then in your recipe definitions you have these lines
OnCreate:Recipe.OnCreate.VapeBatteryRemoval,```
onTest is called before the recipe is actioned to make sure the player has the necessary ingredients
onCreate is the function that's called when the recipe is executed (this is the recipeCode.lua file)
so if you didn't have those, that's definitely at least one reason why you're having difficulties
yea i didnt have any of the coding like that
you're also going to run into issues with how to actually make the item have a context menu action
if you make it a food with a custom eat context menu label, you lose the option for it to be a drainable item
to get around this I made completely custom tooltips and hid the vanilla one
thats the issue i was having
with a custom context menu entry
and then that entry when clicked, calls my custom timed action (the actual vape action)
its quite a bit of code
yea im starting to feel really dumb at this point
nah don't feel that way
i started modding from no knowledge like
2.5 weeks ago maybe
march 20
so if I can do it, I'm sure you can too
this is a godsend for learning lua
#1070852229654917180 This thread also has a lot of resources that will be valuable to you
i see where when you remove the battery from the gnombar it destroys the gnomebar. Is there a way that it can be removed without destroying the gnomebar for lets say i want to create some sort of charger in the future for the batteries
I tried that
the issue with drainables and crafting recipes is that the optional quantity variable on the drainable is for it's uses
so if you type keep GnomeBarRB instead of destroy
that means the recipe is only using one charge of the battery of the item for the recipe
so in theory you could put something like Keep GnomeBarRB = 50 which would mean it would require 50% of charge in order for the recipe to be valid
this becomes an issue because you don't have a way to get the battery charge prior to the recipe definition so you'll never know how much charge the player has, therefore you can't create a recipe that will consistently work
oh
dang
i actually documented this exact problem
and the troubleshooting
just last night
if you want to take a look
it was showing the "All" option because it was only using 1 charge use from the vape
so technically that action could be done 99 times
so instead, the recipecode.lua first gets the charge of the battery that you're inserting and makes a new vape with that level of charge
thats so wierd
yea i have very little knowledge but i keep trying i just squirrel so easy
ive created the vape mod like the one u smoke, the vape battery, and then the vape juice just been having issues with them working with eachother. Only way i was getting them to work with eachother was really janky cause i had the vape charge off a battery but it would only consume part of the battery then you had to have the juice in hand. so it was really wierd
I appreciate the help
Oo yay 
How do I check in my mod, if other mods are used? So I can add if modID in modList then ... end?
See getActivatedMods. Returns an ArrayList of strings, which are the mod IDs of activated mods. You can use :contains(modName) on the result
Perfect! Thanks!
There's isValid checks for recipes that make the recipe not show up if it fails the valid check.
Basically runs the ingredients as arguments to bounce checks off of
There should be some examples in recipecode.lua
what lua functions do you use in order to check when a player is connecting to your server ?
Hi, i would like some help about how the funcions and methods work in Pz modding, im trying to just spawn a zombie in a point but i keep getting an error, this is my code rn, i tried to make it simple until i know how this works
its becomes this error in debug mode; "java.lang.RunTimeException: Object tried to call nil in spawnZombieEverytenMinutes"
hey π => #mod_development message
where did you find the getVirtualZombieManager ?
Guide to modding various aspects of Project Zomboid - Zomboid-Modding-Guide/README.md at master Β· FWolfe/Zomboid-Modding-Guide
@autumn garnet @fast galleon Thank you for the response! Sorry i send it with the getVirtualZombieManager, it was a try that i read from an old post in indieStone, the problem it was i wasnt using VirtualZombieManager.instance: . Dont know why that instance is needed but seems to work.
And i read that documentation but didnt saw anything about that, maybe its something from lua that i dont know, still learning.
OnWeaponSwingHitPoint
vs
OnWeaponSwing
whats the difference again?
When i back to my home, i can send you the line to spawn the zombie ^^
I already got it, as i said i only missed the .instance on the method. Dont know why that is needed but it works. Now im gonna try to focus on radio and see if i can create a new broadcast channel for the mod where info is sent throught that to the players
Like dynamic spawning horde with radio annource ? ^^
More like Quests/events to players to move to a point to fight the horde or retrieve supplies to get a reward π
Ofc wont be easy, they must be prepared
I talk about this with Spacew00t and yoshiwoof ^^ it's a great addon for the game dynamics quest/random horde with announcement on emergy broadcast to be link with Save Our Station
For me the radio part isn't easy ^^ i have already the spawnHorde script like you
Yeah, exactly. I want to spice things a bit on the game, some loot crate loots surrounded by zeds, or having to go to a Hospital to a certain floor to get a cure for infection, horde coming and even some sort of multi event where you need each part, like a map that spawned in some point and a code that spawned somewhere else and with both things you can retrieve the special loot, etc. Still need to see what can you do with the game
I suppose the npc part is still no available even for just being more realistic
Pao did 2 of those mods
But its for our clients specific needs
Lore of their server and map setup is just for their server
But that one of the things we offer
Is to provide what we called
Server Events Mod
@merry storm
You can spawn a vehicule with random angle to simulate an accident
Haven`t seen anything like that, is that how its called? its on the workshop?
That`s a cool idea. haven't thought about this
I have made an vehicle claiming mod and currently, I am using sandbox settings for server owners in general to append trunk cover parts for mod vehicles with their own different trunk cover parts naming.
I am wondering if there's already an library or some modders made one in their mods to retrieve or generate these part names of mod vehicle?
Wow, thank you very much
Hi . I thought that project is done?
Kwrr right? π
Hey π https://steamcommunity.com/workshop/filedetails/?id=2462558471 maybe you can search here ^^ i will publish the patch tonight to fix some error about trunk
Just as a thought. Those with more knowledge. How easy would it be to create this black text background in game?
Guise, novice question. I found this method that could be very useful but I have no idea how to use it. Apparently it returns an arraylist if succesfully called? But what does it want? https://projectzomboid.com/modding/zombie/characters/traits/TraitFactory.Trait.html#getMutuallyExclusiveTraits()
declaration: package: zombie.characters.traits, class: TraitFactory, class: Trait
Erm, he helped me with the initial UI which I appreciate it as it give me an general idea of PZ UI framework, I then proceed to revamp the entire UI. As for the backend, well, there are features I would like to keep adding on and optimizations to be done.
https://steamcommunity.com/sharedfiles/filedetails/?id=2957935793
Much appreciated, will take a look.
I don't really know at all but I found this https://projectzomboid.com/modding/zombie/ui/TextDrawObject.html#setDrawBackground(boolean)
declaration: package: zombie.ui, class: TextDrawObject
i would love to be able to help you sir but im not good with UI stuff
Fairly easy; there are existing UI components you can use to draw this using their background, or with drawRect. Check out stuff in the client/ISUI folder
In terms of drawing it behind text, the text manager (you can get it with getTextManager() has methods to measure a string X and Y that could help position it. May not be strictly necessary to do all that since there are existing components, but either way I think the answer to the question is "not too difficult"
It just occurred to me that you may be talking about doing that for player chat textβif so, I amend all of what I just said to instead read "dunno" (not at my home computer to check)
Made some progress on translating documentation for Food properties this morning..
I'd like to get some template commands into my VSCode extension. If I can get some templated item scripts or other types, that'd help.
like a command: New Food would spawn a basic food item entry into the script document.
This is entirely doable however I'd need help for this.
Heya! Where do y'all look for what the available events are? Is this list in the wiki up-to-date? https://pzwiki.net/wiki/Modding:Lua_Event
I'm looking to see if there are any events available when a tv starts playing a program, specifically.
#mod_development message
there's also this
Should be one for it or something related to the actual program since some shows give XP in specific fields
that's probably the short blade instakill attack
Can anyone guide me to a good tutorial to understand how to actually make a mod for this game. i have been trying for a few hours now but getting nowhere the amount of guides for this kind of stuff is very scarce which is odd given how many mods are available for this game, i have been using a lot of mods and would like to make my own to improve my and other people experience's
Hello dear Zomboid modders, is there a guide or an example mod you could recommend that would help me learn how to PATCH existing item definitions and functions, instead of overwriting them? I.e. add tags to an existing item, instead of redefining it.
Very basic guide: Go to C:\users\ <username>\Zomboid\mods , copy ExampleMod, do all your changes.
Where exactly do you get stuck at the moment?
Very well thanks, most tutorials make something about adding an item. But im trying to change the way how something works about the game eg: adding a radio channel or changing what a specific moodle does. To my understanding on how mods work is basically everytime u activate a mod it copies file to project zomboid's main directory correct or not?
-- hook function
local old_funcName = funcName
funcName = function(...)
-- code to run before the original
old_funcName(...)
-- code to run after the original
end
-- add tag to item
local item = ScriptManager.instance:getItem("Module.Item")
if item then
local tags = item:getTags()
if not tags:contains("YourTag") then
tags:add("YourTag")
end
end
No, it loads code from the mod after main game, @civic forge . It doesn't really copy any files.
@bronze yoke That is clever, basically you parse the item via LUA and modify it. I didn't even think about it, thank you.
Oh well basically the same thing thats what i was wondering
Mods are basically a part of the main directory thats what i wanted to know thats what i thought when i saw the same folders for the mods and the main directory
If you don't mind, I would like to understand better how hook works.
- I name the existing game function as something new
- Then I define in this new function whatever I want + call old function
What exactly does "old_funcName = funcName", could you waste a minute of your time and give me insight on what it does?
Somewhat a style matter, but I argue that you should prefer function funcName(...) rather than local funcName = function...
Most of the time it doesn't matter, but if you want to recursively call your overriding function, it absolutely does
@civic forge It's important to understand that mods are NOT a part of main directory. They carefully reflect a similar structure, but not everything in main directory can be modified. Yet, if it makes it easier to understand, go for it
you save the original function into that variable, and then overwrite it with a new function that calls the copy of the original
@bronze yoke , @calm depot Thank you, for finding time to give me insight and making me learn.
in my own eyes i see it as an addition to the main directory reflecting a similar structure it helps me understand it a bit more
small edit, that was meant to say "local function", not just "function"
ofcourse they aren't part of the main directory thats why they are a "mod"
@bronze yoke Aha, so in local old_funcName = funcName
old_funcname - is just a placeholder variable that gets called later
funcname is the actual name from the game
At first I thought that old_funcname is the "original function name", and that made no sense.
Now it is clear, thanks a lot
actually no, I take it back, since you're redefining, you shouldn't use "local" π
π
can I make a recipe that doesn't require anything? Or is there an item that always exists on player?
Recipe exists
There's no source item to check if recipe can be done.
try it - if it doesn't work, you could always just make it require a single, extremely common thing and make it use the item without consuming it
Alright, time to go and rewrite the code of my "Shout sound" that basically hacked and overwrote emote wheel function to make sound when you yell. Now I can make it a proper patch. Thanks a lot!
@bronze yoke A sanity check before I commit, following your logic, is it what overwriting IsEmoteRadialMenu:emote(emote) should look like?
I mean patching to the end of it, not overwriting
print('Hello, #mod_development!');
when a lua function is defined with : there is an implicit self parameter
@frosty stirrup
so you should call old_ISEmoteRadialMenuEmote(self, emote)
Also you can be evil as a modder by using anonymous functions to shell your mod's logic.
Ah, that's what : is. Thank you
give me a sec
and you should grab the function like
local old_ISEmoteRadialMenuEmote = ISEmoteRadialMenu.emote
I'll fix it and use proper tags as Jab showed me, thank you
hello! a bit new to zomboid modding and having a spot of trouble. i'm trying to add a new backpack (just a duffel bag with the stats of the military bag) and it shows up just fine when i'm holding it in my hands, but is completely invisible on my back. i'm fairly certain i've isolated the issue to this file here but i've not had much luck finding where exactly the issue is
@bronze yoke
What about this, should it be
ISEmoteRadialMenu:emote = function(emote)
or
ISEmoteRadialMenu:emote = function(self, emote)
?
it should be the first
So
local old_ISEmoteRadialMenu = ISEmoteRadialMenu.emote
ISEmoteRadialMenu:emote = function(emote)
old_ISEmoteRadialMenu(self, emote)
if emote == "shout" then
self.character:Callout(false);
-- Adding sound to shouting via radial menu
local dist = 2
local gender = ""
local loudness = ""
local pl = getPlayer()
local VoiceKind = ""
if pl:isSneaking()
then
loudness = "whisper"
dist = 5
else
loudness = "shout"
dist = 40
end
if pl:getDescriptor():isFemale()
then
gender = "female"
else
gender = "male"
end
VoiceKind = tostring(loudness.."_"..gender)
getSoundManager():PlayWorldSound(VoiceKind, pl:getSquare(), 0, 0, 0, false);
addSound(pl, pl:getX(), pl:getY(), pl:getZ(), dist, 0);
end
end
looks good to me!
Is it a mod I missed on workshop, @fast galleon ? π
I like Callout patch a lot more than patching ways to access callout
when you define a function with : it adds the self parameter automatically, and when you call one with it it passes the object on the left side of the : as self (so ISEmoteRadialMenu:emote("shout") passes ISEmoteRadialMenu as self)
Wrong dude, there's two polters
Oh, so that's what : is.
oh probably worth noting here as well- the random hue generation seems to work when in the hands as well, but the 3d model turns into the base white model when it's placed
I was wondering, since I only know C#, what : was about. I was kind of using it blindly so far, 1st day modding π
the interpreter will read function object:method() exactly the same as function object.method(self), it's just different syntax
@fast galleon I understand what your script does, and it does it well. Much better than me hijacking Shout button or Radial menu action.
Is it one of mods you've posted? I would rather use your approach, but I don't want to blindly steal code especially if it's already used elsewhere.
I made this but the sounds are grabbed from the web
Can you share the workshop link?
I only have a local copy now
My mod is this, and I wanted to improve it by avoiding redefining vanilla functions
https://steamcommunity.com/sharedfiles/filedetails/?id=2960089295
Can I simply use your code since it's better, and add you as an author?
sure
I will add some more code since I check for gender as well
Oh, also you seem to use PlaySound, I used PlayWorldSound, with a distance. How does PlaySound work in MP?
the initial idea was to add possible sounds to ISPlayerData and then pick one
I haven't tested it much
I thought playsound plays only for the player itself
i don't believe this is a texture error, seeing as it does render properly when held in the primary or secondary slot? that's all i'm finding in my research that'd explain the invisibility
i'm getting this error as well, and i've checked and triple checked to make sure i've referencing the right file and i definitely am
wait. i am a fool. i forgot the file extension.
Well, sadly this method didn't work. It does nothing. Time to debug a little :D.
where are the item icons stored in the files? they don't seem to be with the textures
oh, actually, i'm not sure if you can use : in this context ISEmoteRadialMenu:emote = function(emote)
i think it has to be ISEmoteRadialMenu.emote = function(self, emote) or function ISEmoteRadialMenu:emote(emote)
anybody working on a bicycle mod
Woah, cool knockback
Um, there used to be a function reference list on PZwiki, I can't find it anymore, was that being replaced by something else?
function reference list? do you mean this site? https://projectzomboid.com/modding/
Yes, but it was more of them.
Hey @bronze yoke , I am trying to use your approach to modify items via LUA, but it does nothing.
I think it's because my function is not called anywhere? What is the proper method to call function on game start/load?
Example for debug purposes that doesnt work
function TagAllItems()
self.items = getAllItems();
for i=0,self.items:size()-1 do
local item = self.items:get(i);
if not item:getObsolete() and not item:isHidden() then
if string.find(item.getDisplayName(), "tire") then
item.Name = "Changed Tire Item"
end
end
end
end
if you want to do it on game start, you can just not put it in a function, or call your function after defining it
oh, you mean just use .lua as a function, and the game calls the whole lua file when it loads it?
that sounds... logical π
I think two months on overtime work caused me a brain damage π
also in this case self isn't declared anywhere, you can safely just drop all the self references
I was looking at how ISItemsListViewer works, so I obviously didn't get where self came from there
most likely the functions use :s and self is the ISItemsListViewer table
it also doesn't want to index "items" done this way
Yeah, it was function ISItemsListViewer:initList()
Oh, I have a very stupid question that probably messes up everything in my code
Why do some lines have ";"?
Oh, I was trying to figure it out for like 5 min π
it breaks the line, so you can do multiple lines in one line with it
but putting it at the end of a line doesn't do anything
Hmm, I made it worse π
function tagTires()
local items = getScriptManager():getAllItems()
for i=0,items:size()-1 do
local item = items:get(i)
item.SetDisplayName("Item")
end
end
tagTires()
This looks fine to me, but causes NIL on the last line
when I try to call the function
should be item:setDisplayName, not item.SetDisplayName
function: tagTires -- file: tagAllTires.lua line # 5 | MOD: YMC - Rip car tires
function: tagAllTires.lua -- file: tagAllTires.lua line # 13 | MOD: YMC - Rip car tires
ERROR: General , 1681250898175> ExceptionLogger.logException> Exception thrown java.lang.RuntimeException: attempted index: getObsolete of non-table: null at KahluaThread.tableget line:1689.
I think it dislikes me trying to get (i) from items, no?
attempted index: getObsolete of non-table sounds like it's still running some old code
like it's a null list
oh wait no I am stupid, I rewrote it a bit
function tagTires()
local items = getScriptManager():getAllItems()
for i=0,items:size()-1 do
if not item:getObsolete() and not item:isHidden() then
local item = items:get(i)
item.SetDisplayName("Item")
end
end
end
tagTires()
oops
item is on wrong line
I need coffee π
But I think I have the most trouble with this
should be item:setDisplayName
declaration: package: zombie.scripting.objects, class: Item
Should I be calling ALL methods of instantiated classes as "self"?
Or what is the logic behind it?
item.setDisplayName(item,"Item") should work too, if it helps.
So I still be breaking the game, with buffer overrun for sprites etc
function tagTires()
local items = getScriptManager():getAllItems()
for i=0,items:size()-1 do
local item = items:get(i)
if not item:getObsolete() and not item:isHidden() then
item:SetDisplayName("Item")
end
end
end
tagTires()
I cannot see it
function: tagTires -- file: tagAllTires.lua line # 7 | MOD: YMC - Rip car tires
function: tagAllTires.lua -- file: tagAllTires.lua line # 13 | MOD: YMC - Rip car tires
LOG : General , 1681251199211> Object tried to call nil in tagTires```
setDisplayName
oh, is it the Linux Filesystem trouble again? π
Oh no π
I thought the capitalization is optional
It does, thank you
Great, I made it to work, but now I need to figure out why string.find behaves not how I expect it to be
function tagTires()
local items = getScriptManager():getAllItems()
for i=0,items:size()-1 do
local item = items:get(i)
if not item:getObsolete() and not item:isHidden() then
if string.find(item:getDisplayName(), "tire") then
item:setDisplayName("Generic Tire")
end
end
end
end
tagTires()```
does it also check for capitalization, so it doesn't affect Tires?
Indeed it does lol
Now it all works, so I finally can put tags on items if they have something in the name
So much trouble just to learn how to slap tags on items by name.
But so much learnt.
Thank you very much for the patience.
does anyone have a link to a resource on how the random tint/coloration thing works for clothing? the custom bag i've made generates properly as a random colour and keeps that as long as i only wear it on the back or set it on the floor, but holding it in either the primary or secondary slot wipes the colour and sets it to the default white
@bronze yoke And I just realized that [Recipe.GetItemTypes.SharpKnife] is actually a call to a LUA function lol π
What would be the best way to make a new tag then, should I create a new LUA function like Recipe.GetItemTypes.MyTag?
yeah something like that
Interesting, simply making a new function like
function Recipe.GetItemTypes.Tire(scriptItems)
scriptItems:addAll(getScriptManager():getItemTag("Tire"))
end
does not work, it creates an error spam in console about an attempt to index a non-table
That's for items that have the tag in their scripts already.
yeah, and just above I added the tag
what folder do you do this in btw?
function tagTires()
local items = getScriptManager():getAllItems()
for i=0,items:size()-1 do
local item = items:get(i)
if not item:getObsolete() and not item:isHidden() then
if string.find(item:getDisplayName(), "Tire") or string.find(item:getDisplayName(), "tire") then
local tags = item:getTags()
if not tags:contains("Tire") then
item:setDisplayName("I am a tire")
tags:add("Tire")
end
end
end
end
end
tagTires()
function Recipe.GetItemTypes.Tire(scriptItems)
scriptItems:addAll(getScriptManager():getItemsTag("Tire"))
end
Like this, in media/lua/client
setDisplayName works, but adding tag on its own does nothing since I cannot refer to it in crafting scripts
the Recipe table is created in server folder, which loads after client folder.
Are you.. using elif to print all combinations of positions on the board? π
@ancient grail can you make a table flip animation?
Yeaj

Genius, I know
ow wow

sure
for what
ahhhh]
ok i get it

this might be a silly question but where can i find the base games tooltips file? im trying to get a reference of what they look like or how to even wright them so that way i can finish this mod lol
Example:
I keep seeing
Tooltip = Tooltip_item_Campfire,
But idk where that is coming from
@bronze yoke
Thank you very much, it all works how I wanted now.
https://steamcommunity.com/sharedfiles/filedetails/?id=2961166256
You helped immensively
π
General Plea: Is there anyone who could show me an example of their workflow for actually using lua instead of plain text files? Or maybe a mod that I can skim through to learn with?
Conceptually I understand what decompiling is and how to do it, but I'm having a hard time understanding WHAT to do with the stuff I see. I can offer coffee in exchange for the assist π
hey Captain
I am new, but maybe I could also help if you could tell us more what is the actual problem
People here are VERY helpful
Are you struggling with syntax, API, editor or something else?
There's no decompiling involved
I can edit the text files to create new items, and even 3d models with textures. But editing the "deep" code eludes me. I need to change some values around and I don't know how to even begin approaching the issue.
Aha, do you know LUA syntax?
The functions() methods() and such are the thing I struggle with
A bit. I've read a few tutorials and Im versed in C, C++
The blending of java makes it.... sussy
I am also versed with C++ and C#
Lua is... different
Just today I was told that indexes in arrays start with 1 π
But yeah, you can find a lot of useful stuff https://www.lua.org/manual/5.4/ here
Yupo
As for actual game code, you would want to simply do two things
Ok Ill give it a look see.
- Most of game code in LUA is here: C:\SteamLibrary\steamapps\common\ProjectZomboid\media\lua
- You can also make a GREAT use of the API reference for PZ here: https://projectzomboid.com/modding/
package index
You can find most of objects, methods and functions there
After that, I guess it's just practice
I am in the same boat, trying small stuff first
What I usually do is
- Find a mod that does something I want to learn how to do
- Check what it does and how
- Note original game functions it touches
- CtrlF "all in files" in \steamapps\common\ProjectZomboid\media\lua using Notepad++ and see what those functions actually do
- Rewrite or patch them adding my own code
Albion helped me a lot to learn how to modify existing items, and Poltergeist - functions
https://steamcommunity.com/sharedfiles/filedetails/?id=2960089295 - I patch base game Callout method. May be quite complicated, feel free to ask
https://steamcommunity.com/sharedfiles/filedetails/?id=2961166256 - I patch base game items.
when i need lua i search the lua folder with my ide, and when i need java i use the api reference to find stuff that seems relevant and then check the decomp to see if they actually do what i want them to do
Thats the part I want to break into but I'll check out these resources first and try some kitbashing. If I need some more assistance after that I'll reach out to You or Albion. Thank you both for your input
I wouldnt have learnt and finished these two small mods without huge help here
So dont be shy π
so having an issue with the mod im working on with a friend, we finally got it to have a use delta and have it give the play a small boost but it seams we cant use it not sure why any suggestions?
item RedVape
{
FatigueChange = -12,
Weight = 0.2,
UseDelta = 0.1,
Type = Drainable,
UseWhileEquipped = FALSE,
DisplayName = Red Vape,
Icon = RedVape,
Tooltip = Tooltip_Vape_RedVape,
StaticModel = RedVape,
Medical = TRUE,
}
}
thats what it looks like right now
the old one we did use was
item RedVapeOLD
{
DisplayName = Red Vape,
DisplayCategory = Vapes,
Type = Food,
Weight = 0.5,
Icon = RedVape,
Packaged = TRUE,
UnhappyChange = -25,
StressChange = -15,
EatType = Cigarettes,
RequireInHandOrInventory = VapeJuice,
ReplaceOnUse = EmptyVape,
CustomContextMenu = Vape,
CustomEatSound = vapeinhale,
StaticModel = RedVape,
WorldStaticModel = RedVape,
}
it's not a food anymore so you can't 'eat' it anymore
im using the Vitamins as a base for this vape lol
item PillsVitamins
{
DisplayCategory = FirstAid,
FatigueChange = -2,
Weight = 0.2,
UseDelta = 0.1,
Type = Drainable,
UseWhileEquipped = FALSE,
DisplayName = Vitamins,
Icon = Vitamins,
Tooltip = Tooltip_Vitamins,
StaticModel = PillBottle,
WorldStaticModel = Vitamins_Ground,
Medical = TRUE,
}```
in the first post thats the new file trying to make it work like vitamins
You don't π
Vitamins type = drainable
with usedelta 0.1
Ah I am stupid
I looked on 2nd
let me think, sorry
lol yea my bad the second one is the old script i was using the first one is the new one
It's been a long day
haha your fine
unless i need CustomContextMenu
so that didnt work but when i look at the item code for vitamins it says nothing about take pills in it, so where does the script call for that?
Only antibiotics seem to have CustomContextMenu
are they drainable?
nope
ahh yes that is a food
have you tried keeping DisplayCategory, maybe it's tied to that via some script?
i can try one seconded
sadly is not tied to that
im going to fully copy the vitamins script and not touch it at all to see if its useable in game first or if im just missing something when im doing this
so even just taking that item script right from vitamins its not giving me the ability to consume it so there is another file touching it giving it the Take Pills option but idk where that could be
it might just be implemented in lua
how would i go about making an lua for making it smokable?
as i left everything the same it kinda just did this XD and its still not useable
I do not see anything about PillsVitamins in lua besides distribution and translations
so how does the game know its to Take Pills π¦ (or can i write a lua to make it smokeable)
This is a very good question, I am confused now π
xD i am too!
For example, WoodGlue is also Drainable type with UseDelta, but you cannot "take" it π
just like welding pipes XD
Why did I actually think this was serious for a whole second
The terror that filled my soul
or should i try to base it off a drink?
like a water bottle or a soup
Looks like the context menu code just checks if its type starts with "Pills"
Not the first example I've seen of something like that; hopefully will be replaced with tags eventually
so try putting pills in the code name?
In the name of the type, not including the module name
So Vitamins are "PillsVitamins" in their item script
if not ISInventoryPaneContextMenu.startWith(testItem:getType(), "Pills") then
isAllPills = false;
end
...
if isAllPills then
context:addOption(getText("ContextMenu_Take_pills"), items, ISInventoryPaneContextMenu.onPillsItems, player);
end
Yes, although I wonder if it'd be better to just add your own
it's implemented in lua
module Base
{
item PillsVitamins2
{
DisplayCategory = FirstAid,
FatigueChange = -2,
Weight = 0.2,
UseDelta = 0.1,
Type = Drainable,
UseWhileEquipped = FALSE,
DisplayName = MyVitamins,
Icon = Vitamins,
Tooltip = Tooltip_Vitamins,
StaticModel = PillBottle,
WorldStaticModel = Vitamins_Ground,
Medical = TRUE,
}
}
okay so is there a way i can make a lua that makes it say Use Vape?
you could just use context:addOption(getText("ContextMenu_Take_pills"), items, ISInventoryPaneContextMenu.onPillsItems, player);
lol would this be the time to tell you idk how to write an lua XD
It's never too late to learn
The answer to your question is yes there is a way & I'd probably do it using that
is making it do what take pills does and turn it to use vape do-able?
so the thing you sent?
Can you rephrase that question? I'm not sure what you're asking
so with my vape could i have the name base where it would say
"item VapeRed"
and where it has "Vape" have it act like how the Pills works for vitamins?
That would be doable yes, but I think you'd be better off utilizing tags
Scripts can specify tags that you can check for in Lua. The vanilla code uses a few of these, like HasMetal
yeah this whole startwith thing sounds like a nightmare for mod compatibility
okay yea fair
so make a tag that says "KVape" and if it has this tag it would call to the lua then use the context menu?
Yeah, you'd check for the tag in your code to add the behavior you want
that link you sent me is that for making a lua with a tag context menu?
if not could i get a base line to work with if someone does not mind helping me
I'd take a peek at some of the vanilla code or other mods that add context menus to see how to use it
do you know of a mod off the top of your head?
Plenty do, but I don't know off the top of my head, no
I know @fading horizon made a vape mod recently, so she may be of help
she was helping my friend earlier XD >.< but we didnt want to rip off her code so we went down the pill idea rout haha
does the They Knew mod use there own context menu? if you dont know thats okay im looking now for it just dont know what it would look like
How do i learn to make mods for this game?
Haven't used it so I'm unsure
See pins and threads in this channel for resources, read other mods' code & vanilla code and ask questions here about stuff you're unsure about
ill look into a few mods, if i cant figure it out would you mind helping me if you get some spare time
vanilla actually does it weirdly
i think the event is fired by vanilla lua, so it doesn't do it the way mods should
Yeah, trueβI should've specified that
so i found this mod that uses this
Vanilla code can be useful to show you how to add context menu items, but not really how to use the event (unless you look at the two files that use it, but they use it differently)
but im not sure how to link this to a tag >.<
Search for the part on the left in the mod's code
That'll show you where they use it
how do i search for it in the other codes in VS
Ctrl + Shift + F
what part of this would i be searching the contextMenu?
im pretty sure they use food scripts
0.o
The part on the left of the equals sign
thats not very good food XD
i dont remember clearly but when i was reading the code a while back the lua uses "Context_OnEat_Ampule" or something like that
ahh gotcha atm im looking at the context menu of reload all mags
and so far am confused lol
MOD IDEA:
put a zed to the ground
attach a bag to it
have it follow you
ZedMuleMod
Lol, dont take modding advice from me ValZaren
I've managed to make it work by breaking every other context menu π
so project paradize? the game releasing in december this year
a game where you muzzle and mind control zombies to do work for you
This actually gave me an idea!
One second!
I need to learn to work with context menus at least once
if you figure it out let me know XD im looking at this and pretending im learning haha
It's 4:04 AM here. Brain.exe not found.
it gets the menu but i fully broke it XD
it wont drain lol this is what i did
it no liked that haha
Ah, you are trying to work with customcontextmenu directly in scripts, I was trying LUA
lol im afraid of LUA wanted to see if i can avoid it and nope
i have to make the lua for it >.<
lol i dont have one
was looking at someone elses mod to try to make one but i have no clue how to even start it
i just wanna make the item usable like pills but with a tag so i can have
Tags = KVape
then have the context menu say something like Use Vape
general advice for finding code:
- find the translation string for whatever the game already has (e.g. "Take Pills")
- search for that translation string in the code
issue i was having with that is im not sure how to search for that stuff, i tried looking in the translation files but there are alot of files and i kept looking for take pills and couldnt find it
if you are searching manually, you are doing it wrong
visual studios is what im using
you're using a machine with orders of magnitude more power than the rocket that landed on the moon.
download a search tool, Visual Studio/VSCode can also search through folders
im more art savvy than i am tech XD
So I've learnt how to add a context menu
Vape = {};
Vape.doMenu = function(player, context, items)
local vape = nil;
for i,v in ipairs(items) do
local tempitem = v;
if not instanceof(v, "InventoryItem") then
tempitem = v.items[1];
end
if tempitem:getDisplayName() == "MyVape" then
vape = tempitem;
end
end
if vape ~= nil then
context:addOption(getText("ContextMenu_Take_pills"), items, nil, player);
end
end
Events.OnFillInventoryObjectContextMenu.Add(Vape.doMenu);```
Sadly that menu does nothing
Where are context menus defined again? π
or is it "nil" in addOption that makes it do nothing?
you need to provide a callback function
aha
if the player clicks your menu item, the callback runs
all i can find for context menu was this but i dont think this was the part i needed was it
that is what you need. You can now search the lua code for ContextMenu_Take_pills
Can I make a callback on default function that is called for standard pills?
your function gets passed a list of items you can implement whatever logic you like to determine whether or not you want to add context menu item(s)
how to i search all files at once again >.< sorry this is givng me over load XD
also, I don't recommend using DisplayName since that will differ depending on the player's language. you should in the ideal case, use tags. If you can't use tags because it's not an item you're creating, use its internal name instead
"name" is the internal name, right?
Google "Visual Studio (code?) search for text in folder"
I believe that is the one, yes, you can always print it to the console to verify
also, even if it's not an item you're creating, you should check if it has tags
i'm not sure what name returns in contrast to display name, but for the internal name you use getType() or getFullType()
full type including the module
true, getFullType() will be the most accurate, but will also make your code more inflexible. If you utilise tags, it makes it easy to add new items with the same tag, and your code will just work with them
was this what im looking for?
okay so what do i do from here XD
the third argument is the callback function
thats the getText right?
um, if you don't know how to code then you're trying to walk before you can crawl
no, that's the first argument
@calm depot Is DisplayCategory also affected by languages?
I don't think so, but are you really sure you want to match on that?
yep
I want to tag all items that have VehicleMaintenance display category and Tire in the name as "tires"
including other mods
wouldn't it make more sense to see if it has the WheelFriction attribute instead?
you shouldn't need to check anything other than that
Good news, displayCategory is not affected by language π
There was only one way to find out for sure
That looks more reliable
is there a youtube video for making a context menu >.< im struggling over here with making a tag connect and recall to a context menu to make the item smokable
I assume it's 0.0 if it's not defined?
so i got the two context menu parts for the take pills but im not sure where to go from here, i know im a noob at this but do i need anything else than this to create what im doing?
As long as some crazy modder doesn't make a pen with wheelfriction π
I think I will combine DisplayCategory and this
honestly, if they do, that's on them
Uh, I was wrong
no point writing code to defend against someone else being hypothetically stupid
I get LOG : General , 1681264277374> Object tried to call nil in tagTires
With this
function tagTires()
local items = getScriptManager():getAllItems()
for i=0,items:size()-1 do
local item = items:get(i)
if not item:getObsolete() and not item:isHidden() then
if item:getWheelFriction() then
local tags = item:getTags()
if not tags:contains("Tire") then
tags:add("Tire")
end
end
end
end
end
tagTires()
function Recipe.GetItemTypes.Tire(scriptItems)
scriptItems:addAll(getScriptManager():getItemsTag("Tire"))
end
It looks that I am not correctly checking NIL here?
if item:getWheelFriction() then
you mean getWheelFriction entirely fails for something that isn't a wheel?
yeah, it throws an error "tried to call nil"
getWheelFriction is a method of InventoryItem, not Item
all you care about doing is checking if the function exists
don't need to actually invoke it
ah, then it would also fail for an actual wheel
And it works
getdisplay is both
Ah, it belongs to both
so, back to checking names and displaycategory huh? π
oh, it has VehicleType
@bronze yoke do you remember offhand the function name for getting a key defined in an item's script
because WheelFriction should also be fetchable that way
like a reverse doparam? i didn't know there was something like that
Check out named literature
That's where I learned how to do a custom context menu
In the isui.lua file
where can i find that
On the workshop
is that in the base game files?
I'm afk rn or I'd link it
o lol
No it's a mod
thank you will go look now
Could i make something like
local wheelFriction = inventoryitem.getWheelFriction()
?
to fetch the value from the item?
yeah i've seen that work before
then I definitely want to implement a displayCategory check to avoid checking each item in the game via creating items, right? π
Or will it garbage collect itself?
AFAIR, it should, yes
though in the interests of efficiency, you should have a table that caches the getFullType
still best not instance every item in the game or you might extend load times a bit too much
so you can first just consult the cache rather than instantiating a class instance every time
doing it just once for each item consulted during the game shouldn't be noticeable
i think it's just a run once thing
isn't his code running when the player right clicks their inventory
you've got two different people confused
he's adding tags to all the tires at game boot
well simply checking if it's null makes it fit ANY game item π
so it's not null
yeah, it's a java class method that's exposed to lua, that will actually always be present
Oh man, spent like 15 minutes now just because I used item.getDisplayCategory instead of :getDisplayCategory
I need to get used to those SELF methods π
item.getDisplayCategory(item) π
Fixed
function tagTires()
local items = getScriptManager():getAllItems()
for i=0,items:size()-1 do
local item = items:get(i)
if not item:getObsolete() and not item:isHidden() then
if item:getDisplayCategory() == "VehicleMaintenance" then
local inventoryItem = InventoryItemFactory.CreateItem(item:getFullName())
if inventoryItem:getWheelFriction() > 0.0 then
local tags = item:getTags()
if not tags:contains("Tire") then
tags:add("Tire")
end
end
end
end
end
end
tagTires()
function Recipe.GetItemTypes.Tire(scriptItems)
scriptItems:addAll(getScriptManager():getItemsTag("Tire"))
end
Thanks a lot
Now it will tag all VehicleMaintenance items that have wheelFriction
Awesome
0.0 and 0 are the same you know
yeah, I was experimenting with int vs float when it wasnt working
until I noticed :
Hehe
Lack of : rather
lua doesn't distinguish between ints and floats, except internally, but that's invisible to you
scripting languages written by the criminally deranged
I'm being a little hyperbolous, but really, strict type matching like that should make the comparison ill-formed rather than doing something evil like always evaluating to false
It's mostly because it's not a real programming language, and it's also quite limited by source ports it applies to
So they use int/float difference in division for different types of operations (bitwise/float division etc)
It's not that hard but it kind of made me use float when the float is due π
I think I asked here before but I never figured it out
I have this mod that just renames all the cars from another mod to be lore friendly. For me, it seems to work fine in SP, but completely stops working in MP
Is it the same for anyone else? Any idea how I could fix it? I really need help here
https://steamcommunity.com/sharedfiles/filedetails/?id=2811283502&tscn=1681019249
something's interpreting the script, it could throw up an error when you try to compare a float with an int
so this was everything i could find for the take pills function, now i have to find out how to make it into a vape UI and or just figure out what any of this means π
but idk how this would apply to a tag
I made some noted for this code. Just want someone who knows lua to take a peek and tell me if I messed up anywhere. (Just testing my perception here)
Also does ISFurnaceInfoWindow = ISCollapsableWindow:derive("ISFurnaceInfoWindow") mean the ISFurnaceInfoWindow derives its attributes from ISCollapsableWindow?
What does the field on ranged weapon items AimingMod do?
on this line is there a way to get it where they have to have those items and another to use it? instead of one or the other?
tried to do VampeJuice/Ex/Ex,VapeBattery, but then it breaks
, is used to split it first
= is used next
error is because you don't have =
Generally you won't be able to do things that aren't done in Vanilla by default.
what's the zedscript for adding a text tooltip to a recipe?
would it just be Tooltip:?
woah, did Aiteron finish the PZwiki modding guide?
looks like there are a lot of separate pages for items, meanwhile recipe, sound, and vehicle have only one lol
no text tooltip π
oh well
Dont use item tweaker
Here read ehat blair said about it
#mod_development message
Basicslly item tweaker
Just adds another dependency you dont need
Because its feature is vanilla
You should use doParam instead
Theres an example there
For more about doparam
Search the thread i posted albions guide iirc
Konijima wrote a tooltip api
Im bot sure thats what you are looking for but it might be worth checking it out
eh, I already did what I wanted to do
Time to disappear once more and come back in a month or so to help code something lol βοΈ
You might need to use do param to modify those
But i dont think you get what its current values are
is there a way to in a recipe for the recipe to consume only a poortion of an object like a useDelta variable
this would be for a food item
Had my mod working for a bit, now I'm getting:
attempted index: getFullType of non-table: null
Any ideas?
Comes up when I try to open the item viewer in debug
@dusty wigeon I've had some success changing the item type to drainable. Use delta is a fraction of 1, as I understand it. So useDelta = 0.1 will be ten uses.
not sure i can use a non food item to mix with a food item but i may be wrong
You can. If it's part of a recipe that's all that matters.
I created a large salt shaker that is drainable but totally works in recipes as a spice.
item LargeSaltContainer
{
DisplayName = Large Salt Container,
DisplayCategory = Food,
Type = Drainable,
Weight = 0.75,
Icon = LargeSaltContainer,
UseDelta = 0.02,
CantBeFrozen = TRUE,
EvolvedRecipe = Pizza:1;Soup:1;Stew:1;Pie:1;Stir fry Griddle Pan:1;Stir fry:1;Burger:1;Salad:1;Roasted Vegetables:1;RicePot:1;RicePan:1;PastaPot:1;PastaPan:1;Sandwich:1;Sandwich Baguette:1;Taco:1;Burrito:1;Beverage:1;Beverage2:1;Beer:1;Beer2:1,
Spice = true,
HungerChange = -10,
ThirstChange = 20,
UnhappyChange = 20,
WorldStaticModel = LargeSaltContainer,
FoodType = NoExplicit,
Tags = MinorIngredient;Salt,
scale = 0.1,
}
ok so i have the liquid as a drainable how do i set the level it has in it
Divide 1 by however many uses you want. Then use that number as useDelta value.
1/50 = 0.02 for example
We dont tell it how many uses; we tell it how much of 1 does it use per use.
problem im having is in the recipe when i go to craft it it decides it wants to use the entire ingredient
What is your use delta set to?
0.05 for the item
And it's type is set to "Drainable"?
yea
Hmm, mind DM'ing me the items code?
Gonna need a bigger jar
is there an specific class that handles player connections server-side ?
@primal remnant did you completely ignored my msg and just went ahead with something else? In any case goodluck
What IDEs do you folks use, to develop Project Zomboid mods?
Visual Studio Code for me.
Doesnt really matter imo i edit the recipes in the standard text editor from windows
Hello, I have a small question about vehicle modding. Does anyone have experience with window textures? How do people achieve that "reflects sky" effect in some car mods?
I know it has something to do with the setting of Dynamic Skybox and Environment Reflection, but I couldn't find how it's implemented
The only relevant info I can find in scripts is "vehicle_noreflect" shader, and it seems to be set on windows on both mods where the reflections are working and aren't
Do you want to change that reflection or...?
I have a question about clothing modding. What files control zombie outfits?? to put the clothes of my mod
Can someone help me with changing the position of weapons on the players back? I had watched Peach's video on how to use the attachment editor and when I tried on my end it seemed to work only for me to find out I just changed the positioning of the shovel attachment point and not for the specific item I was aiming for
this is how it looks unedited
I don't like how it clips the player model
I want to make windows on cars that dont have reflections to have them
I didn't see your message, but I haven't been using ItemTweaker at all. I'm just checking my understanding of Lua syntax.
I've been stuck on a completely different issue this evening. I'm off to bed for the day. Be back on tonight.

You need a specific texture with the masks. Check vanilla vehicles they all have that texture defined
stupid question maybe to some, does gpt actually understand pz code/modding. or does it not have that knowledge
Could anyone suggest how to or where to look for info about creating of custom vehicle spawns?
i think just looking through existing mods like vehicle spawn zone expanded could help
Ty
I have a vehicle mod with an easy vehicle spawn code. You can copy it if you want and edit
Could you share a link to it? I'd be happy to learn from it
I don't know if I can put links, but write "La Bokeneta" in the Workshop and it should appear. Investigate from there, that's how I learned!
Thank you!
yw !
just a curios question but can i just open the ingame clothes in blender and edit them
my team lead has no idea about clothes in this game so i dont have nobody to teach me how it works
If im not wrong they are .fbx so i think itβs possible to open them in blender
yep, you can edit clothes in blender and you can edit clothes with GIMP or similar if the model its same as a vanilla one
Yeah it does. It also understands what each modding function does and can write code that you can copy-paste with minimal edit.
thanks
was wondering because i was asking it a step by step guide on a small tutorial on how to make a project zomboid mod but it just spewed nonsense and the code never worked
Oh, step-by-step you can get from here: https://theindiestone.com/forums/index.php?/topic/61-robomats-modding-tutorials-updated-12112013/
RoboMat's Modding Tutorials - An introduction to modding for Project Zomboid - I - Introduction I1 - Where to start I2 - What is neededI3 - Lua TutorialsI4 - Other Resources II - The first steps II1 - Getting the connectionII2 - The entry point: Events III - The first mod III1 - Preparations III1...
Question. How difficult is it to make a "Pack of X, Y, and Z, mod"?
isn't that guide outdated? its from 2013
as in, maybe, perhaps... packing "Unuseable Metal"?
First get permissions from X, Y, Z mod developer to make pack =_=
Not a mod pack.
I'm following it and it works just fine.
awesome ill keep that in mind
so i did that but its still only requiring the juice not the battery its self
im looking for the coveralls FBX and cant find it
wait
i think in the files its called boiler suit
is this the only FBX?
its the only one i can find
It definitely does not
Thank you for your answer. I was trying to make reflections in the new Shark and Cytt's mod work, but they already seem to have masks. I will need to look into this deeper
GPT in general doesn't "understand" the code. It learns on models and provides answers based on something that someone has done before. It can be used for learning, but it will definitely not write the most optimal code, at least most of the time.
Mhm, it doesn't "understand" anything, because it's a large language model
Yeah, basically an advanced google translate
it is exciting as an indexing/search tool with metadata
I would argue against using it for learning even, tbh
but dont trust it π
Google Translate is an apt comparisonβI wouldn't use that to learn a language, for example
indeed, I used it when I needed to buy something from peddlers in another country, but instead I would rather use a teacher or video lessons if I had to learn the language π
Yup
I am actually learning a language right now, and Google Translate screws it up more than 50% of the time.
So yeah, don't trust these tools π
The tech behind it is pretty exciting though, if you know how to code
Oh yeah, Google translate certainly isn't to be trusted. Better than it used to be certainly, but nonetheless
I find GPT somewhat interesting but not as exciting as people are making it out to be
I also know at least one event in my corp where machine learning predicted one thing, but experts trusted their "gut" and did their own planning, and somehow experts were right and tool was wrong :
It's quite hard to replace real experts π
Especially when the tool is great at being confidently incorrect
The algorithms are helpful though.
For example, once we introduced machine learning in our KB offer mechanism to customers, the number of silly cases closed by KB decreased a lot.
So it has some applications
It certainly does, not denying that
Basically as long as "it's not critical to screw it up and you have a plan what to do if it breaks", it can be used
I'm talking specifically about LLMs
I was thinking abt this somewhat recently & just found what I was saying:
I don't think large language models are the future for practical use of NLP in communicative functions. They're neat for generating text, but they lack deeper understanding & I think that's limiting. What I'd like to see is application with deeper knowledge of a language's grammar (and the ability to understand implicit constituents or things commonly left out in speech) that can apply a likelihood to multiple interpretations
I like cool stuff like identifying cats on camera for scripting or making photos of people only when movement is detected
Why is this an AI posting channel now?
That stuff is neat. I just wish tech communication were better so people didn't blindly trust it
Sorry, it was a long answer to 1 question "can GPT code PZ" π
Offtopic for sure
Someone asked if GPT understands Zomboid modding
I get that.

It's a touchy topic. (At least I recognize this in others)
How so?
I don't mind it myself.
I am just too excited about practical application of AI as a tool, sorry about that. I got carried away.
AI topics typically branch into politics.
Ah
Oh, I didn't even think about it wow.
You make a good point.
When I think AI, I think "how can I script my day to day IT job to be faster" π
I'll not continue it then.
AI is fun and all, until it replaces people and that's where the convo usually goes and gets ugly.
All good. Just giving a tip of advise for honestly any Discord community.
Same can be said about Photoshop, at least about 10 years ago, I get what you mean π
It was scary back then.
Aside from all that, Good morning soldiers.
Good morning!
I'm making slow progress filling in documentation for the ZedScript VSCode extension.
I'm going back to making my perfect vehicle collection, where all cars are up to scale and have animated parts. It will take me longer to build than to play it, we are back to Skyrim modding.
Once I figure out how to properly make all windows reflective, it's another night to make that patch :D.
I'm considering writing a Discord bot that has commands to look up script data.
It's going to be for my community. I think that a friend still plans on finishing his bot for this feature however he's been very busy.
i figured haha, it was acting like it understood and saying stuff like "after doing these steps u should have a working mod" blah blah but it really spewed out the funniest shit ever
Hi, im having a problem when creating an horde with the createHorde2 command. All zombies are spawned on the floor and after a few seconds they dissapear. Why is this happening? its because there is a limit of zombies that can be on or something else? And there is any difference between createhorde2 and createhorde?
sendObjectChange(String change, Object... args)
Is this accessible from Kahlua, I keep getting implementation not found.
@fast galleon I'm seeing it in PipeWrench so it should be accessible..
/**
* Method Parameters:
* - (String arg0): void
* - (String arg0, Object... arg1): void
* - (String arg0, KahluaTable arg1): void
*/
sendObjectChange(arg0: string, arg1?: any | se.krka.kahlua.vm.KahluaTable): void;
This is the code btw
I've used the other two before but this one fails... I tried (string, obj) and (string,string,object), maybe it's me, maybe it's KahLua and vararg...
However it was already a stretch if this would work and I get the effect I want without it, so it's not a problem right now.
Maybe use tables?
But it would need to send an object? I tried to use something that is used in java.
-- Using a table.
isoObject:sendObjectChange('something', { foo = 'bar' });
foo = IsoObject ?
isoObject.sendObjectChange("something", new Object[] { "array-item" });
// Also works:
isoObject.sendObjectChange("something", "array-item", "also_something_else", 3);
I just threw a random object in there.
Just showing examples of how this method is invoked.
I'm no expert here. I think I had to use this method in my Twitch RCON patch.
I see you use . and not :, it was on my mind but that shouldn't work as expected?
The 2nd example is calling inside of a Java code block.
Using tables from a Kahlua context sounds like the most natural method signature to use.
Yeah, but would the game understand it?
It just loads the change with a bunch of ifs.
Sorry if this info isn't helpful.
no problem
I'm better at answering questions about modding the Java code in the game than Lua.
I am curious still if it was me or if it's Kahlua failing.
Maybe varargs is throwing it?
almost done
Is that a body for a bulky zombie?
no its a jumpsuit
Can someone point me in a direction of a proper method to remove some recipe that was vanilla or added by a mod please?
Not at my computer to point you in a more accurate direction, so instead I'll say "probably something in ScriptManager"
yeeeeter
#mod_development message
it took them this long to do
I feel like I've been basically stockholm syndrome'd into manually going and changing the gradle file every time I create a project
as someone who has merely experimented with bones, why are those perpendicular?
idk it was like that when i imported the FBX
well, what happens when you rotate/translate them, do parts move as you would expect?
I really see a strong need to improve the scripting package of the Java codebase for PZ.
Hopefully certain errors and oddly-specific / case-sensitive property names / values are fixed for 42.
Any idea about how to spawn a crate from a mod?I cant find the command neither the crateId, the wiki only shows the itemsId but crates i think are some type of building. Im a bit lost, if someone can help me a bit with this π
I've already done it in a similar way, seems to work
function clearWorkshopScripts()
local recipes = getScriptManager():getAllRecipes()
for i=0,recipes:size()-1 do
local recipe = recipes:get(i)
if recipe:getName() == "Disassamble Metal Armor" or
recipe:getName() == "Disassamble Gun" or
recipe:getName() == "Disassemble Gun Magazine" or
recipe:getName() == "Disassemble Motor" then
recipe:setIsHidden(true)
end
end
end
clearWorkshopScripts()
The only challenge now is that I cannot use the same recipe names, because I run this LUA in "server" folder, so it clears OLD and my NEW recipes as well :D.
Is it possible to mark old scripts with that name as hidden, but not hide mine scripts that I made with the same name? I assume there's a clever trick, but I am being stupid
I'm the kind of guy who writes dictionary logic with tables storing those values.
Keeps the looped logic nice and squeaky clean.
Although if it's less than 5 and not expected to grow your approach is clean.
=)
Could I somehow load my recipes AFTER this LUA code has run? Or is it pretty much impossible?
The idea is that I basically just want to fully replace the recipe and/or item, but keep the rest of references to it as is
..
..
One more weird thing I wanted to ask about: whenever you enable some mod with dependencies in Mod Manager, it loads the "dependent" mod first and "dependency" second.
I always thought that at first we load main mod, and then the one that depends on it.
Is it a problem with mod manager, or with my understanding how loading mods works?
Also I am curious...
local item = ScriptManager.instance:getItem("Base.Whatever")
if item then
item:DoParam("Weight = 5")
end
Could I use this instead to fully overwrite something in recipe, or in a similar way? If I want to change ingredients for example
I thought mods were loaded alphabetically. Is different for dependencies?
what's the point of the "load order" then?
It's also curious that in the console log I see this order
Even though I put my mod scrapCEC_overrideWorkshop.lua below, somehow it loads in the middle of The Workshop mod's lua
load order doesnt matter except for file overwrites
all it does is collect all files into a list which are then executed alphabetically
huh , and here I was, spending hours juggling mods in a "perfect" order lol
if I wanted to make sure that my LUA runs after another mod's LUA, is the only way to put Z in front of file or something?
require "filename"
I would like to translate the Options of a mod, but the creator has inserted them in a LUA file. In the IG_UI file there are only tooltips, how can I export the options to the file?
Example of file options:
names = {
box0 = "[RESERVED]",
dropdown17 = "Debugging Message Level - DEBUGGING",
},
thank you, Browser8
is the variable local and if so is it exported
if he doesn't use getText then you can only change them by editing that table.
@drifting stump I am having trouble with replacing recipe only.
If I mark a recipe with a name as Hidden, it marks my recipes with the same name as hidden
If I made a different name for a recipe, old magazines do not work
Am I being stupid and missing a very simple solution?
working with multiple recipes with the same name?
The premise:
I want to take an existing recipe from a mod and fully change its ingredients
If I use ScriptManager and get all recipes with the old recipe name and mark them as Hidden, it grabs my recipes too
That's the issue
Like this
its not a good practice to have recipes with the same for exactly this reason
makes it a pain to work with
If I make recipes with a new name, suddenly magazines and other references to the recipes break.
So I have to overwrite all mags, their distributions, and mods that patch them as well
Do I see an issue where there's a simple solution?
What is getText?
not sure i understand the problem youre having
I want to override ingredients of recipes in a mod.
If I make new recipes with the same name, game doubles them (shows old and new)
If I use LUA to mark all recipes with the same name as hidden, it marks new recipes as well
Did I explain it better? π
yeah again you shouldnt make recipes with the same name for this reason
But if I make recipes with a different name, it also breaks magazines
what does it break exactly
should I remake everything else if I want to modify recipe only?
the magazines reference old recipe names
not mine
the ones that I made hidden
so reading a magazine, I cannot learn my new recipes
does it make sense?
all I want to do is overwrite one property in existing recipe, its ingredients
Someone of you have the contacts of Arsenal or Brita? Or even if someone could ask them if I can use the GunFighter_01Option file by changing the words for a translation? THANKS!
hmmm i see
can filter the recipes by looking for ones with something you dont want them to have
for example all the ones with an ingredient you dont want it to have
Worth considering whether it's possible to update the recipes using the script manager rather than overwriting them in your scripts. Once again not at home so I can't check on that
The main issue with scriptmanager and changing recipe is that I do not understand what method can be used to do that π
Reading through decompiled code & the javadoc helps with that
There doesn't seem to be a SET method for that
you cant override recipes in script because it supports multiple with the same name
I mean I could iterate through ALL recipes and change all with the same name
if only there was a set method for ingredients
what are you trying to change?
Seeing the decompiled code is handy because you could look at where the recipes are actually parsedβthat would show you how stuff is set and whether there's a setter somewhere
ingredients
got you then
they are not params
Presumably there's getRecipe or something similar on script manager which will return something you can manipulate
^
That's a simple function that returns a list of items when called from ingredients field
I made many like these
The problem is how to get ingredients array from recipe object
? doSource takes the string you normally use in the script and parses it
That's what I did here
function clearWorkshopScripts()
local recipes = getScriptManager():getAllRecipes()
for i=0,recipes:size()-1 do
local recipe = recipes:get(i)
if recipe:getName() == "Disassamble Metal Armor" or
recipe:getName() == "Disassamble Gun" or
recipe:getName() == "Disassemble Gun Magazine" or
recipe:getName() == "Disassemble Motor" then
recipe:setIsHidden(true)
end
end
end
clearWorkshopScripts()
But I don't know how to get the ingredients array from "recipe" without reflection
doesnt have to be a function
and if you want to look at the ingredients look at sources
well I can already get ingredients with some other methods, but I am not sure how to set them back π
Would it work with a similar approach? Can you change sources?
I am just unfamiliar with the concept yet
i literally just said
^
Ah, when you said "look" I thought it's the same as "get"
I am not getting how it matches to a possibility to set
Probably I am thinking wrong, my logic is flawed
doSource("BaseballBat,
Nails=5,
keep [Recipe.GetItemTypes.Hammer]")
Spent some of the morning extracting and pulling out all values for properties like BodyLocation and BloodClothing.
still working on the script parser?
The VSCode extension.
Currently on the Type = Clothing, category.
Cleaning up the Wiki at the same time as transcribing the documentation for the VSCode extension.
I haven't updated this in a couple weeks however there's a lot of updates in the GitHub repository.
Autofill and enum options dropdowns will make writing ZedScript incredibly simple.
It looks like Evelyn was having a similar issue in the past, so I am not the only one π
that icon is pretty nice
Thanks. I made it.
I can take a look at this sometime soonish. Thanks.
Any idea about how to spawn a crate?I cant find the command neither the crateId, the wiki only shows the itemsId but crates i think are some type of building. Im a bit lost, ill appreciate if someone can help me a bit with this π
place an object and give it an inventory container
Hello people good afternnon.
Question here..
Is there a function server-side based in order to check when a player is connecting?
I'm trying to do a listener for the event.Onconnect but is not working.
I have a function that has to run when a player is joining the server
thumpable if you want it to take damage from zombies
there isnt
The thing is that i want to spawn it after a event comes up automatically from the mod
Like some kind of loot drop event and a crate spawned in some coords
local newObject = IsoThumpable.new(cell, square, spriteName, IsNorth?, nil)
newObject:transmitCompleteItemToServer()
probably also want something like
newObject:createContainersFromSpriteProperties()
could also add the containers manually
Okey, thank you very much. The thing is that they will spawn randomly on certain coords, but only after a trigger. With that info i can work, i really appreciate it
Eureka.
I didn't realise I could simply put something I "get" into a local variable, and do whatever I want with it. I thought I needed a set method, and parameters are protected, lol
function clearWorkshopMagazines()
local items = getScriptManager():getAllItems()
for i=0,items:size()-1 do
local item = items:get(i)
if not item:getObsolete() and not item:isHidden() then
if item:getName() == "WorkshopMag5" then
local recipes = item:getTeachedRecipes()
recipes:clear()
recipes:add("Dismantle Armor")
end
end
end
end
Does the job of simply changing recipes of existing magazines to my new ones, getting rid of old ones
@drifting stump Thanks for all your attempts to help, my brain was finally set straight.
@drifting stump I'll need to think of templates that I can make available through my extension.
I'd like to have templates for certain kinds of items, vehicles, etc.
So people can take those templates and modify them, skipping the whole "From scratch" approach.
one thing to consider is whether to put all possible parameters or only relevant ones
If enumerative, all values. If float or integer values, basic.
