#mod_development
1 messages ยท Page 523 of 1
I don't get where to use
plugins {
id 'io.pzstorm.capsid' version '0.4.2'
}
Ok no mb, that work
But now I don't find createRunConfigurations
well you seem to have it easy as of now
You dont have to use intellij after than as it take quite a lot of ram
but if you do its very powerfull
For small project I prefer vs code
Yeah thats what im using too atm
i moved the decompiled code at the root of my vs project to search into it.
i also copied all pz lua code at the root. so i have some sort of lua autocomplete and parameter suggestion
That is already done ^^
I can't find setupWorkspace after running createRunConfigurations
Ok mb, I get it
Everything is in a build folder, right?
yeah
Ok, thx ! I get what I wanted
Is there a special way to format the description page for spawn locations? I am just using paragraphs but that makes the text go blank
math.floor((filth / 2)+0.5)
filth = bloodAmount + dirtAmount
so it should be like
11+12 = 23/2 = 11.5+.5 = 12
wait
thats wrong xD
12/100
1/10
1/1 water
ah so i have to divide by 20
right right
sorry, explaining it to myself helped
what data of the game are you working with? is it just the map.info file?
Yes
@harsh prairie if it just about making paragraphs and therefore making new lines in the description, my first try would be just adding a \n to the text or, if that doesn't work, you can try using <br>. have you tried those?
not sure if that solves the issue though...
I have not. Those are the kinds of things I have no idea about! I'll give them a try
@thin hornet <LINE> did the trick, thank you!
its confusing sometime its \n or <br> but yeah glad it worked
I did try the \n and <br> in the same way you said to use <LINE> and they did not work that way, but since line works I am just going to write that one down and use it.
i usually try everything until it works! XD i guess it might be related to the question whether your text is given in "..." or without quotation marks but not sure
i hope they fix the power outage soon or ima have to go loot a generator somewhere
power outage? what's that and what is wrong with it in vanilla?
irl i dont have electricity. in the middle of coding it went out
F
yeah Rip
XD XD i guessed you meant something with the power shut off in game! XD XD XD
xD
btw how many colors are the game textures?
I think I can make some textures
i think, but probably cant actually xD
Ah I think I see part of the problem with getting the code to work
it errors if I dont restart the game
quitting to menu doesnt work
Would it be possible to make the large fuel can from FuelAPI wearable as a backpack without breaking it's ability to carry fuel?
12+34 = 46 / 20 = 2.3
2.3 rounded off is 2
2 water
hurray
also fixed the 0/0 water
by doing an elseif math.floor((filth/20)+0.5) < 1
was wondering why it didnt work at first because i set it to <0 facepalm
then i digged in for the actual numbers and when i say 0.0000123***
got it
I think you can
since weapons arent containers but you can wear them on back
but idk the code for that sorry
I'll try the seemingly obvious route of just adding the attribute to equip it on the back and see what happens
Nope, only clothing type items, and container (as in backpack or bag type containers) type items, work for that purpose.
Gas cans are "drainables" and not containers.
Damn, that's a shame.
Would there be a way to convert the item between a container and a drainable while storing it's fuel state?
Or would it just be needlessly complicated
It's possible, but it would be complicated for a newbie modder?
Now, you can "attach" them like weapons, but, setting that up is not a simple matter.
or creating a new clothing item which just looks like the gas can equipped on back and then doing some tricky interface tweaks so that the player believes they are equpping the gas can on their back
like a dummy item
Yeah, that's doable, but, yeah, there's no way I could simply explain how to do it?
yes, exactly.
maybe if newbie to all code in general xD
like me :/
I have limited experience. The way items are defined seems pretty straight forward from looking at some, but I wouldn't know where to begin about how to store information between iterations of the item. Any mods that have something in this vein that you think would be worthwhile for me to dissect? I want to say Brita weapons used to have a flamethrower backpack, maybe that?
I dunno, TBH I just go for the low effort easy wins where I can just cut and paste code snippets of mine and such that can help someone out?
I'm not any good at teaching or explaining stuff, I just know how to cut and paste. ๐
isnt it possible to just add a tag something like isWearable or something
That's fair, I don't mind doing some research I'm just not particularly sure where to start.
or a cheaty way make it a clothes
AuthenticZ has a jerrycan that has the property of being worn on the back but it doesn't appear as an option in game so I think it's going to be a bit more complicated than that.
if you want to do it as clothing item, you'll need at first a suitable 3d model. for the coding stuff, you need to manipulate various vanilla lua functions which control the in-game interface (they are typically found somehwhere in media/lua/client). will definitely be a lot work.
No. I don't like saying things aren't possible in that people take it as a challenge, or that I'm trying to stifle creativity.
But I'm saying this to save people's time, in that it is currently impossible. Clothing, Containers (as in backpacks/bags), and AlarmClockClothing are the only categories of items that can be worn like clothing. Only those two types of items. No radios. No drainables. No food. No weapons. Just clothing and containers. That's it. It's hardcoded in the Java AFAIK. It's something I've repeatedly tried myself. It don't work.
Any type of item would probably work for attaching like weapons. But you would have to attach them to a clothing item that has a hotbar slot.
Then how do you wear it?
You can't. It doesn't work.
Any type of item would probably work for attaching like weapons. But you would have to attach them to a clothing item that has a hotbar slot.
Jerrycans mod doesnt work?
It still functions as a regular gas can, but you can't wear it on the back
As Blair said, it's defined as a drainable not a container or clothing item
i guess you also have to tell the game how to position such and item correctly when attached. even if the game would come with some default way to attach arbitrary items, it will probably look quite glitchy depending on the actual 3d design of the item in question.
I'm trying to think of a mod that has an example of something that changes states and returns to it's original condition to look for an example of how to store that information. Maybe a firearm mod that lets you fold/unfold a stock since it keeps it's condition between iterations despite being a different item.
I'm not really worried about the model, it's a moot point if I can't even get that far.
Eris Nightvision Mod makes the nightvision goggles have a battery life property, proabably your best bet to look at.
I'll take a look at that, thank you. ๐
yeah that sounds like dummyitem to me
I have a dumb and stupid idea i dont recommend
like adding a dummy backpack that looks like gascan
that spawns when you click a contextmenu that you can label as "wear"
and puts the gascan inside
but thats stewpid xD
would also my first way to go. don't think it's soooo dumb. ๐
because i can think of some issues
like how to limit what specific items get inside
or if you can hide the tab in inventory
I mean i just imagine using a mod like that. it would be funny
Is there a limit to the number of colors you can use in the game?
for making textures?
either its very limited or, we arent that good at making them
i think a natural limit is the color table used for colorable clothing items during character creation. not sure if you can add more
to give clothing items the option of different colors, you just have to set a single option in their xml file as true and make their texture white. the rest should then work automatically
i assume they arent completely white but maybe 10-20% grey
but i mean the item icons
btw.
because i saw some heels in general chat
ya... at least a very light color. but you should introduce some "shadows" or "contours" to their texture to make them look decent.
Is there somewhere I can see a list of all vanilla item definitions?
have a look at media/scripts
Probably should have thought of that, thanks.
Is there a sample to add a display to an existing inventory Tooltip (Mouseover on each item)?
I've found InventoryItem:setTooltip(String), but I think this may interfere with other mods. I'm looking for samples with other methods. I would also like to specify a different color for the label and value if possible. (Label: yellow, value: white)
Best regards ๐
i think i sent it
here
idk if this has it
but contains everything in game
Thanks. ๐
if i add a mod do i need to start a new save
an existing? what about getTooltip instead of set
if its a mod that adds items, recommended to get a new save, else loot wont spawn
unless you are willing to go to unloaded chunks
what if i have it so loot spawns again after a long time
Events.OnBeforeFirstInventoryTooltipDisplay ?
@next glacier
Thanks for reply.
InventoryItem#setTooltip(String) is just add only label, and the display was one color like attached image.
If possible, I would like to display the label in yellow and the value in white, just like the existing Tooltip.
Also, I have overridden the ISToolTipInv.render function, but if other mods override the same function, it should conflict.
So I'm looking for other method to add tooltip line.
MYMOD.original_render = ISToolTipInv.render
function ISToolTipInv:render()
if not CONDITION then
MYMOD.original_render(self);
end
self.item:setTooltip("label: value");
end
if you only want to have your new tooltips for certain items, then the CONDITION in "if not CONDITION then" should express this. So, you can use something like "if not a certain item then original_render else my code". (in case your condition does not already include this...)
this will minimize conflicts with other mods. otherwise, if you change the tooltips of vanilla items and there is another mod changing the tooltips of the same items, there is no way to avoid conflicts.
Take a look at the mod: "Effons Have I foud this book"
Yes, I already check that mod. but I cannot hook that event. Something wrong?
MYMOD.myfunc = function (item, self)
getSpecificPlayer(0):Say("[DEBUG] called")
end
Events.OnBeforeFirstInventoryTooltipDisplay.Add(MYMOD.myfunc)
Exception thrown java.lang.RuntimeException: attempted index: Add of non-table: null at KahluaThread.tableget line:1689..
it seem to be a custom event not from the base game
ACtually I think it's a custom event from the mod
So im using the key racks and key cabinets mod and it doesnt seem to work at all and no one else on my server is having the issue?
I want to add just one line to existing tooltip.
Its doable but quite a little challenge
take a look at this code here that might give you some idea how its done in my api. Unfortunatly it's not yet released.
https://github.com/Konijima/PZ-Community-API/blob/dev/Contents/mods/CommunityAPI/media/lua/client/ItemTooltipAPI/Overrides/ISToolTipInv.lua
I also looked into it and found it difficult. I thought that maybe the eris_food_expire mod might be helpful. and thanks for your information, I'll check it ๐
around line 200
My api remake the whole java class into lua.
Its to create dynamic custom tooltip the same way vanilla are made
in that case... question is, where does the vanilla tooltip takes the text from. instead of manipulating the tooltip method, it might be easier to find the variable containg the text for it and append. for example, if the text is stored in the variable desc, you can try sth like desc = desc.."my new text". this will simply append your new text to the existing tooltip...
item:doTooltip() create the content of the tooltip
its not easy to do cause its java sided
Exactly, It may depend on the order in which the mods are called, but I think it's worth a try. Thanks!
Yes, you're right, I realized that fact when I was looking into how Tooltip aligns the values. damn :<
yeah doTooltip does a lot of stuff internally
I have a question...I have created a small script that auto-equip on the character the clothes and that auto-place the items belonging to the character automatically in the backpack but the game seems to add by default a belt even if you spawn with the character fully naked ( So doubling the belt I've already put in the inventory via the script ) any way to get rid of the default belt?
it create the layout
you could find the belt in the main inventory and remove it
yep but I would like to find a way, if feasible, to let it not spawn at all
even if you don't put it anywhere it spawns by defaul it seems
there must be a script adding the belt and the keyring
find that and youll be able to see what is doable
if overwrittable etc
I'm using it but it seems to spawn independently from the script...maybe is hardcoded by default...
C:\Program Files (x86)\Steam\steamapps\common\ProjectZomboid\media\lua\client\Items\SpawnItems.lua
ahhh...didn't thought about it...checking...thanks mate! ๐
KeyRings are spawned in the player's inventory in the Java however.
I've already removed the keyring from spawing but it's the belt that instead continues to spawn...
Doesn't seems to work at least speaking of removing the default belt ( Your script correctly adds it ). I've tried also using
-- delete the player's starting inventory and clothing
pl:clearWornItems();
pl:getInventory():clear();
but it spawns the same
Pls๐ฅบ
( Thanks somehow for the help mate, much appreciated )
when do you actually try to remove it? in what event
when did you call the function which removes the stuff? via event OnNewGame?
haha, had exactly the same thing in mind!
yeah isnt it strike two?
anyway, manipulating start clothes and inventory works fine for me using the event OnNewGame
local function onTick()
Events.OnTick.Remove(onTick);
-- check if survived zero day
-- check if player:getModData().myModPlayerStarted is not set
-- remove stuff
-- set modData().myModPlayerStarted = true;
--
end
Events.OnTick.Add(onTick);
just an idea
Let's say that the character spawns with a certain number of clothes + the belt ( and the scripts let them auto equip ) then depending on character and profession ( I'm working on a professions mod ) loads also certain items in the character backpack. Everything works fine with no errors but one belt seems to be added by the game by default whatever you write in the script. Do a simple test...Spawn on Apocalypse fully nakes somehow the character will have a belt equipped...
Checking the script mate,thanks ๐
happens also if you remove the belt via event OnNewGame?
Got to try...
are there any mods that make the player and zombies more detailed
Checked my script run on Events.OnCreatePlayer...
but the basic trick will in any case be as Konijima suggested: you just need to find an event or a vanilla function which is called after the vanilla game adds the belt. there are probably a lot of options for that. if OnNewGame doesn't work, use the ticks as Konijima or OnPlayerUpdate or any vanilla function which is called immediately after the game starts
with the OnTick it would work in MP so thats a good way. Well actually OnTick is good for stuff that require networking to be ready. Since its not ready with OnGameStart
bazz89/Konijima can I send you the script via pm so you can give a check ( I'm not a super expert of scripts )
You could just comment out the lines that spawn and apply the belt in SpawnItems.lua if nothing else.
is it too long for just posting it here? then everyone could have a look and there are a lot of people here who have good ideas.
You can just upload the lua file as an attachment to a post, like I did at #mod_development message
I am ashamed to do so my script for you experts will be laughable... ๐
Should I use More traits or dynamic traits?
OK this one is in the folder " Client"
This one ( works for the pilot part of the one above ) instead is in " Shared " Folder ( EDIT: Scripts removed )
Ignore the part about prison spawns and comments to it I'm still modifying it it's just a draft ( Permission to use it requested to the author, be clear )
Note that some items are not vanilla and have dependencies on mods
I've used to scripts otherwise all professions use the same items set in the backpack ( Section at the bottom RMMM_MilitarySpawn.GiveScrewdriver = function(keyName) etc,etc,etc
The one in Shared is what you get in the pilot backpack, the client one for the other ones
My main issues were:
1-I'm not able to assign different backpack loadouts in one single script ( so to have diversity amongst characters ) because I dunno how to do it
2- The belt thing ( but it's just a minor issue )
When you'll stop laughing looking at my scripts mess say me something LOOOL ๐
Am I been able to create the void? LOOL ๐ ( Anyone still around?)
ok np mate just joking ๐
just looking for the command to remove stuff from the inventory.
but using Konijima's idea with the OnTick event, i can unequip the belt when game starts
Basically everything works fine ( at least here ) but that damned additional belt continues to spawn in the inventory when you spawn the character ( Nothing major if not possible to be solved I'll live with it )
Don't get crazy about mate, if your solution of adding the Konijma suggestion works, please send me the file corrected ( and where to place them ) and it will be more than eough ๐
it
local item = INSTANCE_OF_YOUR_ITEM
player:getInventory():Remove(item)
--or that's not suitable maybe try
local item = player:getInventory():getFirstTypeRecurse("YOUR_ITEM_SCRIPT_TYPE")
player:getInventory():Remove(item)
You have been already more than kind in listen to me and trying to help
where I have to place it?
Really anywhere that's gonna go off after the belt spawning? Like I said, you can also just comment out the lines in SpawnItems.lua that spawn the belt and that just eliminates all the business with despawning the Belt.
( If you can write me the part already modified should be great so to avoid mistakes )
here is Konijima's idea with the OnTick event. unequips all clothing on start including the belt. i just didn't found the code for removing inventory stuff yet.
Ok so I need only to copy it anywhere in the script? ( No idea what instace of your itemm and your items script type means LOOL )
ok I'll wait. ( and thanks mate you're a legend! ๐ )
Sorry for the question that has nothing to do with modding.
What kind of text formatting should I use to display images in the description of a Steam mod?
..but please modify directly the files I've initially posted above so I will not make errors, thanks
so that I have only to copy/paste ( Otherwise sure that I'll do something wrong ๐ )
(Not to say that when I'll release the mod, thanks to you will be provided in the mod description ) ๐
@hidden compass If you go to your profile and you update the description for ie you'll get a window of help with the formatting that works on Steam IIRC
ahhh... project zomboid wiki!!!! script type of "belt" seems to be "Base.Belt2" instead of "Base.Belt"???
yep it's Base.Belt2
The other is outdated I think
Should be located in C:\Program Files (x86)\Steam\steamapps\common\ProjectZomboid\media\scripts IIRC ( The belt2 I mean )
Thanks, I checked this site but I can not find tag related show images. ๐ฆ
https://steamcommunity.com/comment/WorkshopItem/formattinghelp
@hidden compass Check here https://steamcommunity.com/comment/Recommendation/formattinghelp
I checked, but there is no iamge tag ? ๐ฆ
should be something like [img] [/img]
BBcode basicallly
here it is mate https://steamcommunity.com/sharedfiles/filedetails/?id=286731518
The img tag was expanded into an HTML tag, but the image was not displayed. Since the referrer is my own domain, it may be NG per crossorigin. Thanks!
finally, this did it for me. really strange that you cannot use OnNewGame for removing the belt. used Konijima's OnTick idea
Great man!
@lusty nebula you can probably just add this function to your lua and it might work...
I was getting crazy with that belt ๐
at the end is ok or better at the beginning?
so... this completely removes the belt from the inventory
even the equipped one?
ahh... and rename the function "RemoveBelt" everywhere, for example to RMM_MilitarySpawn.RemoveBelt or so
yes, it has completely gone for me
Mate I don't know how to thanks you, really, many many many thanks for your help and time!
should make no difference. however, i always put the Event.OnTick command at the end of the file but should not matter.
just took all the ideas from other people here and put them together. ๐
and play-test yourself to see whether everything works with your code
to rename the function what I have to rename?
just rename every occurence of "RemoveBelt" to "RMM_MilitarySpawn.RemoveBelt" or so
strictly speaking not necessary but better to minimize chance of double naming with other mods
Ok perfect I owe you a box of beer and if you'll pass from Italy you'll surely get it.Thanks mate!
๐
will do mate but for now many many thanks!
Is there a way to tell an item it cannot stack in the inventory ?
Made a quick guide to store data on the pc:
https://github.com/MrBounty/PZ-Mod---Doc/blob/main/Save data.md
Note:I'm now removing the scripts I've posted at the begining just in case some genius will arriive around
(put a lot of time in them with my limited skills )
Again thanks mate see you around in the Apocalypse! Salute! ๐
ok ๐
oh... maybe it is safer if put a condition "if item then ... end" around the getPlayer():getInventory():Remove(item) command...
sorry I'm a day late here, had to do stuff last night. So, I'm back, and doing tests right now
will do ( You are already starting to speak aramaic for me LOOOL ๐ )
Have a good evening Sir, bye! ๐
what do you mean by "not stack" ?
That each item has its own "row"
CanStack
@small topaz Just a very quick jump...Works like a charm ๐ You're super!
glad to hear but thank @thin hornet and @willow estuary . they had the idea with the ontick event and the correct code for removing items
Thanks you all guys!!!!!! You're great gents!!! ๐
Doesn't seems to work in my case. Is it limited to a certain Type ?
yep:
item Visa { DisplayCategory = AliceInZomboidland, Weight = 0, Type = Normal, DisplayName = Visa, Icon = CreditCard, CanStack = FALSE, }
you used this in the item script right
are you trying with the same items
because theyve already been created so they kept their properties
no shouldnt need
this is how I spawn it
`function InventoryUtils.GiveVisaToPlayer(player, duration)
local inventory = player:getInventory()
---@type AliasItem
local item = inventory:AddItem(sharedConstants.VisaFullName)
item:getModData().visa_duration = duration
return item
end
`
Btw, how do you format code ? I use the backtick character but doesn't look good compare to some posts
not sure what to tell you i got it from the item script properties dump i did and checked if vanilla items use it and yes some did
also when I print item:
local item = inventory:AddItem(sharedConstants.VisaFullName)
it returns ComboItem type.
Is that normal ? shouldn't it be InventoryItem ?
Like that ? CanStackโ(inventoryItem)
And a comboItem is an inventoryItem
so, after some thought, I feel reloading the outfit is the wrong approach. Although the following does nothing, for some reason:
local GetZedList = getWorld():getCell():getZombieList();
if(GetZedList ~= nil) then
for i=0, GetZedList:size()-1 do
local GetZed = GetZedList:get(i);
if((GetZedOutfitName == "AmbulanceDriver")) then
GetZed:clearWornItems();
end
end
end
Sorry for the multiple edits
Hello! Is it possible to unite skillbook effect for two skills? Trying to make an skill book like 2-in-1, so...
I'm not sure that SkillTrained variable can handle two values.
I'm not sure that XPSystem supporting this too...
I also found these perks:
PerkFactory.Perks Firearm
PerkFactory.Perks Aiming
PerkFactory.Perks Reloading
What exactly Firearm perk mean and do?)
Is lua hard to learn. I have some coding experience
As a guy who have some coding experience, i would say that lua is specific as any other language. But nothing special at all.
Main problem for me is lack of documentation and simple examples. You will have to dig through vanilla or mods code (which not always easy to read) to get some knowledge, or constantly ask here for help.
Hey! I'm very new to coding on zomboid and know some lua. Do you know how to set a specific skill to change its multiplier from other skills?
then wait for people to answer?
^
could someone help me turn the tarot cards mod into a standard deck of cards mod with 3d models please?
i already changed the lua script, but i don't know how to add the model for the individual cards. i'm hoping to have two: one with a black pattern and one with a light-grey pattern. i'm already working on the model itself in blender, but beyond that, i can't texture, and i have no idea how to add the models into the mod. i also wanted to make the fully-collected deck use the deck of cards mesh, but obviously with the texture changed to match the new cards)
the tarot cards also only spawn in bookshops, but i'd like it to spawn in every container and location types as well
oh i think the mod's by @abstract raptor (would i be wrong?)
Yeah, its her's iirc.
Hi
does anyone know how to modify the attackspeed of a game character? Is it linked to the xml files?
is it possible to implement custom hotkeys
I'm not sure but it does seem to be limited to the xml files
The animation manager has a method for setting the animation speed, but I haven't been able to make it work :( I think it's not exposed to Lua. Maybe one can use reflection to call it? I'm not sure.
If you found a way lmk!
For the fellow new modders like me, if you want to give the player a backpack/container with items you can use the code from the Builder mode new game
local bag = playerObj:getInventory():FindAndReturn("Base.Bag_Schoolbag");
if not bag then
bag = playerObj:getInventory():AddItem("Base.Bag_Schoolbag");
playerObj:getInventory():AddItem("Base.WaterBottleFull");
bag:getItemContainer():AddItem("Base.BaseballBat");
bag:getItemContainer():AddItem("Base.Hammer");
playerObj:getInventory():AddItem("Base.Crisps");
playerObj:setClothingItem_Back(bag);
end
bag:getItemContainer():AddItem("Base.Saw");
playerObj:getInventory():AddItem("Base.Crisps2");
playerObj:getInventory():AddItem("Base.Crisps3");
Been trying to figure out what sort of bug might be causing the can opener to not work properly with my mod, can't open cans (which upon searching through this server means it's most likely a mod bug - as others have had this issue, though didn't see any answers for it other than that). Would anybody here happen to know if there might be anything that could be breaking it? The mod mainly just adds new foods, some plushies, and a hat with the most advanced part being the recipe lua file
If you haven't already, test your mod w/o any other mods enabled to confirm that it's another mod and not an error with your mod.
Then test your mods with one other mod, or a few other mods enabled until you find the mod responsible.
A mod overriding the can opener in a way that it is missing the proper tag would not be used in those recipes
It's usually some "Better so-and-so-items" mod that borks can openers.
..ironically enough.
Oh yeah it's certainly from my mod, as I don't have any others enabled and vanilla works just fine
Okay, sorry, combination of misreading your post + this can opener being broken by mods thing is something I've seen a million times now ๐
Haha no worries, just trying to figure out if maybe I accidentally overwrote the can opener script but I'm not seeing anything out of the ordinary
How can I programmatically add upgrades and a magazine to a spawned gun using getItemContainer():AddItem("Base.HuntingRifle"); ?
(And upgrades too)
Would do you happen to mean? Like the CannedFood= tag?
Nah, it was very common practice for people to overwrite entire item scripts with their mods that would increase item durability or change some item weights and the like?
Like, literally having a file called items.txt that was a copy of the vanilla items.txt with a few changes in it.
Which means that when there was a change with PZ build updates to the vanilla files, such as when the item tag system was added, all the "better item" mods that overwrote vanilla item files weren't compatible with how PZ was changed to use item tags,
In the context of PZ item tags are the Tags = CanOpener, part, the PZ code uses that to know that TinOpener items can open cans.
item TinOpener
{
DisplayCategory = Cooking,
Weight = 0.6,
Type = Normal,
DisplayName = Can Opener,
Icon = CanOpener,
MetalValue = 3,
StaticModel = CanOpener,
Tags = CanOpener,
WorldStaticModel = CanOpenerGround,
}
I think that business, with overwriting entire vanilla files for a few modifications, might have been partially to blame to people using itemzed w/o knowing how to use it properly, before it was broken by b41 updates.
CannedFood = TRUE, is an item parameter and not an item tag FYI. Technical distinction.
Ah I see, thanks for the clarification.
Hmm, well I can't say I've copied the whole item scripts thing, now I'm really dumb and beginner at Zomboid modding so I'm sure there's some mistake somewhere though I've named my file PompsItems-food_items alongside the other text files having PompsItems before them. Perhaps the best way to do this would be to drag out each text file to find out which one would be causing it and then further take that one apart
Aha! It's coming from my recipe lua thing, silly me forgot the module base part
Ah I found how to do it ๐ 
Very rad, all the best with yer' mod
So, this is the code
In order, add the gun, the attachments, add the attachments to the gun, add the magazines, fill the magazines, make a magazine appear in the gun
local rifle = player:getInventory():AddItem("Base.AssaultRifle2"); -- It's the M14
local scope = player:getInventory():AddItem("Base.x2Scope");
local recoil_pad = player:getInventory():AddItem("Base.RecoilPad");
local laser = player:getInventory():AddItem("Base.Laser");
rifle:attachWeaponPart(scope)
rifle:attachWeaponPart(recoil_pad)
rifle:attachWeaponPart(laser)
local magazines = {
player:getInventory():AddItem("Base.M14Clip"),
player:getInventory():AddItem("Base.M14Clip"),
player:getInventory():AddItem("Base.M14Clip"),
}
for _, magazine in pairs(magazines) do
-- Fill all the magazines
magazine:setCurrentAmmoCount(magazine:getMaxAmmo())
end
-- Use the first magazine of the 3 as a reference for the max ammo
rifle:setCurrentAmmoCount(magazines[1]:getCurrentAmmoCount())
-- Magically make a clip appear in the gun
rifle:setContainsClip(true)
I just don't understand why laser and stuff is still in my backpack tho
Isn't it supposed to disappear from the backpack?
local part = InventoryItemFactory.CreateItem("Base.x8Scope")
rifle:attachWeaponPart(part)
Yeah I did it, and the part is in the gun (like the screenshot says)
Apparently it's not automatically removed after attachweaponpart is called
I just noticed it in here
function ISUpgradeWeapon:perform()
self.weapon:setJobDelta(0.0);
self.part:setJobDelta(0.0);
self.weapon:attachWeaponPart(self.part)
self.character:getInventory():Remove(self.part);
self.character:setSecondaryHandItem(nil);
-- needed to remove from queue / start next.
ISBaseTimedAction.perform(self);
end
local laser = player:getInventory():AddItem("Base.Laser") =/= local laser = InventoryItemFactory.CreateItem("Base.Laser")
๐
So, If I understan correctly InventoryItemFactory.CreateItem creates the item in memory but does not put it anywhere, right?
AFAIK yep.
Okay thank you so much
Alright, spawn gun, magazines and attachments directly on the gun v2
local rifle = player:getInventory():AddItem("Base.AssaultRifle2"); -- It's the M14
local scope = InventoryItemFactory.CreateItem("Base.x2Scope");
local recoil_pad = InventoryItemFactory.CreateItem("Base.RecoilPad");
local laser = InventoryItemFactory.CreateItem("Base.Laser");
rifle:attachWeaponPart(scope)
rifle:attachWeaponPart(recoil_pad)
rifle:attachWeaponPart(laser)
player:getInventory():Remove(self.part);
local magazines = {
player:getInventory():AddItem("Base.M14Clip"),
player:getInventory():AddItem("Base.M14Clip"),
player:getInventory():AddItem("Base.M14Clip"),
}
for _, magazine in pairs(magazines) do
-- Fill all the magazines
magazine:setCurrentAmmoCount(magazine:getMaxAmmo())
end
-- Use the first magazine of the 3 as a reference for the max ammo
rifle:setCurrentAmmoCount(magazines[1]:getCurrentAmmoCount())
-- Magically make a clip appear in the gun
rifle:setContainsClip(true)
welp. I suck with lua... Still having issues getting my zed outfit changes to save on the server, and I believe I found the cause (just don't know how to fix it) "sendObjectChange can only be called on the server"
Maybe you need to have that call be in a server Lua file?
I tried that?
Anyone know a cheat menu for my private server
I just looked at the decompiled source. The only reason it should error out like that is if it's called in the client
Maybe you're somehow triggering it client side still?
odd. Basically: I'm using a local server hosted from the steam menu for testing. Here's my code?
--Get Zombies
local GetZedList = getWorld():getCell():getZombieList();
if(GetZedList ~= nil) then
for i=0, GetZedList:size()-1 do
--Get Zombie
GetZed = GetZedList:get(i);
if((GetZedOutfitName == "AmbulanceDriver")) then
GetZed:dressInPersistentOutfit("EMSMeade");
GetZed:reloadOutfit();
GetZed:sendObjectChange('GetZedOutfit');
Pardon the mess, not proficient with Discord's lua thing
Maybe you can check if you're client side and run it only if it's in the server? I forgot how but you can check through Lua if you're running in client or server
Actually I believe it's just a global isServer() you can call iirc
kind of a tooling question but does anyone think its possible to run two servers on the same .db's?
or at least how to tell the game which database to use?
I downloaded cheat menu rebirth whats the bind to open the menu
I think a big problem potentially of that is conflicts between the two servers, specially if both try to write at the same time? Not sure though. Hope someone can help you but it's probably a super rare usecase.
Maybe there are other ways to go about it, is there a specific reason why you're building it that way? is this going to be necropolis ch 3 ๐ฎ
afaik mysql has database mirroring for full recovery databases
but we use,, sqlite

i figure this would alleviate our impending 32 slot restriction if i can do a backend solution
where i have the population for 2 servers but not the database infrastructure :(
i guess the better question is, is there any way to use a cloud database instead of the local cachedir /db/ .db junk
function CarCraftingMH_OnCreate(items, result, player)
addVehicle("SmallCar02")
local vehicle = player:getVehicle()
if not vehicle then
vehicle = player:getUseableVehicle()
end
if not vehicle then
vehicle = player:getNearVehicle()
end
sendClientCommand(player, "vehicle", "getKey", { vehicle = vehicle:getId() })
end
anyone got any ideas why this code would work on singleplayer and not multiplayer? Does addVehicle just not work in MP?
So, if someone needs it, you can attach the weapon to the back using
-- Attach rifle to the back of the player
player:setAttachedItem("Big Weapon On Back", rifle);
First thing that comes to mind is that the client doesn't have admin.
Also I don't see any checks there to ensure that the player is outside + on z-level-0 since cars won't spawn in either of those circumstances.
FYI you probably could also accidentally (or intentionally) create a "carnado" spawning in a bus in the wrong circumstances.
i'm still unsure what you're trying to do, but you might be able to use something like litestream which allows you to replicate sqllite servers. I've been using it for production for some time now and it's pretty nifty.
Again not sure if it would solve what you're trying to do but that should at least provide sqlite replication
Ya I am aware of the carnado possibility. With regards to the admin aspect I don't think there is really a way around that from a working perspective. If I block it then it just doesnt work
is there a way to integrate a solution like this with pz?
like a symlink-esque way to replicate two servers sqlite files
Is there any way to add distributions for special car with special texture spawned? Currently i'm stuck after AND operator... Don't know how to check spawned car's texture
if getActivatedMods():contains("MOD_ID") and ?????? then
table.insert(VehicleDistributions.TYPE["CONTAINER"].items, "ITEM"); ... etc. etc.
end
I think it should work - replicate through litestream the two databases pointing to one master (or make the other one a slave). I'm not quite sure though. You can try contacting their support and ask they're quite responsive!
my ultimate concern is that ive tried to write to the players.db during a live game and it just,, didn't update and i scream
i am a child
ignore me this is far too complex of a tooling thing and the more i talk about it the more i can see the slack logo
Anyone know the name of the aiming mod that goes with britas weapons for a multi-player server

Do you know if there is a way to spawn Decoration in Debug ?
I need some help, my newly spawned survivor has a holster, and I'm trying to make it have the pistol in the holster, but for some reason it's not happening, does anyone have suggestions? I'm using Profession framework
OnNewGame = function (player, square, profession)
local fak = player:getInventory():AddItem("Base.Bag_Schoolbag");
fak:getItemContainer():AddItem("Base.AlcoholBandage");
fak:getItemContainer():AddItem("Base.AlcoholBandage");
fak:getItemContainer():AddItem("Base.AlcoholBandage");
fak:getItemContainer():AddItem("Base.AlcoholBandage");
fak:getItemContainer():AddItem("Base.AlcoholBandage");
fak:getItemContainer():AddItem("Base.Tweezers");
fak:getItemContainer():AddItem("Base.SutureNeedle");
local weapon = player:getInventory():AddItem("Base.Pistol"); -- It's the M9
local scope = InventoryItemFactory.CreateItem("Base.IronSight");
local laser = InventoryItemFactory.CreateItem("Base.Laser");
weapon:attachWeaponPart(scope)
weapon:attachWeaponPart(laser)
local magazines = {
player:getInventory():AddItem("Base.9mmClip"),
player:getInventory():AddItem("Base.9mmClip"),
player:getInventory():AddItem("Base.9mmClip"),
}
for _, magazine in pairs(magazines) do
magazine:setCurrentAmmoCount(magazine:getMaxAmmo())
end
weapon:setCurrentAmmoCount(magazines[1]:getCurrentAmmoCount())
weapon:setContainsClip(true)
player:getInventory():AddItem("Base.Bullets9mmBox");
-- Attach pistol in the holster
player:setAttachedItem("Holster Right", weapon);
end
I did not cause I assumed it always has spaces since for the rifle on the back I had to use "Big Weapon On Back"
Yeah does not work even with HolsterRight
This might work.
addVehicleDebug("SmallCar02", nil, nil, square)
First nil is for the direction the vehicle is pointed, should be random if nil.
Second nil is for the vehicle skin index, should be random if nil.
Which value should I use for second nil if I address first skin? 0 or 1?
Anyone know the name of the aiming mod that goes with britas weapons for a multi-player server
Don't know offhand; you'd have to test it to confirm.
From VehicleDistributions.lua
-- Specific cars like police, fire, ranger... We simply add their skin index to the loot table's name if they have one.
VanSpecial0 = { Normal = VehicleDistributions.Fossoil; },
VanSpecial2 = { Normal = VehicleDistributions.Postal; },
Thanks Blair I will try that though I am going MIA for 2 weeks so I'll disable it for 2 weeks and test when I'm back. If someone else tests it and it work for other clients to be able to see the car spawned by a client let me know!!!
i made it fucking woooooooorking, It has to be forced in the slot
-- Attach pistol in the holster
player:setAttachedItem("Holster Right", weapon);
-- Force the weapon to be in the holster slot
weapon:setAttachedSlot(2);
Still canโt figure out how to address right skin to spawn items only in acceptable vehicles with correct skinโฆ
Modโs distribution table just adds one normal and unite trunks in one classโฆ there is no special normal for the skin.
Proper skins are 2nd and 10th VEHICLE.txtโฆ
Or am I able to add new normals (guessing yes), but how can I address proper skin?
you restarting your game everytime you make changes?
I made the mistake just quitting to main menu and back
when i restarted the game, there were no errors
btw
what kind of 3d models are used by the game
its looks like its all text
time = numPages * o.minutesPerPage / f
what is f
oh wait nvm
local f = 1 / getGameTime():getMinutesPerDay() / 2
any good examples so i can learn mod options integration?
ahh i see
looks easy nuff
I have returned, being the complete numbskull I am with scripting as I have very little know how on it, I notice my recipe lua file conflicts with the base game one, adding a module base to the top seems to just prevent the oncreate recipes from working, while getting rid of it prevents default recipes such as opening cans.
As a reference to some of the recipes: box of frozen mozzarella sticks can be opened to give you both the sticks and the empty packaging (litter, essentially).
If anybody has any ideas to resolve this, I'd be delighted to hear them
sorry for nitpicking but you could write the vehicle variable like this to simplify your code
function CarCraftingMH_OnCreate(items, result, player)
addVehicle("SmallCar02")
local vehicle = player:getVehicle() or player:getUseableVehicle() or player:getNearVehicle()
if vehicle then
sendClientCommand(player, "vehicle", "getKey", { vehicle = vehicle:getId() })
end
end
what is lua similar to
code wise
not going to lie at first glance it looks like a slightly more complex python
Your recipe files cannot be named the same as vanilla. Name it something else. Name the items something else and name the recipes something else. That's it.
hi, i have a problem in recipe code, for "result.", i want put "Nothing" in result but no work now, before it's working and to day no work, why???
WARN : Recipe , 1644598141027> 149?001?622> RecipeManager.resolveItemModuleDotType> ERROR: can't find recipe result "Nothing" in recipe "Verifier l'outils"
recipe Creer une cle de maison a partir de l'outils empreinte
{
TraitRequired:nimblefingers;nimblefingers2,
SkillRequired:MetalWelding=2,
keep PrintTool,
BlankHouseKey,
RemoveResultItem:true,
Result:Nothing,
OnCanPerform:CanFindKeyCuttingMachinePrintCopy,
OnCreate:matchHouseKeytoPrintTool,
Tooltip:Requires a Powered Key Duplication Machine.,
Prop1:Source=1,
Category:Welding,
Sound:Metalwork1,
Time:800,
}```
QUESTION: If I have to get the keyring I use local keyRing =
...but if I have to get a bag instead of the keyring ( the ALICE green backpack in my case ) do I have to use ( sample ):
local bag =
or do I have to indicate the precise item name ( sample )
local Bag_ALICEpack =
or simply item generically (sample)
local item =
?
not exactly sure what you mean but the phrase "local keyRing = ..." just defines a new variable which happens to have the name keyRing. It doesn't contain anything related to the actual key ring by itself. To properly relate it to the key ring, the question is what you have on the right hand side of the "=" sign. For example, setting local keyRing = "Base.KeyRing" will give your variable keyRing the value "Base.KeyRing" (that is the script id of the actual in game key ring).
Variable name on the left side can be what ever
as always the same idea at the same time! XD
This is the code I'm using. It works but it adds a building key to the character inventory ( plus the keyring ). I want instead that it gives only the backpack ( no key or keyring ) but keeping the ability to add any item I want intoo the backpack ( or rather the part after -- add a basic key to the player's keyring )
your variable item seems not defined
wondering if i should use joke.item
now I get why they used "o"
if you are just adding item your dont need to store the reference into a variable
you store only if your are going to modify it or use later in the code
very short
u can use o too if you prefer
its the same object in the end
yeah this is not an existing keyword in lua only self is
not related to the things currently discussed here but is there a command which returns the current game tick?
not that i know
but you could make yourself one with OnTick and getting millisecond and substracting last tick ms
maybe you can get something from getGameTime()
but idk if gametime is presented as ticks
Hey guys, just wondering, I see a sound effect in the game called firealarm, but the game does not have fire alarms implemented, correct?
I want to mod fire alarms in but first checking that it isn't a thing already
there is an animtimer.ticks
if i use joke.
can I just do a local joke.item = item
or equivalent
Correct.
calling a function with the OnTick Event gives you current tick as argument. This is sufficient for me. Only thing is that coding would be a bit shorter if I could get the current tick directly. But not essential. Just a "quality of life" thing.
There is maybe a way then
now that I've made one mod here. I feel like I want to make a minecraft mod
shared/getTick.lua
local currentTick = 0;
local function getTick()
return currentTick;
end
local function updateTick(tick)
currentTick = tick;
end
Events.OnTick.Add(updateTick);
return getTick;
local getTick = require("getTick");
local tick = getTick();
thx! but not a big deal if i just work with the current tick provided by the event. in my case even a bit easier than to make an extra function for it.
do you know what the int variable called "area" in the RoomDef class represents?
๐น no wonder it wasnt working
even though I havent forgotten lua is case sensitive
my brain does not process casing as much as it should
Is it possible to lower the infection chance of a bite to something like 85% on a dedicated server?
to make a mod? or just for the server.
I dont know enough yet, but if its in sandbox_vars
then you can check there
I can't find a setting for that so I assume I need a mod?
Quote from bazz89: " not exactly sure what you mean but the phrase "local keyRing = ..."
just defines a new variable which happens to have the name keyRing. "
Ok so if I've understood it correctly I could change the new variable name to any ( ..and it will be exactly the same as the keyRing above, only the variable name will change ), correct?
Sample: " local backpack = "
you know how to open the sandbox_vars file?
yes
its not there?
No, I don't see a bit where I could change it.
Thanks both to bazz89 and konijima, with your indications got rid of my issue!Thanks guys! Salute!
changing it via a mod
I want it to be like for example 60
its limited to 30fps
anyone know where the arguments in game options are stored
IIRC there should be a file containg all those settings
yes, I think so. if you dont change the right hand side of the "=", the variable with the new name will have the same content as the one with the old name. but note that if you change the variable name, you need to change it everywhere in the function.
How do I get a player's first aid skill level? This is what I'm trying to do:
local breakthrough = ZombRand(0,100);
local firstAidSkil = --What do I put here?
if breakthrough <= 1 * firstAidSkill then
player:getInventory():AddItem("HTFAC.HTFACBreakthrough");
end
end```
@next glacier The file is in C:\Users\YOURPC\Zomboid\Lua
but I dunno if the Ui refresh rate is hardcoded or not
the files here
are the options you saved.
not where the code for the options are, sorry forgot to be clear
i found it
location?
E:\SteamLibrary\steamapps\common\ProjectZomboid\media\lua\client\OptionScreens\MainOptions.lua
Good ( Always better to know where is ๐ )
local playerObj = getSpecificPlayer(player);
local playerSkillFirstAid = playerObj:getPerkLevel(Perks.Doctor);
@next glacier looking at the comments in the various mod discussions you should create a mod to stop users to make always the same questions and to let them read the mod descriptions first LOOOL ๐
thank you!
that's why its hard to have gimmicky mod names
like my mod
"Reading is a Joke"
No problem. If you don't want to use playerObj cause you are not using the variable anywhere else then just
getSpecificPlayer(player):getPerkLevel(Perks.Doctor);
Vanilla files tell me that
-- all the perks are: Agility, Cooking, Melee, Crafting, Fitness, Strength, Blunt, Axe, Sprinting, Lightfoot, Nimble, Sneak, Woodwork, Aiming, Reloading, Farming, Survivalist, Fishing, Trapping, Passiv, Firearm, PlantScavenging, Doctor, Electricity, Blacksmith, MetalWelding, Melting, Mechanics, Spear, Maintenance, SmallBlade, LongBlade, SmallBlunt, Combat,
Meh... having a major issue now xD
When in character creation the networking is not yet ready..... No way to communicate to the server yet
would be great to have a way to request the server even before the player has fully spawned
Just need to fetch some server custom info
Removed
Perks is what the game files call skills, traits are a different beast.
Unless I just missed something and you are referring to something else...
You're correct, sorry I was looking at the wrong part of my notes ( I'm working on my script so I got confused )
Somehow there are others hidden in the code ( and this time perks ). Some time ago I've found one named Injuried and it worked as perk IIRC
other ones I recall were " Insane " and "Kind-hearted"
so expanding on the previous problem... i noticed this is happening now:
this is the recipe and subsequent code:
{
Category:Health,
keep HTFAC.HTFACMicroscope,
HTFAC.HTFACTestTubeBlood=5,
SheetPaper2,
Pen/BluePen/RedPen/Pencil,
NeedToBeLearn:true,
CanBeDoneFromFloor:true,
SkillRequired:Doctor=1,
Time:250.0,
Result:HTFAC.HTFACReportMicroscopic,
OnCreate:HTFACBreakthroughChance,
}```
breakthrough code:
```function HTFACBreakthroughChance(items, result, player)
--local playerObj = getSpecificPlayer(player);
local breakthrough = ZombRand(0,100);
local playerFirstAidSkill = player:getPerkLevel(Perks.Doctor);
if breakthrough <= 2 + playerFirstAidSkill then
playerObj:getInventory():AddItem("HTFAC.HTFACBreakthrough");
end
end```
the way it works is there is a guaranteed item from the recipe, and then a chance of an additional item. But when I perform it using that context menu (the microscope object is a placed item), it doesn't go to the player inventory
Hi, anyone know why changing the zombie stat in server side is not working? Let's say I have "zombie:applyDamageFromVehicle()", it work absolutely fine in SP, but in MP the code has ran at the server side but it doesn't do anything. It's not because the code only ran at client side, I had the line "if isClient() then return end" to make sure it runs at server side, and I have print output in the server log to confirm it did run at server side. But it just didn't do anything. Any idea why does it happen?
anybody knows where in the code is the check for the player to die to a generator indoors?
So I have a question about "Trunk Capacity Mods", despawning items, and the memory issues that causes it.
As far as I've understood the reason things despawn from vehicle/trailer trunks is due to how the storage space associated with a vehicle, whether it is spread over several separate containers or not, has a limited amount of memory it is saved to, and as such when the vehicle's information is reshuffled in the memory (normal computer things), whether RAM or drive, the reassignment of "stored item information" causes it to drop the information that is overflowing.
And that, the dropped "overflow", is what causes items to despawn.
Other types of containers are coded differently and do not suffer from the same issues. To my understanding this includes like bags/backpacks/etc.
Here's a more technical question: due to how carried containers store their information in a different manner it appears that they act like a "memory address book" where they point to a different part of the memory as to what they contain. If I'm right in that, couldn't one get around the "items despawning" issue by putting everything into bags before you toss them into the back of your trailer?
Well, I believe part of that phenomenon is that it was common practice for people to use trunk space mods to hoard stuff in 1500 weight unit capacity vehicle trunks and the like.
But it was never common practice for people to use ridiculous backpack space mods?
Asking because KI-5 has some vehicles, or more specifically some trailers, in their collection like the M1082 and M1095 (and their covered versions) from the '86 Oshkosh P19A mod, the IS-Container from the Containers! mod, and the super-trailers from his '82 Oshkosh M911 mod.
Oh, it's not about using ridiculous backpack-space mods
Imagine something like crates that you can pick up and store even when filled.
But with 0 weight reduction
Something like a hypothetical "Cargo Crates for Vehicle Storage", or some such.
I'm asking because I'm considering a "No Permanent Base"-run as a test before doing something like it on a coop-server.
Where people can't sleep elsewhere but vehicles
and you can't create bases that are meant to be permanent staging points, instead having to range out from a vehicle convoy-camp and temporary defensive positions and such.
What I'm saying is that it may be that backpack/etc containers would despawn stuff the same as trunk space mods, but that people just don't know that because people don't use backpack space mods the way that trunk space mods were used?
I don't have any strong opinions, or have done any deep data dives on the subject, I just know "you make containers with a large enough capacity and put enough item data in it stuff goes despawn"?
Oh, yeah, I understand but that's not what I'm getting at:
What happens if you, instead of filling the trunk/trailer with everything loose
you stuff it all into bags/carry-crates before putting it in the vehicle/trailer?
I'd be surprised if that worked.
But the world surprises almost every day so ๐คท
It all depends on how things are coded, right?
Since mem-storage is basically "Here, this is how much memory this particular entity has and this is the amount dedicated for keeping items in it"
Now, is each entity, containers included, always stored in their entirety inside of what they are in turned stored in?
Or is it that bags/containers, when stored in other containers, are made into something equivalent to a single item with a very high weight value?
One thing I do know is that the item type itself, and how much data is attached to that item affects the despawn effect, so you can't even say "X amount of weight units or Z number of items is the practical limit". Food type items have more data than Literature type items.
ORGM Machinegun belts were notorious for despawning stuff in trunk space circumstances because they have 200 pieces of mod data to track every round of ammuntion in them for example.
I mean, the weight is more of a vehicle limit than a memory limit, right? The suspension and tires not being able to handle the load, etc.
You might be able despawn the contents of vanilla vehicles by filling them with cigarettes, for example.
But that's because it's a massive stack of single items, no?
If you were able to convert things into larger pieces for storage, like "Box of Cigarettes"/"Roll of Bandages", etc, with recipes to convert them into their smaller pieces
much like ammo and ammo-boxes
But what you said about the ORGM Machinegun belts makes me think that it's the more straight-forward
"Everything in Bag A is also stored in the memory of Crate B as well as the memory of Trailer C if you put A in B and B in C."
I'll be honest in that I've spent a fair amount of effort talking to people more knowledgeable than me on the subject, trying to get concrete answers, so I could say "Don't give your trunks X amount of capacity and you won't have to deal with the trunk space despawn curse", to put an end to all the confusion etc over the issue.
And everyone basically said "It's not possible to give concrete answers on account of all the variables in play, just don't mess with modified trunk spaces if you don't want to deal with the despawn issue"?
So, personally, I'm satisfied to say "It's just not a good idea, experiment at your own risk"
Fair enough.
That does leave me to wonder if the larger containers/trunks/trailers in some of KI-5's vehicle mods suffer from the same issue
In that you really don't want to fill them, even unaltered, as you automatically run into despawn-issues.
But I can see how food items require more memory space, especially the perishable kind.
And even more so things the player has cooked themselves
Each item being unique in nutrition, hunger, happiness, thirst, etc, and it all being variable with your cooking skill.
I'm sure under the right circumstances, such as multiple vehicles in close proximity (ie the same chunk) that are stuffed full of stuff, it has happened? People report issues constantly, and the huge volume of reports + poor descriptions means it could be an ongoing issue with those vehicles that people just aren't aware of?
Personally, I would not use those vehicles for my own server on account of those concerns. My own cargo container mod has a weight limit of 250 for example.
There was memory optimization for saving game data that I understand made the despawn issue less pronounced, but that doesn't mean that it doesn't still happen, just that the limits are different that previously.
Funny aside, when b41 was first released, it was literally a daily post in tech support by someone who had all their stuff despawn due to trunk space mods. It became a punchline. Eventually they fell out of common practice because of people getting constantly burnt by it, and also the memory optimization would have helped make it less common.
- Also, full disclosure, I'm not "objective" on the matter in that I've just seen it repeatedly be a gigantic fucking headache for people in the past, so I'm definitely biased on the subject?
So definitely take my opinions with a grain of salt/I'm just another idiot on the internet/yadda yadda yadda.
Oh, I'm "well aware" since I already looked through this channel for answers and your grievances with people stuffing towns in trunks came up often enough ๐
But it's totally fine! I'm studying computer science, like getting into the guts of game code to figure it, like suggesting or making (read attempt) mods/strategy optimization based on what I learn, have gotten really freaking sucked in by PZ, and was writing this partly to make the challenge I mentioned work properly partly to deal with my massive hoarder-issues and partly to because I like exploratory stuff like this. No offense taken, the salt was considered and subsequently discarded, and I've enjoyed this a lot!
Players on my server are saying cars give infinite engine parts and still act broken when repaired, why is that?
Definitely learned something and where to take my explorations.
Ahahahaah ๐
Yeah, the best answer I have is "The largest vehicle trunk capacity in vanilla is 100 units and that's what the game is designed for"?
Might be that removing the engine parts permanently sets the engine condition to 0 but doesn't remove the ability to yoink further engine parts from it?
Depends on if it is a vanilla function, a mod-altered vanilla function, or a completely mod-added function.
Assuming that you're using mods, then a mod is most likely to blame there.
In the first it might be a coding oversight or mod-overwrite error. Like Algol I suspect the latter.
Actually, it's either a coding oversight or a mod-conflict/-overwrite thing.
The difference is just in how likely Option A is over Option B
I have car scrap mods installed
I mean, removing engine-parts and repairing engines isn't a car scrap-unique thing, no?
Iono if it would effect it
I'd love to take a look but I've yet to work out where/how to find the specific scripting/lua code in PZ mods.
I started playing the game literally 3 days ago xD
Well, playing modded, that is.
... I'mma test it in single-player, one moment.
Well, to be honest, a lot of "improvement mods" that are intended to fix what the modmakers see as problems with vanilla are made with the best of intentions, but also rudimentary grasp of good PZ modding practices? IME a lot of them have serious problems under the hood (such as the "better item mod apocalypse" when item tags were introduced), so my first suspicion is that it's some sort of vehicle mod that's intended to "improve/expand vehicle mechanics", and a scrap cars mod sounds like one of those?
Just tested it
SP does not have that issue with either vanilla or modded cars
Well, the modded cars I had laying around.
And yes, I have Scrap Cars enabled
Thnx for the help, ima take a look at my vehicle mods
Not a fan of pinging others, so just going to turn this one off. Are you sure that's the case, I'm not seeing any changes from renaming anything, it's only if I remove the recipe lua file or get rid of the various bits at the beginning such as Recipe.OnCreate = {} like in the default one, which also results in the recipes not working as intended. My stuff should be named differently, as I deleted every oncreate recipe from the lua file and it still didn't work, only once I took the lua file out would I be able to open cans again. There aren't any traces of can or tin in my recipe lua, here's an example of one of the recipes:
--Moxx Sticks Box
function Recipe.OnCreate.OpenMoxxBox(items, result, player)
player:getInventory():AddItem("MoxxBoxDestroyed");
end
- Make sure your recipe function file doesn't have the same name as the vanilla recipe file so it doesn't overwrite it.
- Have
require "recipecode"at the beginning of your recipe file - Change all that
Recipe.OnCreate = {}etc stuff toRecipe.OnCreate = Recipe.OnCreate or {}and such as appropriate for the statement and the like with your file, as you're wiping vanilla recipe functions with how you define them.
@thin hornet is it possible to edit MainOptions.lua
Ah, I suppose that makes sense. Thank you for all the help you've been providing to me, Algol!
๐
btw what are other commands in lua
original code has addCombo
how to I go around overriding that
anything lua is editable unless local
i haff code
--MoreFPSOptions
local UIRenderFPS = MainOptions.self:addCombo(splitpoint, y, comboWidth, 20, getText("UI_optionscreen_UIRenderFPS"), {"144", "120", "60", "30", "25", "20", "15", "10"}, 2)
map["defaultTooltip"] = getText("UI_optionscreen_UIRenderFPS_tt")
UIRenderFPS:setToolTipMap(map)
local gameOption_toUI = gameOption.toUI
function gameOption:toUI(self)
local box = self.control
local fps = getCore():getOptionUIRenderFPS()
if fps == 144 then box.selected = 1
elseif fps == 120 then box.selected = 2
elseif fps == 60 then box.selected = 3
elseif fps == 35 then box.selected = 4
elseif fps == 25 then box.selected = 5
elseif fps == 20 then box.selected = 6
elseif fps == 15 then box.selected = 7
elseif fps == 10 then box.selected = 8
end
end
local gameOption_apply = gameOption.apply
function gameOption.apply(self)
local box = self.control
if box.options[box.selected] then
local fpsTable = {144, 120, 60, 30, 25, 20, 15, 10}
getCore():setOptionUIRenderFPS(fpsTable[box.selected])
end
end
self.gameOptions:add(gameOption)```
I'll post the answer in #mod_support as that's the channel that was added for mod-user-issues, and this channel is intended for mod-creation-issues.
oh sorry
๐
i only know right now add, set, get
yeah this is completely the wrong way
it can me done if i modify original MainOptions.lua
but not as a mod
or so i think
wow
my mod <3
Hello guys i'm trying to see if i can make a new skill, i was wondering where i could find the skill related script so i can take them as an example anyone has an idea ?
Hey guys, would it be hard for someone with a little bit knowledge to create a simple custom mod for MP which reduces the weight of military and tactical walkie talkies? I assume it should be items_radio.txt file which somehow overrides the original on a dedicated server.
Here are the mods for scavenging & driving skills https://steamcommunity.com/id/Afterworlds/myworkshopfiles/?appid=108600
Thanks a lot, and regarding vanilla skills, is there a way to access them ?
Or is there maybe somewhere a guide on how to override vanilla items?
https://steamcommunity.com/sharedfiles/filedetails/?id=2704881099
This mod was the problem
welp... Update on my zombies issue:
The issue isn't saving the zombie. It's dynamically updating the changes for the client. Anybody know how I would "refresh/reload" a zombie????
function has_value (tab, val)
if(tab ~= nil) and (val ~= nil) then
for index, value in ipairs (tab) do
if value == val then
return true
end
end
end
return false
end
function setContains(set, key)
if set ~= nil then
return set[key] ~= nil
end
end
How come when I use setContains instead of has_value my code breaks. I thought these should be identical
i see it as soon as i posted i think
if set not nil should work
or what i have in parens >_>
not exactly a modding question, but it's about the game's code. is their a way to look at loot tables for every item? I was wondering if machetes could spawn in any area that spawns good tools
such as sheds behind houses, etc.
There is a thing in the debugger to know what takes time to calculate? I try to optimize my mod because some say it makes them lose FPS
do tell. I'm not very proficient with the debugger's features.
E:\Steam\steamapps\common\ProjectZomboid\media\lua\server\Items\Distributions.Lua
This is a visual guide for mappers and modders who need to add or modify PZ's loot entries using the new ProceduralDistributions.lua approach. Whilst the ProceduralDistributions.lua file has been in the game for quite a while (i.e. the Gigamart shelves having distinct loot types), TIS will be eve...
do the different names for loot tables each refer to one container, or could one loot table be found in multiple containers?
@undone heron@sour islandsry for tagging you guys, but did you somehow manage to set WalkSpeed? I'm trying to do the same but to no avail
Chipping in a idea, sprinkler mod because watering plants get's annoying
No
Someone told me that "More Traits" mod had something
I'm taking a look on it right now
Is there a way to create a recipe with no Result ? but just use the OnCreate function ?
@subtle pawn already a mod for that
@undone heron Well ... the solution in the mod is to change the player's coordinates by using setX, setY functions, but it seems bad to me.
Where?
@subtle pawn its called irrigation on the workshop
welp... How does one save a zombie's attached items???
I've downloaded some mods but they aren't showing up in the mods folder or anywhere else. Tried restarting the game a few times but that didn't help.
Yeah, that way seems fairly SUS and can screw with collision checks.
You could check to see if movement modifiers work. Last I check they didn't in 41. So like boots and sneakers are also broken
I've managed to successfully increase running speed a little bit by changing the runSpeedModifier within clothing items
but there's a cap even if you set to 1000.0
Equipped clothing items can change the attack speed. Items are hidden from the inventory when item:isHidden() returns true. The java decides to make an iten be hidden when it has no displayname. Clothing items can have dirt, blood, and water. Custom clothing item clots can be created.
since there's no direct way to tweak the speed multiplier, I'm trying any indirect way
no success so far
the problem seemed to fix itself! phew.
Hey @weary matrix I found that in you doc https://zomboid-javadoc.com/41.65/zombie/ui/UIElement.html#ClearChildren() is instead clearChildren().
Hope that helped
Javadoc Project Zomboid Modding API declaration: package: zombie.ui, class: UIElement
ClearChildren() is the java function and clearChildren() the lua one
--************************************************************************--
--** ISUIElement:clearChildren
--**
--************************************************************************--
function ISUIElement:clearChildren()
if self.javaObject == nil then
return;
end
self.children = {}
self.javaObject:ClearChildren();
end
but this is the javadoc not the luadoc
check the following line and you'll see the javadoc is correct:
self.javaObject:ClearChildren();```
Is it possible to make a recipe which spawns no item?
Yes. I think it is RemoveResultItem:true
Or something like that
Is it the javadoc ? So why do I use it from the beginning as the lua doc xD
That worked grat trough, they ~ all name the same
But hey, seam logic now
How do you make a spawn point occupation specific?
Pillow's spawn points mod should have examples of all kinds
This sounds like it belongs in #mapping
I was trying to look at that earlier - I downloaded it but itโs not in any folders even after restarting the game.
Restart steam, sometimes it fails to detect it needs to download a mod
ah, didn't try that. thanks!
@nimble spoke that worked for other mods, but still not Pillow's. I am going to try verifying the game files.
It is now fixed. phew!
how do you make it so that your mod still works without modoptions
how do i get a recipe to use just some of the pen instead of the whole pen? is this because its a condition and not drainable?
???
are you not correct
if i use ==
different error
i see
yea nope
still box2 of non-table: null
ah
just need a require
to preload other file
making it so if game does not have modoptions installed
my mod still works
test?
Hi, I want to ask if anyone knows how to spawn an isoobject and make it impassable
I've tried setting the sprite properties
With walln...
And to no avail. The object spawns but it is still passable
Do we have a UV map of textures in this game?
Creating a new save will also add folders not showing.
so i think my question got skipped over here last time, but are we allowed to suggest mod ideas and ask about mods here?
or
is this purely for the technical side of them, creation etc
If you have questions about using mods/using specific mods #mod_support
Ah ok thanks Blair ๐
1992 encyclopedia
I got this idea but I don't know how to mod. So basically if you have a pillow in your inventory then the sleeping quality of anything goes up
Can you make a recipe which accepts only fresh food ingredients?
Final question, what's a really good mod I can reference for configuring the loot distribution tables?
same, i just know what to do, but not how to code
changing the function for sleeping quality
and adding a condition:
scan your inventory for a pillow
then sleep quality up
else sleep quality = vanilla value
Anyone know if we can disable splitscreen in MP?
require("JoyPad/ISJoyPadListBox");
function ISJoypadListBox:invoke()
local joypadData = self.joypadData
local item = self.items[self.selected].item
if item.cmd == "takeover" then
self:cmdTakeOver(item.playerNum)
elseif item.cmd == "addnew" then
--self:cmdAddNew()
elseif item.cmd == "addsaved" then
--self:cmdAddSaved(item.player)
elseif item.cmd == "cancel" then
self:cmdCancel()
end
end
You dont on my server
so you know where everyone is. interesting
maybe run it on an event
How can I ensure that my mod works in MP without any friend to help me test if it actually works?
Ah, that's very straight forward
Thanks
I was wondering, is it possible to force a profession to be Female or Male only? 
I was thinking about using professions to make premade character from movies or other stuff
I think someone was trying to do that not too long ago
@hidden estuary did you ever figure that out?
this should be possible. the vanilla files media/lua/client/OptionScreens/CharacterCreationHeader.lua and CharacterCreationMain.lua control the interface of the character customisation screen. you can change it so that depending on the profession, you only have the ability to create female or male characters.
Thank you, I will give it a look after work
figure what out
oh yeah no, I couldn't get it to work
I tried to hide the gender option in the character creation menu
and that code works, the problem is that if I try to make the game check for a trait, the trait doesnt apply to a player yet cause the player doesnt exist yet
Interesting, If I make it working, I will probably ask @quasi geode to add the code to Profession Framework since I use it for all my professions
I didn't try with a profession
here
do
local CharacterCreationHeader_create = CharacterCreationHeader.create
function CharacterCreationHeader:create()
if getPlayer():HasTrait("valkyrieWoman") then
CharacterCreationHeader_create(self);
self.genderCombo:setVisible(false);
MainScreen.instance.avatar:setFemale(true);
MainScreen.instance.desc:setFemale(true);
end
end
end```
so, the trait didn't work, didn't try with a profession, maybe if the game checks for a profession it would work, but I didn't try that
possible solution could be this: make a new global variable which stores whether your "critical" trait has been selected in the occupation and trait screen. then you could easily access that information in the character creation screen
I dont know how to do that xD
my knowledge on lua is very scarce, specially in regards of this game
still learning the ropes
hmm... ok... you should learn lua programming then. ๐ here is the basic idea: in the lua files controlling the occupation&trait screens, you should identify which functions are triggered when the player selects or deselects traits. then make a new variable called for example "TraitHasBeenChoosen" and set it true when the player chooses your trait in question and false otherwise. in the character creation screen, you can then use sth like "if TraiTHasBeenChoosen == true then hide the gender option". but you need to learn lua for this. the whole strategy I outlined should definitely work but requires some coding work.
in your code example, note that you disable the whole create() function in case your player has the trait. this could also be the source of error. in that case, you can ignore the idea i outline above and try to fix it first.
might be better to append the command "self.genderCombo.setVisible(false)" to the function "disableBtn" instead.
moreover, you could try to modify initClothing function to make it so that each character has your desired gender. but there might be other functions to modify to realize this. that's just my first idea.
I don't disagree with using a variable to track the state (although, I wish there was/hope there is a cleaner way), but I don't think it should be global. A local variable in the same file would suffice
you're right. I agree! local will work if you put all your functions in the same .lua file.
the character doesnt exist but the character creation menu has to be keeping track of it so can get it from it
should be able to export locals to other lua files
As in, a module-level return? Yeah, true
yes
could also be a good strategy!
let me write an example for future reference
-------- exampleFile.lua --------
local variable = "example"
return variable
---------------------------------
------- exampleImport.lua -------
local variable = require("exampleFile")
print(variable) -- will print "example"
---------------------------------
Something to note with the example @drifting stump just sent: it must be a table in order to ensure the values are by-reference and not by-value. Meaning, if you return just a number or a string for example, then you won't be able to update it
I figured the example would be a table when I typed that lol
ill leave it like that because its a simple example of exporting a variable
That require should read require('exampleFile')
what? whats special about setting a local variable = require("file")
its assigning the variable returned from the other file
It loads the file if it hasn't been loaded (note that this means multiple requires to the same file = only a single load!), then returns the value returned by the module
so far ive only used require("file")
That also returns the value(s) returned by the module, you're just not using them
I highly recommend reading through Programming in Lua (or some other resource, if official docs aren't your cup of tea)
so far ive been just reading chunks and bits in between
You can get by by learning as you go, but when I learned Lua I read the entire thing to be thorough. It's up to you how well you want to know it; for the most part, knowing the intricacies of metatables is just interesting but not too commonly used
btw I also guess there is a way to access the trait without making an extra variable. the game also remembers the traits (otherwise I couldn't assign them properly to the player when game starts). there is probably a way to access the trait in a more clean way. in case you couldn't get it from the IsoPlayer, there is also an object called Main.instance.desc in the character creation which stores a lot of stuff for the player build, for example the profession. might be worth a try to check this (although I am not sure if it stores the trait).
I assumed ArcAngela tried this, but that's true. They may have missed it/it wasn't in a very clear place
ah ok. but as i said before, there are probably also problems because they seem to disable the whole create() method. would try to fix it first.
Sorry for not replying to the gender/profession/trait things but im at work, but I'm fairly confident that it's possible to look for the selected profession and gender by looking into the clothes options for the professions
to just get the actual gender, i think Main.instance.desc:isFemale() will work. it returns true if character is female and false otherwise. and sth similar with "getProfession()" might give you the profession.
did some improving of the example
but Main.instance.desc:isFemale() contains just the info about the current gender. to make it so that a certain character always has a predefined gender, you need some different coding.
Is anyone there who knows how to make clothing/armor mods ? i could use a hand
You can (and should!) check the source of existing mods by downloading them and looking through their mod folder. Further explanation on the meaning of this: download a clothing mod, check out its source to learn how it works
I'm unsure about specific resources for clothing mods, but I imagine they're out there. You should also check the pins & the modding section of the wiki (which is also in the pins)
hey guys. How do I pop vehicle's tire? I'm making a mod that randomly pops the tire whenever the player steps over a specific ground item.
Tried to set damage on it, but it didn't work. Condition goes to 0 but it does not pop
Pop like ๐ฅ or pop like deflate?
boom
Can they boom in pz?
sure. when you keep running over zombies, one tire eventually pop
there's even a specific sound
!!!
@gilded hawk and the other people trying to allow only female characters. have something for you:
this code will make all the characters in the customisation screen female!
oooooh
You 
I just need to use desc:getProfession() to enforce the profession check then
it doesn't hide the option to select gender yet. moreover, it probably won't work if player choose the "Unlock all clothing" option in sandbox.
I can probably figure something out tho
Thanks a fuckton man
I'm sending you a hug 
might be that there are better ways to do this but could be a point to start with. here is the code again, so you can copy:
and I guess this code should be put to lua/client
Do I need to require CharacterCreationMain
?
could work, but variable desc has to be defined with local desc = MainScreen.instance.desc ofc
Is there any way to get distribution tables after world (map?) started and save them to file?
Trying to figure out whatโs wrong with suburbsโฆ
not as far as I know. at least the chunk of code I posted works without requirements. point is that CharacterCreationMain:initClothing is a global function. so you can access it from everywhere (at least in the client folder).
you're welcome! but don't forget to test it a lot (also using the "randomize" character button) to check whether it really works in every case.
wont add to the framework. I dislike having the PF mess with the user interface elements and try to severely limit the amount it messes with/changes vanilla code. Its just asking for incompatibilities and issues later.
There are some parts of the framework that do mess with the UI but these are experimental, undocumented and disabled by default.
๐ Fair enough
if (item:getType() == "Bleach") then
bleachItem = item
end```
How can I extend this to be multiple objects, like soap, cleaning liquid, etc
can I just do an "or" symbol within the if statement lol? I'm not really sure what the symbol is for that in lua though
The symbol is or, but for any amount greater than 2 (really, any amount greater than 1 is fine for this pattern, but if it's only two comparisons it's more typing for marginal benefit) you'll want to use table keys instead
That is:
local validItems = {
['Bleach'] = true,
['SomethingElse'] = true,
-- and so on
}
if validItems[item:getType()] then
-- do stuff
end
If you're trying to assign them to different variables, you'll have to either do multiple comparisons or have a second table which you use instead of those variables. I believe tables are slightly less performant than variables, though (may be untrue, I'm not familiar with kahlua's implementation), so your call if that's a loss that's acceptable
Alright, thank you
Oh, I meant to also say: I'm unsure what the standard is, but I'd assume it's safer to use getFullType (which would return 'Base.Bleach') rather than getType
In case someone's mod defines Bleach in another module, for example
So pretty much all I'd have to do would be to change getType to getFullType?
Yes, and expect Base.Bleach instead of Bleach for the string
Omar. Why does the game use Strings for comparison instead of Numeric values?
What do you mean? Like the example above?
in general. I see all sorts of things being Stringed compared when they could use numbers instead
I'd assume in some cases it's for ease of modding; it's much simpler to compare item IDs as above than it would be to keep track of integer IDs (which would also be limited, but with Lua's number range that wouldn't be much of an issue)
it could enumerate ItemTypeName and then use the enumerated values for much faster comparisons
I can't really give an absolute answer, though. You'd have to ask the devs
Yeah, but then mods would have to have integer IDs for their items
I think I saw some usage of enumerated values
don't remember where
if item == ITEM.KETTLE then ...
I'd assume that was a string "enumeration", or just a table of strings
ops item:itemID()
Omar. one final question if you dont mind
How do I safely delete an item?
๐คท๐พโโ๏ธ I'm not really much of a modder, I'm only useful for Lua knowledge
oh I see
I imagine the documentation lists a method for item deletion if it exists
I'm trying to pop a vehicle's tire. The only way I figured out so far is "deleting" the wheel
basically I get the part and then
part:setInventoryItem(nil)
vehicle:transmitPartItem(part)
but I'm not sure if that is the safest way to remove a tire
It does work, but I suspect the part goes to the limbo ...
Couldn't tell you; the only deletion code I can think of is the trash can's "delete all", which uses ItemContainer's clear method (and there might be a debug deletion too? unsure). I imagine if you determine where the existing tire popping happens in the code you can mimic it in Lua
Yeah. I tried to pinpoint the popping logic in the code but I didn't find anything.
the setInventoryItem to nil was the closest I could get
When does tire popping usually occur? When the tire condition is low?
I suspected so. My initial idea was to set the condition to 0 and then wait for the game to update
Didn't work either. I kept running with the car with a 0 condition tire and nothing happened
I believe I've found the relevant code
there is a method named "damage"
From server/vehicles/Vehicles.lua, line 619
-- lower the tire condition depending on your speed/current steering
-- also handle tire explosing because of condition/lack of air here
function Vehicles.Update.Tire(vehicle, part, elapsedMinutes)
if vehicle:isEngineRunning() and vehicle:getCurrentSpeedKmHour() > 10 and part:getInventoryItem() then
local chance = Vehicles.LowerCondition(vehicle, part, elapsedMinutes);
-- randomly losing air
if part:getContainerContentAmount() > 0 and ZombRandFloat(0, 100) < (chance / 2) then
part:setContainerContentAmount(part:getContainerContentAmount() - 1, false, true);
end
-- chance of tire explosing
-- because of it not containing enough air
if part:getContainerContentAmount() < 5 then
local contentMod = (part:getInventoryItem():getMaxCapacity() - part:getContainerContentAmount()) / 350;
if part:getContainerContentAmount() == 0 or ZombRandFloat(0, 100) < contentMod then
vehicle:getSquare():AddWorldInventoryItem(part:getInventoryItem(), 0,0,0);
VehicleUtils.RemoveTire(part, false);
end
end
-- then because of condition
if part:getCondition() < 15 then
local condMod = (100 - part:getCondition()) / 350;
if part:getCondition() == 0 or ZombRandFloat(0, 100) < condMod then VehicleUtils.RemoveTire(part, true); end
end
end
end
So VehicleUtils.RemoveTire may be what you need
thanks, Omar. I'll check it out right now
Hi! Sorry to bother you, I'm playing with a few friends in a private server with some mods and I'm the only one having this bug, it happens whenever I open the build menu or interact with it (changing tabs, adding materials, adding stuff to favorites, closing the menu, etc.), this is the stack trace (in different messages because of Discord's character limit):
function: populateRecipesList -- file: ISCraftingUI.lua line # 1067
function: refresh -- file: ISCraftingUI.lua line # 65
function: addItemInEvolvedRecipe -- file: ISCraftingUI.lua line # 1520
function: onAddRandomIngredient -- file: ISCraftingUI.lua line # 435
function: onMouseUp -- file: ISButton.lua line # 56
ERROR: General , 1644853851778> 3.100.985.711> ExceptionLogger.logException> Exception thrown java.lang.reflect.InvocationTargetException at GeneratedMethodAccessor312.invoke.
ERROR: General , 1644853851778> 3.100.985.711> DebugLogStream.printException> Stack trace:
java.lang.reflect.InvocationTargetException
at jdk.internal.reflect.GeneratedMethodAccessor312.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.base/java.lang.reflect.Method.invoke(Unknown Source)
at se.krka.kahlua.integration.expose.caller.MethodCaller.call(MethodCaller.java:62)
at se.krka.kahlua.integration.expose.LuaJavaInvoker.call(LuaJavaInvoker.java:198)
at se.krka.kahlua.integration.expose.LuaJavaInvoker.call(LuaJavaInvoker.java:188)
at se.krka.kahlua.vm.KahluaThread.callJava(KahluaThread.java:182)
at se.krka.kahlua.vm.KahluaThread.luaMainloop(KahluaThread.java:1007)
at se.krka.kahlua.vm.KahluaThread.call(KahluaThread.java:163)
at se.krka.kahlua.vm.KahluaThread.pcall(KahluaThread.java:1980)
at se.krka.kahlua.vm.KahluaThread.pcallBoolean(KahluaThread.java:1924)
at se.krka.kahlua.integration.LuaCaller.protectedCallBoolean(LuaCaller.java:104)
at zombie.ui.UIElement.onMouseUp(UIElement.java:1228)
at zombie.ui.UIElement.onMouseUp(UIElement.java:1183)
at zombie.ui.UIManager.update(UIManager.java:808)
at zombie.GameWindow.logic(GameWindow.java:253)
at zombie.core.profiling.AbstractPerformanceProfileProbe.invokeAndMeasure(AbstractPerformanceProfileProbe.java:71)
at zombie.GameWindow.run_ez(GameWindow.java:661)
at zombie.GameWindow.mainThread(GameWindow.java:475)
at java.base/java.lang.Thread.run(Unknown Source)
Caused by: java.lang.IndexOutOfBoundsException: Index -1 out of bounds for length 1
at java.base/jdk.internal.util.Preconditions.outOfBounds(Unknown Source)
at java.base/jdk.internal.util.Preconditions.outOfBoundsCheckIndex(Unknown Source)
at java.base/jdk.internal.util.Preconditions.checkIndex(Unknown Source)
at java.base/java.util.Objects.checkIndex(Unknown Source)
at java.base/java.util.ArrayList.get(Unknown Source)
at zombie.inventory.RecipeManager$RMRecipeSource.getAvailableItems(RecipeManager.java:723)
at zombie.inventory.RecipeManager$RMRecipe.getAvailableItems(RecipeManager.java:618)
at zombie.inventory.RecipeManager.getAvailableItems(RecipeManager.java:1025)
at zombie.inventory.RecipeManager.getAvailableItemsNeeded(RecipeManager.java:1002)
at zombie.inventory.RecipeManager.HasAllRequiredItems(RecipeManager.java:441)
at zombie.inventory.RecipeManager.IsRecipeValid(RecipeManager.java:333)
... 21 more
I'm afraid I don't know Lua, the only different recipes we have are those of the Engineer class (me)
@frank elbow it worked! thank you so much. I hope God gives you all the candy you want
You may have better luck in #mod_support, and I think it may help to list what the mods are. Also: uploading the full console.txt may be useful
Alright, thank you!
do you have both the same mods?
exactly?
or do you have more mods than server
looks like an invalid recipe
Can someone explain me this error?
function: CharacterCreationMain.lua -- file: CharacterCreationMain.lua line # 1
ERROR: General , 1644857542267> ExceptionLogger.logException> Exception thrown java.lang.RuntimeException: attempted index: initClothing of non-table: null at KahluaThread.tableget line:1689.
ERROR: General , 1644857542268> DebugLogStream.printException> Stack trace:
java.lang.RuntimeException: attempted index: initClothing of non-table: null
at se.krka.kahlua.vm.KahluaThread.tableget(KahluaThread.java:1689)
at se.krka.kahlua.vm.KahluaThread.luaMainloop(KahluaThread.java:492)
at se.krka.kahlua.vm.KahluaThread.call(KahluaThread.java:163)
at se.krka.kahlua.vm.KahluaThread.pcall(KahluaThread.java:1980)
at se.krka.kahlua.vm.KahluaThread.pcall(KahluaThread.java:1782)
at se.krka.kahlua.integration.LuaCaller.pcall(LuaCaller.java:76)
at se.krka.kahlua.integration.LuaCaller.protectedCall(LuaCaller.java:117)
at zombie.Lua.LuaManager.RunLuaInternal(LuaManager.java:550)
at zombie.Lua.LuaManager.RunLua(LuaManager.java:496)
at zombie.Lua.LuaManager.RunLua(LuaManager.java:482)
at zombie.Lua.LuaManager.LoadDirBase(LuaManager.java:329)
at zombie.Lua.LuaManager.LoadDirBase(LuaManager.java:256)
at zombie.Lua.LuaManager.LoadDirBase(LuaManager.java:375)
at zombie.GameWindow.init(GameWindow.java:1170)
at zombie.GameWindow.mainThreadInit(GameWindow.java:556)
at zombie.GameWindow.mainThread(GameWindow.java:469)
at java.base/java.lang.Thread.run(Unknown Source)
LOG : General , 1644857542269> -----------------------------------------
this is my code pz-BeatrixKiddo\Contents\mods\BeatrixKiddo\media\lua\client\OptionScreens\CharacterCreationMain.lua
local old_CharacterCreationMain_initClothing = CharacterCreationMain.initClothing
function CharacterCreationMain:initClothing()
local result = old_CharacterCreationMain_initClothing(self)
-- code
return result
end
happens with my code example for setting all to female? (i am bazz89. decided to change my nick in accordance with the one i use in the steam workshop. ๐ )
Hey man yes it does now
first thing i notice is that initClothing doesn't seem to have a return value....? maybe this is the problem....
It should not give me that error tho 
Because even when I use your code I get the error
even if you use it alone? no other code in your mod touching CharacterCreationMain?
attempted index: initClothing of non-table: null
LOG : General , 1644857820550> -----------------------------------------
STACK TRACE
-----------------------------------------
function: CharacterCreationMain.lua -- file: CharacterCreationMain.lua line # 2
ERROR: General , 1644857820551> ExceptionLogger.logException> Exception thrown java.lang.RuntimeException: attempted index: initClothing of non-table: null at KahluaThread.tableget line:1689.
ERROR: General , 1644857820551> DebugLogStream.printException> Stack trace:
java.lang.RuntimeException: attempted index: initClothing of non-table: null
at se.krka.kahlua.vm.KahluaThread.tableget(KahluaThread.java:1689)
at se.krka.kahlua.vm.KahluaThread.luaMainloop(KahluaThread.java:492)
at se.krka.kahlua.vm.KahluaThread.call(KahluaThread.java:163)
at se.krka.kahlua.vm.KahluaThread.pcall(KahluaThread.java:1980)
at se.krka.kahlua.vm.KahluaThread.pcall(KahluaThread.java:1782)
at se.krka.kahlua.integration.LuaCaller.pcall(LuaCaller.java:76)
at se.krka.kahlua.integration.LuaCaller.protectedCall(LuaCaller.java:117)
at zombie.Lua.LuaManager.RunLuaInternal(LuaManager.java:550)
at zombie.Lua.LuaManager.RunLua(LuaManager.java:496)
at zombie.Lua.LuaManager.RunLua(LuaManager.java:482)
at zombie.Lua.LuaManager.LoadDirBase(LuaManager.java:329)
at zombie.Lua.LuaManager.LoadDirBase(LuaManager.java:256)
at zombie.Lua.LuaManager.LoadDirBase(LuaManager.java:375)
at zombie.GameWindow.init(GameWindow.java:1170)
at zombie.GameWindow.mainThreadInit(GameWindow.java:556)
at zombie.GameWindow.mainThread(GameWindow.java:469)
at java.base/java.lang.Thread.run(Unknown Source)
The only other piece of code that could be touching it is ProfessionFramework 
Are you overwriting the entire CharacterCreationMain.lua with your code in a file with the same name?
hmm... seems also to be the case that your modded file has the name CharacterCreationMain. Does it overwrite every function from that file?
oh... see @willow estuary ๐
โ๏ธ
- Rename your file to something other than that
- Have the first line in your file be
require "OptionScreens/CharacterCreationMain"
also, don't define the function CharacterCreationMain:initClothing twice in your mod
I did not expect it to overwrite the entire file, it's not something I'm used to
Oh yes sure
just thought because you have it in your code example. my code example also re-defines it.
This function is autogenerate by my PD2 vscode extension and I just do the old_namehere hook that's why I was confused when you mentioned that the return could be the problem. I never had return issues with lua
local old_CharacterCreationMain_initClothing = CharacterCreationMain.initClothing
function CharacterCreationMain:initClothing()
local result = old_CharacterCreationMain_initClothing(self)
-- code
return result
end
Okay changing the name made it work ๐ 
ok. didn't know that lua can handle this even if no return value is defined...
It will be just nil iirc
So, I noticed a thing
local vanilla_initClothing = CharacterCreationMain.initClothing
function CharacterCreationMain:initClothing(...)
local desc = MainScreen.instance.desc
if desc:getProfession() == "BeatrixKiddo" then
desc:setFemale(true) -- set gender always to female
CharacterCreationHeader.instance.avatarPanel:setSurvivorDesc(desc)
MainScreen.instance.charCreationHeader.genderCombo.disabled = true
MainScreen.instance.charCreationHeader.genderCombo.selected = 1
end
vanilla_initClothing(self, ...)
end
This code works, and MainScreen.instance.charCreationHeader.genderCombo.disabled = true disables, the button. But the combo value has to be forced to 1
Weird, but it does work
good question! maybe it deletes all data related to gender combo when you disable it in your way and sets everything to nil which may cause conflicts. but just a speculation.
as an alternative way to disable the gender combo in the init function, you could try to append the command self.genderCombo:setVisible(false) to the function disableBtn (also in CharacterCreationMain). This won't delete anything afaik but just "hide" the option.
That's a good idea
I have an idea for a mod, just to throw it out here; nightmare/psychosis... in the middle of the night where you might have a nightmare you end up going through a minigame that zombies are entering your house, you're not physically effected and you don't die, but if you do die in the nightmare you wake up with nightmare moodle, if you survive the small horde you dont get the moodle (or you get a bonus). The psychosis would be a random godmode zombie would spawn nearby or inside your safehouse, that isn't real, can't hurt you but you can't tell until you've been virtually "bitten".
This is evil, I like it
I dont even know if it's possible. But if anyone is looking for ideas, that one is up for grabs
lol
The problem is that you can always GTFO and run out of window, and that can invalidate the entire minigame
run too far and you wake up with nightmare moodle I guess
But in that case you will realize that it was just a nightmare
and the minigame is nil
Plus cant work in MP
or like a real nightmare, you look like you're running but you're going at snails pace
oh it wouldn't fool anyone because you'd have known you put the mod on, but then thats where the psychosis portion would be also be in there
lol, in MP see a friend just swinging away at nothin.
but also the psychosis could randomly add door banging sounds, window breaks, or window smear sounds. and zombie growls behind you
I tried to set spawn using ProfessionFramework but, for some reason they are not working, any suggestions?
ProfessionFramework.addProfession('BeatrixKiddo', {
name = 'Beatrix "The Bride" Kiddo',
icon = "profession_BeatrixKiddoOperative",
cost = 0,
xp = {
},
clothing = {
-- not working with the current version of the Profession Framework on steam. as date 02-JAN-2022
},
traits = {
},
inventory = {
},
spawn = {
["Muldraugh, KY"] = {
{ worldX = 35, worldY = 32, posX = 225, posY = 113 }, -- chapel
{ worldX = 35, worldY = 33, posX = 286, posY = 271 }, -- church
},
["Riverside, KY"] = {
{ worldX = 21, worldY = 17, posX = 279, posY = 272 }, -- church
},
["Rosewood, KY"] = {
{ worldX = 27, worldY = 38, posX = 24, posY = 140 }, -- church
},
["West Point, KY"] = {
{ worldX = 39, worldY = 23, posX = 263, posY = 97 }, -- church
}
}
})
so i made gasoline drinkable, why do i just die instead of peeing fire?
Yeah they don't even appear in the spawn UI ๐ฆ
Is that normal in Solo that Client ticks before Server ?
in case you don't find a solution with the profession framework, you could also set up the spawn points manually. isn't much work. i think you just need a map folder, a folder for each city, a file spawnpoints.lua defining the actual spawn points and a map.info file (which is in fact just a txt).
best thing then is to look at other mods defining new spawn points and check how they realize it.
ah snap...not your fault there, the documentation and examples are apparently wrong (totally my fault)
Nice ๐
Good thing I cloned your repo on my machine otherwise i would still be stuck lol
This Kill Bill mod is taking way more time then expected lol
How can I spawn dead zombies in front of my survivor
?
is there a mod, which can queue up cassettes ?
I couldn't find resources on adding new professions. I haven't tried to look for how to make new weapons
Quick python script that can be useful for some people.
You need to have **Python **installed.
This will generate "ProjectZomboidAutogeneratedWorkspace.code-workspace" file (at the same location of the python file).
This file can be open with Visual studio Code and it will list:
- all the mods you have in the workshop
- lua, luaexamples and scripts folders inside Zomboid installation path
Like that you can quickly browse Vanilla and mods code, do quick search in one place ๐
generate_workspace.py
import os
import glob
import json
## Config
steamapps = "D:/Games/Steam/steamapps/"
workspace_name = "ProjectZomboidAutogeneratedWorkspace"
## Setup
export_paths = {
"folders" : []
}
def add_path(path):
p = {
"path" : os.path.normpath(path)
}
export_paths['folders'].append(p)
def sort_alpha(path):
return os.path.basename(path).lower()
add_path("### ZOMBOID ###")
## Add Zomboid Install Paths
zomboid_root = os.path.join(steamapps, "common/ProjectZomboid/")
zomboid_folders = ["media/lua", "media/luaexamples", "media/scripts"]
for p in zomboid_folders:
add_path(os.path.join(zomboid_root,p))
## Add Mods Paths
add_path("### Mods ### ")
workshop_root = os.path.join(steamapps, "workshop/content/108600/")
mods_paths = [p for p in glob.glob(workshop_root + "/*/mods/*")]
mods_paths.sort(key=sort_alpha)
for p in mods_paths:
add_path(p)
## Serialize to json
file = os.path.join(os.path.dirname(__file__), f'{workspace_name}.code-workspace')
with open(file, 'w') as outfile:
serialize = json.dumps(export_paths, indent=4, sort_keys=True)
outfile.write(serialize)
I thought we use lua not python
Can I use python I kinda get python
It's just a utility script . I'm used to writing python. PZ is only lua and java
Oh I don't really get the python usage then. Idk nvm. Still trying to learn about the basics of modding. I don't know where the info on making new professions are
obviously the best mod would be making the issue in zombieland of needing to go to the bathroom a real issue and make your character need to poop and pee
I was wondering why does the Schizofrenia mod have this check on most of the player edits?
if player:HasTrait("schizophrenia") and player:isLocalPlayer() and player:getPlayerNum() == 0 then
I don't understand why does it need the player num and isLocalPlayer
well player:isLocalPlayer tell its a player on the local machine and player:getPlayerNum() == 0 tell its the first player if you are splitscreen.
if you have a controller plugged in and press A you can run two character
even in an dedicated server
getPlayer() will always return the first local player, getSpecificPlayer(number) will give you the local players from its playerNum
Okay good thank you
this is why we use getSpecificPlayer() with context menu cause player 2 in splitscreen can open a context menu for himself
so after looking into the server source there is no event for when the game actually save serverside.
what i wanted is to save server custom data at the same time the server save itself. So automatically when running the quit command or the save command.
Sorry, maybe a stupid question but what is difference between client, server or shared or the lua folder?
I mean...Let's say I have a lua file named XXX. I've made some trials and independently in which folder I put it, somehow it works...so what's the difference between the folders mentioned above? What affect putting the file in folder or another?
How can I check if a server has sleep enabled?
They work differently for multiplayer. As their names imply files run just for clients, just for servers or both
if not isClient() or getServerOptions():getBoolean("SleepAllowed") then
end
Nevermind, I foudn the boolean
Thanks mate! ๐
Ok, so last thing....If I run my mod only in SP any folder is the same ( Whatever folder I chose the game will somehow read all the files independently to their folder location ) but if instead I want it working in MP too better to use the shared file correct? ( So both the client and the server could use them )
How can I get how many days has a character survived? I see there is pl:getHoursSurvived() but If I understand correctly this does not work if you char dies, right?
If you set it so every time you character will die it will spawn the character starting again from day 0
if pl:getHoursSurvived() == 0
hearse mod 
Oh, good nice
I see there is only :getHoursSurvived , I assume the best way to get the days is diving it by 24, right?
Or is there a day survived function?
try I have not done tests on the used value
I am, I will give info asap
If instead you want the clothes and the inventory cleared at any new spawn use:
pl:clearWornItems();
pl:getInventory():clear();
Sample:
-- if it's a fresh spawn
if pl:getHoursSurvived() == 0 and MXRP_PrisonSpawn.IsPrisonSpawn() then
MXRP_PrisonSpawn.CharacterCreate();
end
end
MXRP_PrisonSpawn.CharacterCreate = function()
local pl = getPlayer();
-- delete the player's starting inventory and clothing
pl:clearWornItems();
pl:getInventory():clear();
( The second part is useful if want that the character will always spawn equipped with a certain inventory and a certain set of worn clothes )
how do I make my mod work server side
thanks
๐
try goggle search you should find what you need ๐
Sorry can't help I play only SP



๐ซ