Decide to compare zoom vs. no zoom because a few people have said B42 looks better with zoom disabled. A quick MyZoomEnabled=not(MyZoomEnabled);getDebugOptions():setBoolean("Visibility.UseNew", MyZoomEnabled);getCore():setOptionZoom(MyZoomEnabled);getCore():zoomOptionChanged(true) later... the difference is much bigger than I expected.
#mod_development
1 messages · Page 298 of 1
I don't think non-zoom rendering that can still zoom is moddable though, even if I was willing to do a java mod - looks like non-zoom completely changes the way things are buffered and I can't find a simple "render with these settings if zoom is disabled"
Is there a way to access fields of a java object? The specific thing I want is: https://demiurgequantified.github.io/ProjectZomboidJavaDocs/zombie/core/Core.html#SafeMode
which is in the Javadocs as static boolean SafeMode and in the java as public static boolean SafeMode, but getCore().SafeMode is nil. I can use the various static methods of GetCore() just fine, like getCore():gotNewBelt() but can't figure out how to access the fields.
declaration: package: zombie.core, class: Core
I know the value inside the java object is not nil, because when java accesses it from within Core to print a debug message it works fine.
anyone knows about the soundmap?
SoundMap = SpearStab SpearHuntingKnifeStab,
i can't found any file about it
Yea
How do I make use of that? local SafeMode = <getCore()>.<SafeMode>?
Or is it that if I have Starlit running getCore().SafeMode will work?
It's this one - thats potent magic
player:isStomping() and player:isShoving()
if you make it a clothing item without a display name you can equip and unequip it in lua without the player being able to touch it
its how makeup works
i cant seem to find the ground model for a beanie
can someone tell me where to find it?
also in vanilla files, the world static models for beanies are not defined and there is nothing in models files
it's not deliberate 😄
If I wanted to increase the max capacity of a tile, such as a campfire.
How would I do that? Can I do that?
My fluid containers mod increases the capacity and thus the weight of things like the cooking pot, causing it to be too large to put in wood stoves and camp fires to boil tainted water
You mean increase how much fuel a campfire can hold? Or the storage capacity (i.e.: inventory size)
storage capacity. Can't put large objects in campfires, barrel stoves, or antique stoves
Cooking pot full of water in my one to one mod weighs 22.5
I can see tile definitiosn like this: ``` // camping_01_5
tile
{
xy = 5,0
BlocksPlacement =
ContainerCapacity = 10
CustomName = Campfire
Material = Stone
ScrapSize = Small
container = campfire
lightB = 15
lightG = 15
lightR = 25
}
but I don't know where defaults are set for container type campfire.
I think you need to use the modding tool to edit tiles, but idk how to do that
Look what I found:
\media\lua\server\Camping\SCampfireGlobalObject.lua
Looks like it checks for :getIsoObject():getSprite():getProperties():Val("ContainerCapacity") and if it doesn't get that, defaults to 10.
jesus, is it black hole water?
haha the cooking pot has a capacity of 10 L and each L of water weighs abouts 1KG
That's half a normal sized fish. 😂
Well it actually weighs the pot weight + water weight so it would actually be over 22.5 I'm pretty sure
If I wanted to, we could make it even worse by trying to guess what the actual weight of the pot while empty is irl
I based it off a 24 QT cooking pot
which is roughly 22.5 liters
math could be wrong, idk
This was done by using a water bottle as a baseline at 1 liter.
Assuming the water bottle is actually a standard 500ml water bottle and your character isn't just chugging liters of water in an hour, I based item fluid values off double their irl values.
Due to the nature of this change, many fluid containers will hold much more than their vanilla counterparts.
An extreme example is the cooking pot, holding a whopping 22.5 liters irl and 45 fluid units in game.
This is somewhat balanced due to how fluid weight works, but definitely makes stocking up on water way easier!
Changed it so the fluid values are edited using Lua instead of replacing the items, meaning this should be compatible with other mods that affect the items!
This workshop post includes two separate mods.
The original fluid changes where I value things off 2 times their irl value for game balance. -GB
And a new version where i value things directly off their irl value, regardless of game balance. -OTO
It's a mod I uploaded awhile ago
Think I could target this with a doparam?
Or would I need to replace the object lua
Probably no to DoParam() - that is a method for items
I think world items don't inherit from items at all.
Add a postfix patch to SCampfireGlobalObject:addContainer()
so it runs the original code, then your code says "now set the capacity to 50"
Trickiest part is dealing with all the "self" $#@^ lua does to pretend it's object oriented.
Behold the forbidden knowledge that those in power would keep from you!
Or just copy the entire function, put it in your mod to overwrite the original, change the 10 to a 50 and accept if they ever update the way campfire containers get made you'll have to update the mod.
...which feels pretty low-risk to be honest.
Check this #mod_development message, overwriting that function to change the number won't even work because it will take its capacity from the sprite properties
How would I know what sprites to change?
In debug mode press F2 > click on a campfire and on the left panel you can see the objects on that square. There you can find the campfire sprite name too.
You can also find the campfire sprites in brush tools. In Debug Menu > Cheats > Brush Tool, then right click on the ground > Brush Tool Manager > Choose tile and in the search entry box search for camping. From that panel choose the campfire sprite and place it on the ground.
the code I linked, would look something like this for your case:
Events.OnLoadedTileDefinitions.Add(function(manager)
local sprites = {
"camping_01_4", "camping_01_5", "camping_01_6"
}
for _, sprite in ipairs(sprites) do
local props = manager:getSprite(sprite):getProperties();
props:Set("ContainerCapacity", "100", false);
props:CreateKeySet();
end
end)
How do you resolve background/text disappearing when using the prerender() method?
call the parent prerender first:
local MyNewUI = ISCollapsableWindowJoypad:derive("MyNewUI");
function MyNewUI:prerender()
ISCollapsableWindowJoypad.prerender(self);
--- custom prerender code
end
thanks 🙂
Question about these lua events https://pzwiki.net/wiki/Lua_event. It looks like most of these get handled client side..? Or should I be able to handle these from a server side script (media/lua/server) too?
the client/shared/server is more for organization than functionaliy
#mod_development message
[1:24 PM]DrStalker: Does using the client/server/shared folders actually change anything, or is it a best-practice to keep code organized?
[1:24 PM]albion: mostly the latter, but it does have a couple effects
[1:24 PM]DrStalker: hahahahah of course there are some special cases
[1:25 PM]albion: the client folder doesn't load on the server (but the server folder does load on the client) and they load in separate stages
[1:25 PM]albion: all shared files -> all client files -> all server files
[1:25 PM]DrStalker: translation might be special too?
[1:25 PM]albion: translation is just a hardcoded location, it has to be in shared, it's not even lua
[1:25 PM]DrStalker: Since you use the same filenames there, but it doesn't overwrite existing translation files.
[1:25 PM]albion: it shouldn't even be in there but i'm guessing from the syntax it used to be lua or something and that was the simplest way to convert it over to their new system
[1:26 PM]DrStalker: nods just a bit more technical debt.
[1:26 PM]albion: also, server files don't load on the main menu, they only load when you join a server or start a singleplayer game (the only interesting consequence of this that i've found is OnGameBoot happens before server files load most of the time)
So if you attach code to an event, it will run on either teh server or client depending on what the event is.
Am I able to play part of an animation? I have a TimedAction and have a animation declared and played within it but can I play the last half of it?
Nop
It's the full animation, you can't chose a specific point in the animation
Yes, and no
Some are both
Dang, can't avoid doing some animating at some point then 😂
Some are only client
Thankfully your life might be made easier now, as someone found a solution to retrieving the vanilla animations in a format you can edit in Blender
Has there been a fix for the issue with animsets that people were struggling with?
no

There's a tag for being able to use a crafting recipe in darkness right? feeling lazy so I'm hoping I can avoid having to search for it myself
alright never mind it took like 2 seconds to find
Good afternoon. I'm trying to make a mod, that by typing "/westpoint" in the chat, the character can be teleported to that city. But when I try to use the command, it doesn't recognize it. Is there a guide or mod that performs a similar action?
local teleportLocations = {
westpoint = {x = 11700, y = 7000, z = 0},
muldraugh = {x = 10600, y = 10400, z = 0},
riverside = {x = 6200, y = 5300, z = 0},
rosewood = {x = 8100, y = 11700, z = 0}
}
local function teleportPlayer(player, location)
if not teleportLocations[location] then
return
end
local coords = teleportLocations[location]
player:setX(coords.x)
player:setY(coords.y)
player:setZ(coords.z)
end
Events.OnClientCommand.Add(function(module, command, player, args)
if module == "patagoniateleport" then
if command == "teleport" then
local location = args[1]
teleportPlayer(player, location)
end
end
end)
That is more or less the code I am using, but as I mentioned, it does not work for me, since it does not recognize the command.
the workshop is gone dang..
lmao what is happening
no collections either
Peace happened, no more "when are you going to update your mod to b42" comments lol
Shouldn't, the workshop entries still exist
they just, don't show on the main workshop page
that's good
genuinely in that minute I thought about it and started thinking "shit it might"
you can. if you have your collections or mods on your profile showcase you can open it
Those seem promising, but the player var appears to be null during OnPlayerAttackFinished. Is there another way to hook in to add an effect to a stomp (but not a shove)? I guess I could check isStomping every tick but that seems like a waste
you can do it in OnWeaponHitXP
it triggers on shoving and stomping
i think thats the event name but its from memory so it might be wrong
does that only trigger when hitting an enemy? i'd like to catch "empty" stomps too (i.e. no enemy hit or targeted)
you might just have to check it in OnPlayerUpdate then
i think just doing a small check like that is fine
ok, i'll give that a go. thanks for the help!
ok i must be doing something wrong...player is null in OnPlayerUpdate as well
wtf lol
print("isStomping "..player:isStomping())
end
Events.OnPlayerUpdate.Add(OnPlayerUpdate)```
that's it...but i get an exception right away and player is null in the debugger
what does the error say?
it was empty before let me check
oh it's subtly different than before
concat error this time
i yearn for automatic coersion from bool to string
i think i was misunderstanding the debugger before. going to re-try those other hooks.
You'd think that given how casual lua is about variable types it would support that.
print("isStomping " .. (player:isStomping() and "true" or "false")) is ugly.
especially since print(player:isStomping()) works.
such is the price we pay as modders
Could always throw it in tostring or string.format (although in this case since it's running on player update the and/or is ideal... although this is clearly a debug statement so that doesn't matter all that much anyhow)
I'll put in a feature request to move everything to C#. 😂
i do love me some c#
I'd be happy with Typescript for mods ngl (without having to go through asledgehammer/PipeWrench)
Learning C# reflection was painful, but then it clicks and it's suddenly easy to manipulate all the private and obfuscated things.
PZ Bedrock
With paid mod marketplace (run like a cartel, I'm looking at you microsoft 😒 )
But it's Zomboid so "Can't work on my mod, I'm not able to find a sledgehammer download linkanywhere"
"Must be with the documentation on the Generator function"
just use tostring(player:isStomping()) lol
that does make more sense lol
But I first did this as "why doens't lua have a ternary operator when it has so many other janky hacks" and it just kinda stuck for me
B42: adds horses
Modders: Horse armor mod $5.99!
zomboidcoins
Only for MS approved™️ modders and their respective overlord
And F U if you just want to make mods for free or fun 😄
Who else remembers "$2.50 for cosmetic horse armor is going to turn into a slippery slope of holding back content to sell it for extra money"?
Because we were right.
(Not for Zomboid, but for AAA games)
🫴 💸
unfortunately OnWeaponSwing doesn't fire for shoves and stomps, and both isStomp and isShove return false during OnPlayerAttackFinished
I'll take TIS being slow over them rushing stuff so they can sell the next DLC
if i set ConditionMax = 0 will something auto break when created? and if i set a lua OnBreak command to put something on the floor when it breaks should i put the spawned in item in HeadHandler or HandleHandler i think i know this one but i just want to make sure
I know its an odd question...
idk the bedrock marketplace and bethesda paid mods are kind of cringe but at least modders are getting paid for it i guess
where should i be looking to get all zombies within a certain distance of the player? it's a relatively short distance if it matters, a few squares or so
Maybe a silly question, but we have a custom mod on our server that does a lot of utility functions. One feature we'd like for it to accomplish is overriding loot distribution for some of the other mods we load in. For example, Brita's armor. From my understanding, we just need to duplicate the same files, in the same path in our mod, with the distributions set to zero. We've done this, but the items still spawn. Is this possible? (Our mod is loaded after Britas)
i tested it and now i need to find out how to have a item degrade by just existing
Because ConditionMax = 0 dont worky
would OnItemFound work?
leme see
i feel like there's also an item def property for an OnCreated hook
print("isStomping "..tostring(player:isStomping()))
If you add the same file in your mod, you just double the loot.
Yeah, but with all the distributions set to 0
I was under the impression that it overwrote the original file when it is loaded in.
You still just add new distributions.
Unless the file author adds compatibility with its own copies or duplicates within the file itself.
The better way is to work with tables I guess.
if your mod has a file with exactly the same path and comes later in the load order, it will run instead of the original
it wouldn't be necessary to change the numbers to zero in that case, you could just make the file blank entirely
This is how I understood the game handles it and why it's important to prefix your files with something unique so that it doesn't conflict with anything else. I tried both with a blank file and with distributions set to zero but the loot still spawns. I'm guessing it's something on my end that I'm goofing on haha
You are right.
Hi, I am trying to make a damage multiplier for certain melee weapons and testing, only knife and spear work but not for one and two handed weapons such as fire axe or hand axe, etc.
onehanded and twohanded are correct?
Let's assume, purely hypothetically, that you have different values in the table.
modData["WeaponDamageMultipliers"] = {
knife = 6, --knife
onehanded = 7, -- One HandWeapon?
twohanded = 8, -- Two HandWeapon?
spear = 9 -- Spears
}
And let's say there are two spears in the game. One is two-handed and the other is one-handed. What multiplier should be used?
Also there may be two-handed knife. Why not?
And even there are only one-handed knifes, you still have 2 values: 6 and 7. Which one should be chosen?
i'd infer from this that the knife/spear entries are meant to override the other ones
otherwise it doesn't make sense for them to exist, since every knife/spear is either one or two handed
So I'm using only 2 values in the table, because knife and spear are one and two handed?
°
I'm so confused jajaj
You are using getWeaponType, and it returns a single value anyway.
spear/knife/other and onehanded/twohanded are two different pieces of info about a weapon.
Hmmm ok ok i think i understand.
is there a way to have a item's condition degrade by just existing?
Yes, in inventory
I'd use a workaround by adding modData field like "last_updated". So if an item is just looted and there is such a field, you can just update it like
(delta_degrade * years_passed) 🙂
I appreciate the consideration on if I wanted the item to be generated naturally in a way that makes it world sit around for a bit before a player picks it up, however, the items I'm making are debug items that'll use the build 42 feature of items breaking into other items to make it when an item would normally be inserted directly into your inventory, it gets put on the ground instead. If you would like an explanation of what I'm trying to do with this item then I can tell you
I guess "degrade" (a kind of logic/mechanics) and "at a certain point in time to put it on the ground" (a kind of logic/mechanics too) are different. So they should be considered separately, even though they may be related.
basically upon generating ither through foraging or crafting, it immediately 'breaks' into what the player found/made, just not into their inv, as someone should not be able to hold/move a entire mineshaft or the undergreound recourses befoer they'er mined
i know that code is crazy but the alternatives are beyond my skill, or also crazy
i say immediately 'breaks' because its durability is 1
Had a question about what is required to be weighted. I did a beanie mod where the model didn’t have to be weighted to the body or anything, but my buddy did a vest and a bag mod where both required weights. What clothing items are required to be weighted?
anything that needs to bend to avoid clipping with the body
the straps of bags need to be weighted otherwise they'd just clip through the shoulders when they move
anything thats just on one bodypart can be static like hats
What about shoes
The shoes mod I did just reskinned the feet in the character model lol so I didn’t need it but wasn’t sure if real shoes would need it
modelled shoes would have to be weighted because they need to be on both feet but static clothes can only be parented to one bone
quick question, that lua file can i see ConditionLowerChanceOneIn or whatever is responsible for Condition degradation in
I've been searching for longer than I've asked the question, and still haven't found it. So if any of you know @ me.
I managed to modify it and have it work correctly, thank you so much.

Maybe using the drain mechanic, spending on exactly what you are after.
Actually that won't do the immediate break you're after
AFAIK there's no easy way, you have to iterate through the nearby squares calling square:getZombieCount()
If I use it onitemfound I think I can remove one durability with that but I need to know how to use that Lua functionality to remove one durability. I can't find the code on removing durability anywhere in the files. Thus, I can't figure out what it looks like and how to use it
But an item may be far away.
OnItemFound happens before there is an item object. It's for the foraging system, when it waves a little "something here!" flag for you to walk over right click-> pick up/discard/etc
Sorry, I mixed topics. I was talking about "degrade" mechanics of an item somewhere in the world.
Well for the foraging items, I think that might work, and if there is some sort of onitemcreate then I might use that instead.
There is, per object
{
item NepDIYBSToolsSchematicBook
{
DisplayName = DIY Blacksmithing Notes,
DisplayCategory = SkillBook,
Weight = 0.1,
Type = Literature,
Icon = Book8,
OnCreate = NepDIYSpecialLootSpawns.NepDIYOnOnCreateBSToolsSchematic,
NumberOfPages = 220,
StaticModel = BookBrown,
WorldStaticModel = BookBrown_Ground,
Tags = DIYSchematic,
}```
that will call NepDIYSpecialLootSpawns.NepDIYOnOnCreateBSToolsSchematic(item) when the item is created.
So your onCreate function could look like
item:destroy()
x,y,z=player location
spawnOnGround ("Other Item",x,y,z)
end```
(but with the actual function names)
To be multiplayer safe you'd have to figure out which player is holding the item, I think item:getContainer():getParent():getUsingPlayer will get that for you but getPlayer() will do for testing.
https://steamcommunity.com/sharedfiles/filedetails/?id=3399569763
Added a patch mod to increase the storage size of campfires and stoves to 50.```
I’m doing a toy mod and am referencing structures from a toy plushie mod and a toy dinosaur mod. I noticed both of them have a line in each item that says “scale = 0.3” or whatever number. I made my models to be the correct size already and they don’t need to be scaled. Do I need to write “scale=1” or just omit the scale line altogether?
scale line isn't needed, it just lets you rescale the model without editing the model directly
Gotcha I didn’t realize that lol I’ve been resizing them all in blender manually 😂😂
Hey for your use specifically, you could make small and large versions of the toys this way!
:P
I recently became a dad and am basically making baby stuff in game and just calling them “toys”. More so just to decorate. Made a crib and a baby and some baby Nike shoes and stuff just to decorate. They’re not functional or anything but they’ll look cool 😂
Probably will just spawn them in or make a really easy recipe for them
Can you make a zombie baby?
I mean you can add skins to zombies n' stuff but idk how doable a child zombie would be due to hitboxes n' animations
That's a nice idea
Don't add actual babies to the game, but add the various items that exist around babies.
...because zombie babies are terrifying, but a baby's bottle full of whiskey is just right for exploring the apocalypse.
...
Why not? I just have a simple baby model to go in the crib
I am glad it will be a mod and not part of the base game!
A prop baby? that's fine, it's zombie babies I don't want to deal with.
Oh gotcha yeah it’s just a prop so it doesn’t look empty
(Also, my personl preferences shouldn't stop you from making a mod.)
I was just making sure it wasn’t like an unwritten rule or something 😂
I think the baby zombie my friend is doing is also just a prop tbh. We, or at least I, am nowhere near good enough at this stuff to skin a zombie
I think the unwritten rules are "mods involving sex go to Lover's Lab and not Steam, mods involving sex and children are 100% not acceptable in any way"
...I'm probably going to regret this, but I've not looked into the state of lewd Zomboid modding for years.
The fact that that’s a thing 😂
I’m rlly just decorating at this point 😂 I got the collectible car mod and went to a toy store and got like 100 cars and they’re just laid out on my floor 😂
" ZomboWin Being Female (ZWBF) is a mod that connects some other mods to ensure a more in depth play for female characters. With this mod you now will have a menstrual cycle and the possibility of being pregnant by zombies 😨. "
BY ZOMBIES???
I think there's a mod that replaces drag down and kill with drag down and... not kill.
But they don't have clear descriptions of game mechanics up front and I'm not going looking for more details or trying this out.
I can see the appeal of lewd mods for a lot of games, but not Zomboid. It's so very unsexy.

I am not a modder but I have an idea. It might be dumb but I am throwing it out there. I think it would be cool to have a Call of Duty style prestige system for your skills. Obviously the prestige icon system of CoD does not apply here but for like say for first prestige of strength, P1 level 1 would be like 1.1x whatever buffs you get from non-prestiged level 1. P2L2 would be 1.2x and so on and so forth. Just a thought, would be cool to see!
How does the CoD prestige system work?
To break it down for modding purposes:
How do you earn prestige levels?
What do prestige levels do?
Also, all modders are former not-modders. You start making a simple mod to tweak something, turns out you have fun modding, and then you're neck-deep in someone else's code trying to make it do something different without making the entire thing explode in a flaming mess.
In COD it’s like for example say max level is level 100. Once you get to level 100, you can “prestige” and start back over at level 1. But you’ll be first prestige level 1. And then u make it to 100 again and then can start over and be second prestige level 1. And work up again and again. 15th prestige was master or max prestige I think
I haven’t played cod since black ops 2 tho
So I assume he’s saying like if you reach skill level 10 you can prestige and start over but you’ll have an extra multiplier for being prestiged
This would make the xp progression exponential after multiple prestiges however so I feel like it should have some other reward for prestiging.
Because if you got more xp boosts every prestige, you would level through levels 1 through 10 faster and faster every time u prestige
I’ve got a question. I’ve noticed some mods that the texture png is 512x512, but sometimes it’s smaller like 256x256 or 128x128. Does the size matter?
Heh heh
Such a weird idea for a game like zomboid - grinding a skill to 10 is hard (vanilla, obviously with mods/sandbox settings this can be changed) and then suddenly... I forget everything and have to start over with a small inherent bonus?
I think you'd be better off getting to ten, then you can go directly into unlocking very XP-intensive prestige levels.
so short blunt 9, short blunt 10, short blunt 10 prestige 1, short blunt 10 prestige 2 etc.
But resetting a skill to zero is possible.
Harder would be choosing what the prestige levels do, and limiting to things that don't happen deep in the java code. Some things you could do by modifiying a weapon stats on equip to get the base stat for weapon & add prestige modifier & then set the weapon stat.
Idea: you have some sort of meta-progression and if you die and make a new character in the same world they benefit from that.
is there like, a guide for making armor mods
because i wanted to make a cool ass armored jacket but got told about the harsh reality i was gonna face if i kept at it the way i was
but i’m really unsure how to move forwards in a way that’ll work
what problems are you expecting?
they mentioned smth about how the texture system is ass (meaning a design like that will probably struggle in the hands of a dipshit like me) and smth about vertices caps
see i’m tryna compress an armor set into four pieces to make it simpler, as i’ve looked at the complex ones like scrap armor and have concluded i’d go insane setting all that up
unless i'm misunderstanding there is no cap to vertices that you could ever reach
idrk either, i’m not experienced in this part of modding
i’m literally kitbashing an armor set
anyone has any idea why when I export a vehicle model with animations, the doors either spawn in the middle of the car, or if I export with better fbx I get this error?
all that? vanilla with minor edits by pulling on polygons
if you're using multiple textures in your model here (it looks like you're using multiple vanilla textures) that will be a problem, in pz models can only have one texture
trying to have the player equip a holster that ive added but it goes to the hand instead, how stupid am i?
elseif (professionItem:IsClothing() or professionItem:IsInventoryContainer()) and (professionItem:getBodyLocation() or professionItem:canBeEquipped()) then
ISWorldObjectContextMenu.equip(player, professionItem:getBodyLocation(), professionItem, false);
yeah that’s what i started thinking of
and i doubt i’ll be able to kitbash a good texture with vanilla pieces like this
buddy said the UV would have to be perfect on it
which sucks cuz damn, it looked like a cool idea, using the wires to have like, segmented limbs with protection secured by it
i’m contemplating if it would be better to just draw the armor onto the texture
but part of me is also really wanting to make an armored jacket that’s visibly bulked up a little bit
i’ve been inspired by scrap armor and the FORGE set from Abiotic Factor
and that’s probably also why i wanna make it as 3D as possible, to be up to par with my inspirations
yeah lmao, it was my main set for so long
lemme pull up the wip helmet
couldnt find the hard hat texture :(
i stuck with the composer set for the movement... honestly putting some abiotic stuff in zomboid would be cute
media/textures/Clothes/Hat
HardHat
tryna make it look enclosed with sheets, just can't get it to look right though
i should never question myself ever again
it just needs a definite shape
the best part of its nature as improvised armor is that being hacky looking is the name of the game
i'm kinda happy with it, i think
I want to create a mod that allows me to say take jewelry and melt it into gold bars using a craftable mold. Kinda like the "Workshop" mod by DJ with the metal molds being used a a reusuable tool, are there any good videos or documents out there to help me out?
Check the Modding page on the wiki
Have a look at making a recipe to do it, but worth mentioning B42 crafting is still a work in progress and I expect smelting may get some enhancements... possibly even melting different metals down to make pieces of gold/silver instead of "we only smelt iron"
Considering there are gold and silver masks in the crafting menus, i suspect you are right
The system for melting glass is closest to what you want I think. If jewelry is already tagged to say hasGold/hasSilver its probably easy to do.
I hope they change from "a crucible of molten glass is an item that never cools down" to some sort of fluid system approach that includes cooling into a chunk of solid <stuff> of appropriate weight.
I've made a clothing mod prior, and I've found the models for the new ingots etc I basically want to create a gold ingot. I've ripped this straight from the blacksmithing section from scripts and I've put my texture and the model into my mod folder label as "Ingot_gold". Eventually I will use something else as a crafting recipe but what would be the next step in actually putting this to action?
{
craftRecipe Forge_Ingot_gold_From_Iron_Chunk
{
time = 10,
SkillRequired = Blacksmith:0,
timedAction = Making,
tags = PrimitiveForge,
category = Blacksmithing,
inputs
{
item 1 tags[Charcoal],
item 4 [Base.IronChunk],
item 1 tags[Hammer;ClubHammer] mode:keep flags[Prop1],
item 1 tags[Tongs] mode:keep flags[Prop2],
}
outputs
{
item 1 Ingot_gold,
}
} ```
The inputs.
That recipe turns 4 iron chunks into a gold bar.
That's probably not what you want!
Have a look at how smelting does item selection, and you might find that none of the existing items have useful tags in which case you'd need to add the tags
No not at all, I'm getting back into modding I just wanted to test this out to see if what I had so far ACTUALLY worked. I want to smelt rings and stuff eventually as the inputs
Funny enough I missed the gold ingot texture, its in but doesn't look like its smeltable yet? (I think)
Morning all, I have a question, im trying to make a recipe use the onCreate function to add an item to a player inventory, ive confirmed the function ive added is being called but it wont add the item. whats wrong with:
function Recipe.OnCreate.DoThing(items, result, player)
player:getInventory():AddItem(Base.Money);
end
Build 42 btw
this worked in b41
the signature of OnCreate functions has changed:
ahhh thank you, all the searches for oncreate here are showing build 41 type code, assumed it hadnt changed but people still making 41 mods I guess.
where is that page btw?
is that the pzwiki?
it's something i host https://github.com/demiurgeQuantified/PZEventDoc/blob/develop/docs/Events.md
oh it is the 1 result in google 😄
function Recipe.OnCreate.DoThing(recipeData, character)
character:getInventory():AddItem(Base.Money);
end
still doesnt work, am i minsunderstanding, the recipe is deffo getting inside this function, just refuses to add the item.
Recipe is just doing:
OnCreate = Recipe.OnCreate.DoThing,
getInv still exists on the character I checked that
you mean getInventory? xD
yeah was just lazy in typing it here
it all looks right, it just wont spawn the item
no logs?
if i do something silly in there, debg stops inside the function, but no, nothing in the logs for the above code
i just get this:
[30-01-25 09:17:25.676] LOG : Lua f:724, t:1738228645676> =========== starting craft ===========.
[30-01-25 09:17:36.093] LOG : Lua f:1350, t:1738228656093> ISInventoryPaneContextMenu.OnNewCraftComplete -> Craft action completed.
what exactly is Recipe.OnCreate? i dont find it
How about
player:getInventory():AddItem(Base.Money);
?
thats what I had before
but the params passed to this function changed, as above
so ive updated it
How's about self.character?
was going to try that, saw a post on here with that in, but wasnt sure it was 41 or 42
this was what was done in 41, not sure if thats changed in 42
Some of my lua uses self.character and works alright
I saw someone mention its not performant, not that I think it matter in my instance
ill try it, give me 2 mins
function Recipe.OnCreate.DoThing(recipeData, character)
self.character:getInventory():AddItem(Base.Money);
end
also does nothing
Recipe:
craftRecipe Do Thing
{
timedAction = Making,
Time = 30,
Tags = InHandCraft;CanBeDoneInDark,
category = Survivalist,
OnCreate = Recipe.OnCreate.DoThing,
inputs
{
item 1 [Base.Money],
}
outputs
{
item 1 Base.Money,
}
}
obviously the items are nonsense here im just trying to prove the chain works
Can see build 42 recipes still use onCreate the way I am so its not that side, its something in the addItem bit for sure
found the recipe lua in core:
function Recipe.OnCreate.OpenWaterCan(craftRecipeData, character)
if not character then return end
local item = character:getInventory():AddItem("Base.WaterRationCanEmpty")
-- local item = character:getInventory():AddItem("Base.TinCanEmpty")
-- item:setTexture(getTexture("Item_CannedWater_Open"))
-- item:setWorldStaticModel("WaterRationCan_Open")
-- item:setStaticModel("WaterRationCan_Open")
-- item:getFluidContainer():addFluid(FluidType.Water, 0.3)
item:getFluidContainer():addFluid(FluidType.Water, 0.3)
end
the only thing i can see is i havent wrapped the item in a string...
Im trying to add a duty belt to the police zombies in the clothing.xml but when I tried doing everything and making sure everything is working properly, I tested it and it somehow did not spawn on them. If anyone could help i'll post the clothing.xml and fileguidtable.xml right here
add a print statement to confirm if you're being passed a nil value for character
And if not nil, print(character) and see if it's being silly and passing the player number instead of the player object or some such foolishness.
hmm nothing is printing at all in that function, wtf
yet if i put dodgy code in there it breaks on that line in debug
but printing a string doesnt even come out
ive compared it to core recipes that do the same thing, they are the same, I cant see a difference
so is there a way to add fluids to recipe output?
using onCreate you can do stuff like:
bucket:getFluidContainer():adjustSpecificFluidAmount(Fluid.TaintedWater, (taintedAmount - amount));
bucket:getFluidContainer():addFluid(Fluid.Water, amount);
ive also seen a simple recipe output using something like:
fluid 10.0 [Water;TaintedWater] as an input/output
No there is something fundementally broken here, I copied a core recipe and oncreate function and it still doesnt work, lua is in 42/media/lua/server folder as per core as well
ok removing everything and only having this 1 recipe now works, so maybe a syntax error thats not logging somewhere else.....time to put code back until it dies
solved it, it was a typo
parsing errors show up in the text log file but not in the in-game error window
in the debug log here: C:\Users\yourname\Zomboid\Logs ?
well ill be.....yep its there, so it wasnt even loading the file in due to a parse error further down
I assumed the recipe name would be in the log, should have looked for the filename, my bad, lesson learned
can someone take a look at my beanie hat spawn distribution? I'm trying to balance the spawn rates (default values since this can be adjusted using sandbox options) so they make sense, to make sure beanies don’t appear too frequently or in unrealistic locations. just want to know if its good enough or need adjustment
require "Items/ProceduralDistributions"
local function addSandboxLoot()
local SpawnRateBeanies = SandboxVars.MetroBeanie.SpawnRateBeanies;
if (SpawnRateBeanies == 6) then
SpawnRateBeanies = 0;
end
local itemsToAdd = {
"MetroBeanie.BurntSunset",
"MetroBeanie.GlitchGrid",
"MetroBeanie.InfernoLuxe",
"MetroBeanie.MidnightInferno",
"MetroBeanie.PhantomGrid",
"MetroBeanie.ShadowBlaze",
"MetroBeanie.ToxicHaze",
"MetroBeanie.VoltageSurge",
}
local locations = {
"ZippeeClothing",
"CampingStoreClothes",
"SportStoreAccessories",
"BedroomDresser",
"BedroomDresserRedneck",
"BedroomSidetable",
"BedroomSidetableRedneck",
"LivingRoomShelf",
"LivingRoomShelfRedneck",
"LivingRoomSideTable",
"LivingRoomSideTableRedneck",
"WardrobeGeneric",
"WardrobeRedneck",
"ClosetShelfGeneric",
"ToolStoreOutfit",
"GasStoreSpecial",
"WildWestClothing",
"CarSupplyTools",
"LibraryPersonal",
"SchoolLockers",
"ClassroomMisc",
"ClassroomSecondaryMisc",
"UniversitySideTable",
"UniversityWardrobe",
"GymLockers",
"BandPracticeClothing",
"MedicalStorageOutfit",
"MedicalClinicOutfit",
"MorgueOutfit",
"DrugLabOutfit",
"PoliceLockers",
"FireDeptLockers",
"SecurityLockers",
}
local multiplier = {
-- Primary sources (Very High Probability)
ZippeeClothing = 1.5,
CampingStoreClothes = 1.2,
SportStoreAccessories = 1.0,
BedroomDresser = 1.1,
BedroomDresserRedneck = 1.1,
BedroomSidetable = 0.8,
BedroomSidetableRedneck = 0.8,
LivingRoomShelf = 0.6,
LivingRoomShelfRedneck = 0.6,
LivingRoomSideTable = 0.5,
LivingRoomSideTableRedneck = 0.5,
WardrobeGeneric = 1.2,
WardrobeRedneck = 1.2,
ClosetShelfGeneric = 1.0,
-- Common locations (High Probability)
ToolStoreOutfit = 0.5,
GasStoreSpecial = 0.3,
WildWestClothing = 0.7,
-- Less likely locations (Medium Probability)
CarSupplyTools = 0.3,
LibraryPersonal = 0.2,
SchoolLockers = 0.6,
ClassroomMisc = 0.4,
ClassroomSecondaryMisc = 0.3,
UniversitySideTable = 0.4,
UniversityWardrobe = 0.8,
GymLockers = 0.5,
-- Rare locations (Low Probability)
BandPracticeClothing = 0.5,
MedicalStorageOutfit = 0.3,
MedicalClinicOutfit = 0.6,
MorgueOutfit = 0.2,
DrugLabOutfit = 0.3,
PoliceLockers = 0.4,
FireDeptLockers = 0.5,
SecurityLockers = 0.4,
}
for _, location in ipairs(locations) do
local locMultiplier = multiplier[location]
ProceduralDistributions["list"][location].items = {}
for i=1, #itemsToAdd do
table.insert(ProceduralDistributions["list"][location].items, itemsToAdd[i]);
table.insert(ProceduralDistributions["list"][location].items, SpawnRateBeanies * locMultiplier)
end
end
ItemPickerJava.doParse = true
end
local function parseTables()
if ItemPickerJava.doParse then
ItemPickerJava.Parse()
ItemPickerJava.doParse = nil
end
end
Events.OnInitGlobalModData.Add(addSandboxLoot)
Events.OnLoadedMapZones.Add(parseTables)
doesnt this just remove every other item from spawning in these tables
Is it possible to add tents right now?
I don't think TileZed is for B42 rn
So I'll have to mess with the tiles manually.
dang you're right yea it wipes the dist list on that loc and replace with only the beanies...
Ill change it and append the beanies while keeping existing loots, thanks!
I highly recommend using VS Code and Umbrella - VS Code will ensure that your LUA syntax is correct, and Umbrella is a plugin that knows all of the Zomboid API and helsp you figure out when you typosed a method or other silly things. It also tries to figure out object type and helps out a lot there too.
Probably gonna happen considering the silver/gold cups n' stuff
Saves me so much time on stupid typos.
I feel like silver/gold will have more purpose when npcs are added
GitHub
A collection of LuaCATS typings for Project Zomboid's API - asledgehammer/Umbrella
cuz if I remember correctly, there's gonna be like gifting npcs items to make them wanna have a baby with you or something.
So silver/gold n' other valuables seem like they would make sense, if not for baby making then for currency perhaps
They have a AlwaysWelcomeGift property on items, so it seems likely.
Everyone loves 9mm ammo.
...that was a joke but I think that's correct.
The flag is only used in a few item files: carpentry, medical, tailoring and ammo.
NPC dying of thirst and hunger, their base full of guns and ammunition that they're trying to trade for life support supplies.
gets handed 9mm box
+Reputation
Collapses
trader takes the 9mm box back
Put it in media/textures and name the 32x32 png like so
Item_YourItemName.png
And in the item's script have it as
Icon = YourItemName,
and add Icon = X
in the item script
sometimes there is a syntax error or whatever it's called where u forget a , or misspell or the name in the script is different from the name in the texture file.
if it's B42 its Icon =
if its B41 it's Icon: , I think
Yeah thirteen attempts to get my own advice right lol
like this?
You're missing a , after DutyBeltPolice
In case you need to link a guide for it
oh yea I forgot
thanks both of you for helping out
Is there a way to make it so wearing sneakers/boots/dress shoes gives you discomfort when not wearing socks?
And in addition to that, discomfort if not wearing the correct socks?
Like wearing short socks would be fine with sneakers, but to not be uncomfortable in military boots you would need heavy socks?
I need help making a simple script for a mod.
I want to make it so that when an item had the tag “splint” it essentially works in the medical tab exactly like a splint would.
Could someone help me with that?
If you're looking to modify or extend existing vanilla functionality, a good first step is searching the Lua source for code related to it. I'd recommend checking out ISHealthPanel & looking for code related to splints
Hey modders funkers,
modding for b41 for the moment, (but you can answer for both)
I ran into this: I managed to import and makes my tiles appear and spawnable brushtool I made the items and recipes using vanilla tiles so my code there is solid, only got issues with new tiles and a couple other points to address.
I tried both
item NewItem { }
and
item Mov_NewItem { }
I can't pick-up my tiles
(I used to be able with the same itemscripts but using vanilla tiles), the animation works, the time to pickup is progressing, but nothing adds to inventory or remove the world tile after the progress. no errors.
The tooltip of the world tile: weight shows normal values: the ones I've set in .tiles. + there's a nice render of the tile in mini-avatar-icon-thumb.
am i missing something ?
other points: Edit: checking answers posted earlier.
my new tiles/moveables inventory icon is
nil ? (using .png names in ui/ or textures/)
or invisible (using "default" as a value)
How to link a fonctional icon ?
EDIT: OK I read a post from 2h ago , gonna try about icon.
ive got a question. I have been able to get the hammering sound to work for crafting my rocking horse, but the animation is still the same as like ripping clothes. how and where would i add that into this recipe so that i can have a hammering animation? here is the script:
module BabyItems
{
imports
{
Base
}
recipe Rocking Horse
{
Nails=5,
Plank=5,
keep [Recipe.GetItemTypes.Hammer],
Result:RockingHorse,
Sound:Hammering,
Time:100.0,
Category:AcidItems,
}
}
Where's the weapon logic that makes it so stomping without shoes causes foot damage/pain ?
I wanna add onto this to maybe make it so it also applies to not wearing socks with certain shoe types
Hi, i've a problem testing my mod, i cant' find the mod to enable it inside the game
Check pins
C:\Users\User\Zomboid\Workshop\ ``\Contents\mods\modname
You work with weapon mods, know where the pushing/stomping logic is stored? I wanna make your feet hurt from wearing boots and no socks when stomping n' stuff
Nah, I'd guess that's on java side
Tragedy
I'm looking at "a stomp nerf mod" and it ports over to build 42 with zero issues.
I wonder if I could jam in a check for socks and make the player get scratched/pain from stomping without socks
Cuz I mean, it already does majority of the checking for me.
The shoes n' stuff only take damage if the attack hits a zombie on the ground, no random durability damage from shoving a zombie
So theoretically I would just need to copy the check and convert it to check for socks, and if none are present, have it apply pain/damage to your feet based on rng
how do i add a vanilla animation to my crafting recipe? trying to add the hammering animation to the recipe. i got the hammering sound to work, but my player just does the ripped sheets animation
maybe?
timedAction = MakingHammer_Surface,
this would just go in the recipe?
i cant find a single line of animations in any recipe in the vanilla files which confuses me. like building or upgrading a wall does this animation, but i can't find the animation or a call to the animation anywhere in those scripts
That would be
timedAction = BuildWallHammer,
in the script.txt recipe {} not recipeCode.lua (and b41):
AnimNode:Welding, note1 -> like welding picking apple hand up high
AnimNode:Dismantle, -> mumbling stuff at waist level.
AnimNode:Hammer, -> look for it not sure the term.
add this to have an item in hands:
prop1: item, -> default primary
prop2: item2, -> the other hand
note1: maybe AnimNode:Welding doesn't exist but the anim auto select if prop1 (primary) is used and has an animation. (prop1:Blowtorch)
where are you seeing this? im using studiovisualcode and cant find anything like this in the entire game files
I've been trying to figure out for a long time how to change the Action Time of my Mod but Everytime I do it just plays the same time. Any Help on what I did wrong?
steamapps\common\ProjectZomboid\media\scripts\entities\walls
The media folder contains lots of good reference material in general
yeah i use the media folder and use visualstudiocode to search through it. i dont have anything called entites in my scripts folder?
Oh you're on B41 huh?
yeah
Whoops my bad lol
my bad, you can change time by o.maxTime
u good
im just surprised i cant find any animations in any recipes for the entire game. like how do the crafting recipes know which animation to do?
I answered you
i figured there would just be a line that calls for a certain animation
..
oh i see this now sorry about that

This is how i set the time for the TimedAction in my mod:
local o = {
stopOnWalk = false,
stopOnRun = true,
stopOnAim = true,
forceProgressBar = false,
character = character,
item = TrueSmoking.Smokable.item,
}
setmetatable(o, self)
self.__index = self
--if passiveSmoking then o.maxTime = 80 else o.maxTime = -1 end
o.maxTime = -1
return o
end
changing o.maxTime will change the length (im using -1 for infinite)
im only finding Animnode:Disassemble , SawLog, and RipSheets. ima keep looking for a hammering one
Okay I'll try it out and see if it works
i cant find any AnimNode besides Dismantle, SawLog, and RipSheets in all of the recipes combined?
did you try hammer ? I know there is an anim for bashing nails down with a hammer
I think I just tried Welding, or I found it somewhere but haaaard.
you'd have to check the clothing and add damage to the player in one of the attack events
I found a self:setActionAnim("Build")
in ISBarricadeAction
lua/client/TimedActions
this is the search for "AnimNode:" in the ENTIRE media folder
yeah "astompnerfmod" uses this for its calculation, I don't think it would be difficult to make it check for the sock value to be negative
Is this not what you are after?
craftRecipe FireHardenSpear
{
Time = 100,
NeedToBeLearn = true,
OnCreate = Recipe.OnCreate.FireHardenSpear,
OnTest = Recipe.OnCanPerform.OpenFire,
ToolTip = Tooltip_Recipe_OpenFire,
Tags = InHandCraft;Survivalist,
category = Weaponry,
timedAction = CraftKnifeSpear,
AutoLearnAny = Spear:6,
xpAward = Carving:5,
inputs
{
item 1 [Base.SpearCrafted] flags[Prop2],
item 1 tags[SharpKnife;MeatCleaver] mode:keep flags[Prop1;IsNotDull],
}
outputs
{
item 1 Base.SpearCraftedFireHardened,
}
}
The field timedAction specifies the animation to carry out during the TimedAction
yes exactly but i want a hammering one and cant for the life of me find it in the files. the closest ive seen is the lua that someone just linked
Search for ActionAnim
Because I found "Build" in those
yeah is see those now that i searched that. now i just gotta figure out how it would be written in the recipe
this has a mistake from what i can tell lol
even when stomping or shoving weapon is always the weapon equipped so this mod only works if the player stomps while unarmed
this whole line should just be player:isStomping()
like would it be "timedAction = Build"? or would it be "self:setActionAnim("Build")"? because ive never seen the second format in a recipe ever
the 2nd one is the lua code inside the timedaction to set the animation
you could try "MakingHammer_Surface" for timedAction
He's in B41
wouldn't that just always trigger when stomping then? instead of just stomping on an enemy?
cuz you can force a stomp attack with Alt + attack
no OnWeaponHitXP happens at the end of hitting an enemy
is it possible to make a mod to change the animation of holding a two handed firearm like a M16 like this
instead of this
Yep, idleanim
because i think it's would be better for the game to have an idle animation like this than the current one ingame
so should i try "timedAction = Build?" ive never seen this before in any recipe in the files. sory for all the questions this has just been racking my brain as i search through the vanilla files surprised that i cant find the animation and how to set it
So if I have a weapon equipped and use spacebar to stomp, it won't trigger because it sees I'm holding a weapon?
It's strange because I set the Time to something more longer and its still the same as before, but it could be also from this error
yeah
i'm not someone that can make model or animation because i suck in blender but i hope someone will take my idea to make a real mod
i spent a few days recently messing with the weapon events and i have no idea why they did it like that
So replacing this entire if statement with
if player:isStomping() then would fix this?
you probably just need to just find another recipe that uses the animation you want and then copy the timedaction i think
from what i tested that should work
would it be owner instead of player since the function references owner, weapon, hitObject, damage
?
thats what i mean i cant find a single recipe in the entire game that has a hammering or building animation. AnimNode only has Disassemble,RipSheets, and SawLog. And NONE of the recipes have anything saying timedAction that I can find. the word "timed" isnt even in the entire recipe document
if owner:isStomping() then
You are creating a new TimedAction for your mod to use ya? I could be wrong but I think you need the rest of the functions for the TimedAction to work properly (new, isValid, start, stop, perform, etc) That's what i've done anyways in my use case
yeah
it also looks like AnimNode is only used in disassembling objects from what i see in the recipes.txt. and the other thing i thought of was the multiastagebuild.txt would for sure have a hammering animation (like for upgrading walls etc.) but there NOTHING about animations in that file XD
im getting close to leaving it as just the normal ripped sheets animation lol. i just thought it would be cool to be hammering since its a recipe for building a rocking horse
Just tested without changing any of the code.
While holding a screwdriver, the boots still took damage. Meaning it still registered as BareHands
im starting to think that you cant add an animation to a recipe itself, and that it is somewhere else entirely. because the AnimNode is only in dismantling objects and only 3 types exist. and timedAction isnt in a single recipe in the vanilla files.
stomping triggers barehands, and using the screwdriver triggers screwdriver_old
wait are you in b41
yeah
Do you have your mod installed on the workshop ?
that would explain that XD
bruh
so theres no way to add an animation to crafting it?
other than the normal one that looks like ripping sheets or something
I would assume you still can, it just doesn't use timedactions
the only way im seeing would be to use AnimNode:SawLog and combine with the hammering sound and that would be as close as i can get
because i dont think i can use the actual hammering animation in the recipe
im not sure if b41 even had any hammering anims
Yeah I do, I just figured out that im missing some important things on my mod
I could’ve sworn the upgrading wall or barricading had it. In the lua that someone mentioned earlier there was a “build” animation for barricading but I can’t find it anywhere else and idk how I’d write it in a recipe
I think ima have to just try the AnimNode for sawlog and it’ll be as close as I can get to actual hammering lol
Can YOU tell us what is not working ?
I'm trying to essentially implement an item called Orthopedic Cast that works exactly like a splint
it doesn't and the splint is now bugged
im essentially trying to piggy-back off the splint script by making my item use it
No errors ?
Do you understand every parts of your code too ?
Or at least the big lines
hmm
Also did you just copy pasta the original file ?
So it's going to mix with the original one or replace the original one if you do that
That's definitely not what you want to do, going to cause some major incompatibilities
how can I do it then?
my goal is to create a new tag, this tag would make an item work as a splint
like the many tags that do similar things.
Have you tried to use the tag Splint for your item ?
Don't tell me that's a thing lol
I don't think the splint has a tag like that though?
The function HSPlint:checkitem should be a lot of help
right, it isn't, on a quick glance I saw in the posted script something with tag and splint and I thought it was
Is there a way to check if the player has anything equipped in a specific body location?
getClothingItem_Feet specifically checks the shoe slot
I wanna avoid hard coding it to check for socks, so being able to check the sock body location would be useful
Nevermind it's a bit more complicated, but I'd suggest looking through ISHealthPanel.lua for the splint stuff. Probably won't be as simple as tagging it.
i added the saw logs animnode and combined with the hammering sound it looks okay. thtll be the best i can do i think
i think i was searching for something tht doesnt exist XD
Those anims definitely exist in B41 because you know, craft floor tile has you hammering a floor, barricading a window has you hammering a plank, building a wall had you hammer at air, etc.
I just have zero idea what calls those, where or how 😄
Anything? Looking through IsoGameCharacter on the github and I'm not finding anything that helps :(
hey spongie, you got some dank workshop addons. do you primarily play the boid RP or PVE/PVP on MP?
seems like it could be done with :getWornItems(), there is only 2 base types of socks that are used as an item type it seems so would be easy to cover the 2 types
singleplayer lol
getWornItem("Socks") should work but idk the exact name of the bodylocation
forgot to reply
fair lol, if ya had to choose one. what would be the preference?
And is this checking the sock slot, or for an item named socks
hello, i am trying to equip a holster with a script, but it goes into the players hands instead of the beltextra slot
idk i dont play either
if SockItem then
print(SockItem)```
Isn't printing anything when doing the stomp, so I'm guessing it's returning a nil despite me wearing socks
based
thats it
the code is:
if (professionItem:IsClothing() or professionItem:IsInventoryContainer()) and (professionItem:getBodyLocation() or professionItem:canBeEquipped()) then
ISWorldObjectContextMenu.equip(player, professionItem:getBodyLocation(), professionItem, false);
it seems like getbodylocation is always putting things in the off hand
it does this with bags too
build 41 or 42?
b42
On character creation, correct?
#mod_development message
"This script will check the player's inventory for the firefighter pants. If the item is in the player inventory when spawning in, it will delete the starting belt, and equip the pants."
it runs 1 tick after the character is made
Not sure how to tie it to a profession, but the script I linked to here is what I used in my mod that removes player belt, and then equips pants on character creation
i tried setwornitem and couldnt get it to work right, but i will try setting it up like that, thanks 🙂
player:setWornItem("BodyLocation","Module.ItemName")
Yours would probably be
player:setWornItem("BeltExtra","Base.HolsterSimple")
Yeah I have spent HOURS looking for them. The problem is when you right click and hit carpentry, I don’t think that’s technically considering “crafting”. It pulls the hammering animation from a lua or something similar to barricade or upgrade walls. But as far as specifically crafting something, there’s not a single recipe with an animation for hammering in the entire game files. Closest I could get is the AnimNode that is in some recipes but there’s only three of those that exist: sawlogs, disassemble, and ripsheets. And saw logs combined with the hammer sound is the closest I can get in a recipe as of now
How would I go about adding pain to a body part?
I can probably figure out the math part by reverse engineering the code used to damage boots in the mod I'm messing with, just don't know how to apply body pain
Hi, the clothing script i created does not display the model and textures, a similar problem happens with the ground object, maybe is the xml file but i dont have experience with coding
playerObject:getBodyDamage():getBodyPart():setAdditionalPain();
Thanks
Ghille Suit upgrade?
reminds me of that experimental camoflauge that was designed to bend light around you, sorta making you see through but not really.
I think it was too expensive/easier to spot due to pattern seeking brains, and so never went anywhere.
is it fbx or obj?
fbx
also check the model file, compare model names
ensure the clothingitems file is also error free
its 100% a spelling error or reference error
did u add it to fileguidtable?
can u ensure that the model's name and texture name are exactly like the clothingitem file states.
the model is loading it just looks like a material or weight thing
put a space between </file> and <file> in the first and second item
make sure it only uses 1 material because anything else will be invisible
maybe that was the problem, i tried use 2 textures to simulate a metallic texture
i'm gonna fix the texture and try again
ok progress
elseif professionItem:IsClothing() and professionItem:getBodyLocation() then
player:setWornItem(professionItem:getBodyLocation(), professionItem)
this equips the holster but no hotbar slot appears
looks like i need to update the hotbar slots, when i take off the belt, the slot appears
Is it a modded holster?
If not, maybe share the script?
' local professionItem = instanceItem(professionItemType)
'player:getInventory():AddItem(professionItem)
if professionItem:IsWeapon() and not professionItem:IsClothing() then
ISWorldObjectContextMenu.equip(player, player:getPrimaryHandItem(), professionItem, true);
print ("1")
elseif professionItem:IsClothing() and professionItem:getBodyLocation() then
print ("2")
player:setWornItem(professionItem:getBodyLocation(), professionItem)
elseif professionItem:IsInventoryContainer() and (professionItem:getBodyLocation() or professionItem:canBeEquipped()) then
print ("3")
ISWorldObjectContextMenu.equip(player, professionItem:getBodyLocation(), professionItem, false);
end'
it is a "Base.HolsterSimple_Black"
Are you looking to reference the animation? Or hoping to somehow modify it?
Regardless of your intent; they're stored under the same file as all other animations regardless of it's crafting or not. Which is Anims_X -> Bob folder under Media.
They're considered Bob_IdleHammering and Bob_IdleHammering_Low. They're normally triggered by TimedActions (as are most other things in the game.)
They can be triggered outside of this as well, and you can also change the equipped item during them by making your own timed action with your own event trigger and your own parameters within the timed action.
If you intend to modify them; vanilla animations are a bit of a headache to modify in any extensive way outside of the code or .XML scripts.
If you have any other questions let me know.
If you wanted to use them yourself in a crafting recipe; you need to reference the 'string' value in the animation's XML.
Here's an example of what the 'Build.xml' is:
<?xml version="1.0" encoding="utf-8"?>
<animNode>
<m_Name>Build</m_Name>
<m_SpeedScale>0.80</m_SpeedScale>
<m_AnimName>Bob_IdleHammering</m_AnimName>
<m_deferredBoneAxis>Y</m_deferredBoneAxis>
<m_SyncTrackingEnabled>false</m_SyncTrackingEnabled>
<m_BlendTime>0.40</m_BlendTime>
<m_Conditions>
<m_Name>PerformingAction</m_Name>
<m_Type>STRING</m_Type>
<m_StringValue>Build</m_StringValue>
</m_Conditions>
<m_SubStateBoneWeights>
<boneName>Dummy01</boneName>
</m_SubStateBoneWeights>
<m_SubStateBoneWeights>
<boneName>Translation_Data</boneName>
</m_SubStateBoneWeights>
</animNode>
You would reference the 'Build' string in your action anim name for your craft recipe's timed action.
You can just make your own custom XML for your own needs as well while still referencing the vanilla animation name and make your own string.
Where are all the available key maps? I forgot.
IE: getCore():getKey("Forward")
Nvm, they are in keys.ini
Maybe it went lots of places and we don't know because we can't see it.
do y'all know if there's anybody around doing clothing mod commissions
i'm getting my ass beat by modelling n' shit
Am I the only one who checked 3 times PZ blog in the last hours ?
they already said there wouldn't be one this month
hey albion, i got a question, would you know where i can find modders to commission?
(NO LONGER NEEDED AS OF 2/5/25)
thanks a ton
Lua command console:
pickup testnilzombie.iso.objects.isoThumpable@xxxxxx
Still can't pick-up my tiles (maybe my tiles def (Tilezed) are outdated) or something missing ?
Whats the best way to test a multiplayer mod if you need a second player but don't got a second Steam account/person handy? Shit outta luck?
Working on a name recognition system
Tried the old running two clients on a local server, but the second one said user is already connected.
run your clients with -nosteam
https://i.gyazo.com/c9dcc3822f2e529c7eac3d00443eed9c.jpg I think CrashedCars mod will have an update soon, courtesy of Filibuster.
I was just trying to use it not modify it. the issue is i cant use TimedActions becasue im build 41. and when i tried to use the "Bob_IdleHammering: as a sound like normal in my recipe, the game wouldnt even open until i deleted it out
So what precisely are you trying to do? TimedActions existed in build41 as well. Are you making a crafting action, or trying to apply some sort of sound, or animation?
just a normal crafting, where the animation is the hammering animation thats it
Yeah so you can still reference it; it's just a 'string' in the files for the recipe. You just might have to make your own .xml for it to reference the string. Crafting recipes are timed actions themselves.
well now whenever i carry out the crafting, which has the hammering sound, most of my game sound disappears. no footsteps etc
just started happening
it worked fine earlier and i didnt change anything?
the only sounds coming through are rain and wind now. all other sounds are muted in my game
Restarting the game brings back sounds. But as soon as I craft it again, my sounds go away
here is the recipe in question
recipe Rocking Horse
{
Nails=5,
Plank=5,
keep [Recipe.GetItemTypes.Hammer],
Result:RockingHorse,
Sound:Hammering,
Time:100.0,
Category:AcidItems,
AnimNode:SawLog,
}
earlier this worked fine, and now it breaks my game sounds
any idea why?
crafting anything is now making my game not have sounds wtf
sounds are fine and when i craft something they just go away
verified game files and now it works lol im trippin
anybody has (or is working on) a mod that make coolers functional?
now theyr ebroken again dude ugh
Does anybody have any idea why crafting would take away game sounds. I can hear zombies and environmental sounds. But no sounds of my footsteps or my actions
so ive come to the conclusion so far that if you spawn in beer bottles, and only beer bottles, and use them to craft something, it breaks your game sounds. i just tested a whole bunch of stuff. something about spawning a beer bottle in admin mode and using it to craft something in a recipe breaks it
so its any drinks. if you have a recipe that has drinks or drink bottles, and if you spawn them in using admin mode, they will break your audio. crafting with the drinks in my fridge works fine. but when you craft using spawn in drinks, they break. such a weird issue
I am trying to play an SE with the following code, but when the sound is played while the character is moving, the sound source moves. When I listen with headphones, the first 5 times it sounds the same from left to right, when character runs to the left, the sound runs to the right, and when character runs to the right, the sound runs to the left. This seems to be a production where the sound is played at the coordinates of the player at the moment the sound is played. However, since what I want to sound is an SE related to the UI, it does not need to be audible to other players, nor does the sound need to be staged. Can someone please suggest this?
getSoundManager():playUISound("SOUNDNAME")
I found this Java method in SoundManger.
public Audio PlaySound(String var1, boolean var2, float var3) {
if (GameServer.bServer) {
return null;
} else if (IsoWorld.instance == null) {
return null;
} else {
BaseSoundEmitter var4 = IsoWorld.instance.getFreeEmitter();
var4.setPos(0.0F, 0.0F, 0.0F);
long var5 = var4.playSound(var1);
return var5 != 0L ? new FMODAudio(var4) : null;
}
}
And I also found playSound method in IsoPlayer, so I tried call this.
getPlayer():playSound("SOUNDNAME")
In both cases, the sound is now as intended even if the character moves. However, my concern is whether the sound is heard by other players in multiplayer. Off course, I want to play sound only me. Does anyone know?
It appears that the playUISound specifications have changed for B41 and B42. Given these changes, which method should we use to play UI sounds (location-agnostic, not audible to other players)?
// B42.2.0
public long playUISound(String var1) {
GameSound var2 = GameSounds.getSound(var1);
if (var2 != null && !var2.clips.isEmpty()) {
GameSoundClip var3 = var2.getRandomClip();
long var4 = this.uiEmitter.playClip(var3, (IsoObject)null);
if (var4 != 0L && IsoPlayer.getInstance() != null) {
if (IsoPlayer.getInstance().getReanimatedCorpse() != null) {
this.uiEmitter.setPos(IsoPlayer.getInstance().getReanimatedCorpse().getX(), IsoPlayer.getInstance().getReanimatedCorpse().getY(), IsoPlayer.getInstance().getReanimatedCorpse().getZ());
} else {
this.uiEmitter.setPos(IsoPlayer.getInstance().getX(), IsoPlayer.getInstance().getY(), IsoPlayer.getInstance().getZ());
}
this.uiEmitter.setParameterValue(var4, FMODManager.instance.getParameterDescription("FootstepMaterial"), 2.0F);
this.uiEmitter.setParameterValue(var4, FMODManager.instance.getParameterDescription("FootstepMaterial2"), 0.0F);
this.uiEmitter.setParameterValue(var4, FMODManager.instance.getParameterDescription("Inside"), 0.0F);
this.uiEmitter.setParameterValue(var4, FMODManager.instance.getParameterDescription("RainIntensity"), 0.0F);
}
this.uiEmitter.tick();
javafmod.FMOD_System_Update();
return var4;
} else {
return 0L;
}
}
// B41.78.16
public long playUISound(String var1) {
GameSound var2 = GameSounds.getSound(var1);
if (var2 != null && !var2.clips.isEmpty()) {
GameSoundClip var3 = var2.getRandomClip();
long var4 = this.uiEmitter.playClip(var3, (IsoObject)null);
this.uiEmitter.tick();
javafmod.FMOD_System_Update();
return var4;
} else {
return 0L;
}
}
How does one manually call a crafting option from the context menu on an item with lua?
@young trellis #mod_support message
How's folder structure? I mean, where's your media folder located?
Content/mods/42.2.0
\mods\[UniqueFolderName]\42.2.0 ?
So like this?
Thanks I will give it a try 👍
common should be here
The mod displays now however wont load and shows a white box for the preview image
what png file is loaded in mod.info?
There's a poster= parameter in mod.info
also preview.png should be placed with workshop.txt
What files are always loaded when the game starts? And what files are loaded only on demand?
so preview.png is for workshop
poster parameter is for in-game thumbnail in modlist i guess (I always use same png file for both so only guessing)
not being loaded is something different tho, I can't even guess
https://gyazo.com/eef11ba1ce839c33fe575939d3173d5c The current folder structure
please follow this guide first and let's see if there's any problems still
Yeah I'll rebuild it before adding anything else in and see where we get. idk why the new structure is throwing me off from 41 lmao
new folder structure is pretty confusing at first :3
What happens if you move "42.2.0\media\mod.info" to "42.2.0\mod.info"?
└── mods/
├── MyMod1/
│ ├── common/
│ │ └── media/
│ │ └── ...
│ ├── 42/
│ │ ├── media/
│ │ │ └── ...
│ │ ├── mod.info
│ │ └── poster.png
│ ├── 42.1/
│ │ ├── media/
│ │ │ └── ...
│ │ ├── mod.info
│ │ └── poster.png
│ ├── 42.1.5/
│ │ ├── media/
│ │ │ └── ...
│ │ ├── mod.info
│ │ └── poster.png
│ └── ...
└── MyMod2/
└── ...
So for this, do I have two copies of the media folder between my mod folder and the 42 folder?
Or is this for having multiple mods in one singular pack?
If there is no need to separate the mods in the minor version, you can prepare only 42 folders and copy the files there.
This is an example of my mod that supports both B41 and B42. the Common folder is another consideration and is not covered in this case.
└─P4AlarmSyndrome
│ mod.info <--- for B41
│ poster.png <--- for B41
│
├─42 <--- for B42
│ │ icon.png <--- for B42
│ │ mod.info <--- for B42
│ │ poster.png <--- for B42
│ │
│ └─media <--- for B42
│
├─common <--- Common use
└─media <--- for B42
Also now having an issue with just rebuilding with the proper structure that when saving mymod.info file its staying as a text document and not becoming the proper info file
That is a matter of how you use the editor. Just make sure you correctly name the file when saving from the editor or rename it on Explorer.
I used a tool to convert it to an info problem solved there 🙂
So I've got it uploaded back to the wrokshop and all now, it displays the proper preview image on the mod page however it keeps bricking my game, when I relaunch it loads to a black screen and eventually closes out, the only thing the mod adds is textures so I'm not sure what the deal is, the same mod was working on B41 yesterday when I took a look
Which mod is yours? I'll try running it on my setup to help narrow down the issue.
missing }
Yes, I confirmed just now that problems lol
Ooh, that was the part I was working on, I'll have to fix that part
31-01-25 14:35:51.802] ERROR: General f:0, t:1738301751802> ExceptionLogger.logException> Exception thrown
java.lang.Exception: Item not found: Ingot_gold at OutputMapper.getItem(OutputMapper.java:114).
Stack trace:
zombie.entity.components.crafting.recipe.OutputMapper.getItem(OutputMapper.java:114)
zombie.entity.components.crafting.recipe.OutputMapper.OnPostWorldDictionaryInit(OutputMapper.java:121)
zombie.scripting.entity.components.crafting.OutputScript.OnPostWorldDictionaryInit(OutputScript.java:398)
zombie.scripting.entity.components.crafting.CraftRecipe.OnPostWorldDictionaryInit(CraftRecipe.java:664)
zombie.scripting.ScriptBucketCollection.OnPostWorldDictionaryInit(ScriptBucketCollection.java:188)
zombie.scripting.ScriptManager.PostWorldDictionaryInit(ScriptManager.java:1723)
zombie.iso.IsoWorld.init(IsoWorld.java:2614)
zombie.gameStates.GameLoadingState$1.runInner(GameLoadingState.java:301)
zombie.gameStates.GameLoadingState$1.run(GameLoadingState.java:251)
java.base/java.lang.Thread.run(Unknown Source)
Interestingly even without the mod loaded my game is bricked after a fresh install with stuck on loading scripts on the unstable branch
The game fails to load the recipe and cannot start because there is no item definition “Ingot_gold”. Is this item from another mod?
Excuse me, but was this mod developed by you? I suggest you test it thoroughly locally and upload it.
Well the idea was to create the item "Ingot_gold" but upon digging further I found that it is already a item in game with its own texture, it just doesn't have a way to craft it yet as far as the base game, so I was trying to create a crafting mod that allows you to melt say Gold rings into that ingot. I didn't get far as the file structure was messing with me last night lmao
The mods not intended to be public just for a private server, this is a first attempt at making something past just retexures of clothing and vehicles that I've made in the past
If there's a Ingot_gold already in game, try Base.Ingot_gold instead Ingot_gold
To begin with, there is no item called "Ingot_gold" in vanilla either (yes, there is a texture with that name, but there is no item setting).
Yeah that was prior to me finding out the item existed I took the texture of the iron ingot and just threw color onto it to test in game if I could at least pull the item up, then I found out there is an actual gold ingot texture and item already
I believe this is the texture all ingots in game utilize
The items defined in vanilla are “GoldBar” and “SmallGoldBar”, which indeed use the icon “Ingot_Gold”. If you are referring to these items, then coolfish2 is correct, they need to be specified in the recipe with Base.( Base.GoldBar or Base.SmallGoldBar)
item GoldBar
{
DisplayName = Gold Bar,
DisplayCategory = Material,
Type = Normal,
Weight = 16,
Icon = Ingot_Gold,
StaticModel = GoldBar,
WorldStaticModel = GoldBar,
Tags = IgnoreZombieDensity;HasMetal,
}
item SmallGoldBar
{
DisplayName = Gold Bar - Small,
DisplayCategory = Material,
Type = Normal,
Weight = 2,
Icon = Ingot_Gold,
StaticModel = GoldBarSmall,
WorldStaticModel = GoldBarSmall,
Tags = IgnoreZombieDensity;HasMetal,
}
Ingot_Gold” is the file name of the 3D model or icon image, not the item ID of the item setting. You have specified as the item ID “Ingot_Gold” in the recipe (and without the "Base." modifier), which causes an error on recipe load, and worst of all, the game will not start in this case.
Awesome, I'll give it a try
anyone know the difference between context:addGetUpOption() and context:addOption()
function ISContextMenu:addGetUpOption(text, target, onSelect, p2, p3, p4, p5, p6, p7, p8, p9, p10, ...)
if select("#", ...) > 0 then
error("only 9 additional arguments are supported")
end
-- Any of these may be nil, so we can't take advantage of "..." syntax :-(
return self:addOption(text, self, self.onGetUpAndThen, onSelect, target, p2, p3, p4, p5, p6, p7, p8, p9, p10)
end
function ISContextMenu:onGetUpAndThen(onSelect, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, ...)
local nArgs = select("#", ...)
if nArgs > 0 then
error("only 10 additional arguments are supported,")
end
local playerObj = getSpecificPlayer(self.player)
local action = ISWaitWhileGettingUp:new(playerObj)
action:setOnComplete(onSelect, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10)
ISTimedActionQueue.add(action)
end
function ISWaitWhileGettingUp:start()
if not self.character:isSitOnGround() and not self.character:isSittingOnFurniture() then
self:forceComplete()
return
end
self.character:setVariable("forceGetUp", true)
end
function ISWaitWhileGettingUp:update()
if not self.character:isSitOnGround() and not self.character:isSittingOnFurniture() then
self:forceComplete()
end
end
so i guess it's literally force getup when player is sitting?
What is the fomula for durrability on tires? and does running over bodies hurt them as well?
I knwo speed and tire pressure matter, just not sure how.
Reposting for morning and noon here EU.
[b41] I made custom tiles with tilezed from steam.
My tiles are brushtool able and appearing fine.
BUT I can't pick them up...
Lua command console posts:
pickup testnilzombie.iso.objects.isoThumpAble@xxxxxxx
**SOLVED ** leave field: Item (full name) [...] blank ! <1>
I know why I could not pick my tiles, I gave all Item (full name) to my sprites/tiles and removing it, leaving blank, solved my pickup problem.
Now I don't have a nice display name, but I can pick up my tiles.
<1>The Item (IDname /not rly full name doh!) is used to link the tile to a script item.
(if not using script item link, gotta be carefull how you name the groupname and customname for a clean output display name)
EDIT: I solved the rotations below:
[b41] And how do you make a tile have N and W facing..
I made 2 sprites per "item/object".
for the moment I can only place my item/tile and not pick up, + I can't rotate it 90° (switch N and W) (facing N and W in .Tiles doesn't work, and vanilla tiles I used as ref for tile def aren't even using them. I will look at other tiles which do rotate.)
Solution for rotation of tiles:
So it's about how we name the values groupname. don't use spritpos. and custom name is actually for the group of object name the same. it's not the other way around (from my divergent mind at least)
and .Tiles facing N or W or S or E is working as intended if you use the groupname correctly.
Must use the same groupname ("poor quality" for exemple) for that rotating item, called the same on Custom name, the custom name is the group actually.. like "chair" or "barrel", and the groupname is for the tile(same) facing diff.direction grouped or linked togheter for those sprites to identify as one item.
so we could have 1 custom name for the 3 items and 3 groupname for 3 variants of that custom item... (from poor to rich qualities for ex.)
Im a little confused on item models and such. Im updating my water straw mod for B42. Currently the animations work fine when using bottles or containers, but since the model is rotated 180 degrees on the prop1 attachment, when i go to use that same model with the drink from hand animation, the model is not placed correctly.
I've currently fixed it by making a placeholder item with the correct rotation and getting that items static model for the timed action that calls the drink from hand animation, but this doesnt seem like the proper way to do it.
Is there a better way to have multiple model definitions for the same item?
my model script looks like this
model waterFilterStraw
{
mesh = WorldItems/waterFilterStraw,
texture = waterFilterStraw,
attachment Bip01_Prop1
{
offset = 0.0000 0.0000 0.0000,
rotate = 0.0000 0.0000 180.0000,
}
}
model waterFilterStrawFromGround
{
mesh = WorldItems/waterFilterStraw,
texture = waterFilterStraw,
attachment Bip01_Prop1
{
offset = 0.0000 0.0000 0.0000,
rotate = 0.0000 0.0000 0.0000,
}
}
in the timed action that handles drinking from bottles, self:setOverrideHandModels(self.straw:getStaticModel(), self.item:getStaticModel()); works perfectly with the 180 z rotation
but using that on the drinking water from hand timed action (what im using to simulate drinking from puddles and lakes), i dont need that rotation
so on that timed action i instead have
self:setOverrideHandModels(getScriptManager():FindItem("waterStrawFullPLACEHOLDER"):getStaticModel(), nil)
hopefully that explains what im trying to ask. Im very confused
this currently works it just doesnt feel like the correct way to go about it
Hello! In B42, does anyone know how the command "addScrollBars()" work when applied to a UI panel (like "panel:addScrollBars()")? Specifically, I cannot figure out how the position of the scroll bar is determined by the game. Seems to be completely random for me (sometimes it is shown on a seemingly random position, sometimes it is not shown at all...).
Wish we could hang zombies on the butcher hook
Idk if that’s a mod already
I wanna Vlad the impalerify my base
I don't see changes specific to B42 for that, so I'm assuming you just mean as of B42. ISUIElement.addScrollBars adds an ISScrollBar to an element and sets it to the vscroll field (and a horizontal one to hscroll, if the flag is passed for that). The position and size are initially set in ISScrollBar:instantiate, but they'll change based on the parent size due to the values of the anchor fields
The anchor calculations live in Java, UIElement.onResize
Also, re. "sometimes not shown at all": see ISScrollbar:render (depends on the scroll height value of the parent)
I also found out that it is somehow related to parent position and size but I haven't yet been able to find out what the exact rule for position calculation is. Pbbly have to reverse engineer the vanilla code more.
Btw. this happens when I simply addScrollBars() to the shown panel. An additional complication might be that the game somehow changes smth about the panel position and size without me noticing and thus messing things up...
If you're adding it before the width & height of the panel are initialized, it'll likely mess up the intended position/size
I already tried to add it afterwards. My code goes smth like this:
vanilla: create/adjust panel (size, position etc), add scroll bars -> my mod: delete scroll bars, change position/size of panel, addScrollBars() again
So, anytime vanilla touches the panel, I run my modded code to adjust it and re-add the scroll bars after I've set up anything. One possibility is ofc that I overlooked some part of the vanilla code where it changes it and forgot to apply my method although I checked the vanilla code pbbly 100+ times by now XD
ERROR: General f:0, t:1738345755213> ExceptionLogger.logException> Exception thrown
java.lang.RuntimeException: attempted index: items of non-table: null at KahluaThread.tableget(KahluaThread.java:1667).
Stack trace:
se.krka.kahlua.vm.KahluaThread.tableget(KahluaThread.java:1667)
se.krka.kahlua.vm.KahluaThread.luaMainloop(KahluaThread.java:479)
se.krka.kahlua.vm.KahluaThread.call(KahluaThread.java:173)
se.krka.kahlua.vm.KahluaThread.pcall(KahluaThread.java:1963)
se.krka.kahlua.vm.KahluaThread.pcallvoid(KahluaThread.java:1790)
se.krka.kahlua.integration.LuaCaller.pcallvoid(LuaCaller.java:66)
se.krka.kahlua.integration.LuaCaller.protectedCallVoid(LuaCaller.java:139)
zombie.Lua.Event.trigger(Event.java:81)
zombie.Lua.LuaEventManager.triggerEvent(LuaEventManager.java:281)
zombie.gameStates.IngameState.enter(IngameState.java:811)
zombie.gameStates.GameStateMachine.update(GameStateMachine.java:145)
zombie.GameWindow.logic(GameWindow.java:377)
zombie.core.profiling.AbstractPerformanceProfileProbe.invokeAndMeasure(AbstractPerformanceProfileProbe.java:76)
zombie.GameWindow.frameStep(GameWindow.java:924)
zombie.GameWindow.run_ez(GameWindow.java:817)
zombie.GameWindow.mainThread(GameWindow.java:615)
java.base/java.lang.Thread.run(Unknown Source)
LOG : General f:0, t:1738345755213> -----------------------------------------
STACK TRACE```
Why do I get error?
This is what I have on line 33:
table.insert(VehicleDistributions.PoliceTruckBed["TruckBed"].items, "RE3Gunpowder.ReloadingTool")
table.insert(VehicleDistributions.PoliceTruckBed["TruckBed"].items, 2)```
Attempted index items of non-table: null = you tried to index the field items on nil → VehicleDistributions.PoliceTruckBed["TruckBed"] is nil
Did you mean .Police["TruckBed"] (or .PoliceState, .PoliceSheriff, .PoliceDetective)? There's a PoliceTruckBed, but it's a table containing items directly
I'll try just Police, thanks 🙂
Hey all, trying to make sense of this code
ISComboBox is a standard class in the lua, what is this doing?
if ISComboBox.SharedPopup then
self.popup = ISComboBox.SharedPopup
Is it setting this for any existing instance of this control globally or just any new instances, or sometghing else?
function ISComboBox:createChildren()
if ISComboBox.SharedPopup then
self.popup = ISComboBox.SharedPopup
else
self.popup = ISComboBoxPopup:new(0, 0, 100, 50)
self.popup:initialise()
self.popup:instantiate()
self.popup:setFont(self.font, 4)
self.popup:setAlwaysOnTop(true)
self.popup.drawBorder = true
self.popup:setCapture(true)
ISComboBox.SharedPopup = self.popup
end
end
not seen this done anywhere else in the lua and struggling to make sense of it
It's setting it for all instances, but technically just any new instances (so both options are correct). The first ISComboBox created will assign its ISComboBoxPopup to ISComboBox.SharedPopup, so it can effectively be thought to be shared by all instances. The point of it is that only one combobox popup should be visible at one time, so it's just sharing the one instance and changing the values it includes (via ISComboBoxPopup.setComboBox)
The "combo box popup" being the dropdown options that show when you click a combo box
Also, you can format code blocks on Discord by wrapping them in two sets of ``` (with ```lua on top for Lua-specific formatting). So:
```lua
print("Hello world")
```
Becomes
print("Hello world")
Perfect, thank you, appreciate the explantaion
ZomboidDecompiler released: single click game decompilation, automatic gathering of dependencies, renaming of method parameters using known names from b41 javadocs https://github.com/demiurgeQuantified/ZomboidDecompiler
Updated decompiling page to link and explain the new decompiler by albion
https://pzwiki.net/wiki/Decompiling_game_code#Decompiling_with_ZomboidDecompiler
Why doesn’t lemongrass consistently lower food sickness? If the player eats lemongrass, it lowers sickness once, and not again until I reload the world. I am trying to make a custom item that removes a little sickness when consumed with ReduceFoodSickness = 12
Is it necessary to use lua scripting to bypass this?
Is it only for lemongrass or any item with this stat ?
My guess is they tried to reduce the above from it or idfk
Any item with that stat. I looked up a mod specifically for food sickness and they used lua, so I guess that is the route I'm taking as well
yup
parameter names added to the unofficial javadocs https://demiurgequantified.github.io/ProjectZomboidJavaDocs/
I know why I could not pick my tiles, I gave all Item (full name) to my sprites/tiles and removing it, leaving blank, solved my pickup problem.
now I don't have a nice display name, but I can pick up my tiles.
just need to retouch the names for better display, I get it now. xD just needed to unlock the pickup function.
anyone know how i'd go about custom animations for specific zombie types?
Wonderfull, thanks so much.
Question : does the decompiler align the linenumber of class / java please ?
On my side, i use a Java Decompiler in vscode which align the linenumber, so i can remotly debug and put breakpoint into the jvm :p
Not a specific modding question but in B42, has anyone else the problem the character customisation screen in the vanilla game is quite laggy at times? For me, sometimes the character avatar does not appear immediately when the screen is opened and the "Random" button is laggy and unresponsive (becomes better when screen is open for a longer time). Moreover, when I play with all-clothing-unlocked, the screen shows a consistent fps drop (from 60 in default mode to ~50 when all-clothing-unlocked enabled).
no, but i believe vineflower has an option for this, i can add a switch for it next time i update it
i should probably add a way to just pass regular vineflower arguments in anyway
yeah, and then you can launch PZ with this option :
-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:5005
so you can remote debug in live at port 5005, very usefull
that's way you can debug with breakpoint, conditional breakpoint, watch expression, etc. (for my part i disassemble with vscode but i debug with intellij)
yeah, that'd be extremely helpful for me, thanks a lot
there's something i've been messing around with for a while that just prints a blank stack trace so i've been kind of at a loss for debugging it
the most difficult part is to find a good java disassembler, most of the time the line of disassembled is not aligned with the .class linetable, so if you put a breakpoint into a "incorrect output", the debugger is "in space" and you're blind.
For example, i linked 2 files from a decompilation of PropertyContainer.class file : a "bad" decompilation with incorrect line number, and a "good" with correct line number.
yeah, i'm pretty certain i've seen an argument in vineflower (which ZomboidDecompiler uses) that maps bytecode lines 1:1, ZomboidDecompiler just doesn't set that argument currently
thanks for your job and keep going, your mods and your works are wonderfull
if you need tools, I've created a little python script to easily decompress .pack files
is there no way to use vanilla items in self created vehicle parts? if I want to use itemType = Base.PetrolCan I have to create the item, item PetrolCan1. is there a workaround for that?
BUMP
Can anyone answer this question?
Did you try this :
character:getEmitter():playSound("xxxxx") ?
Thank you. I think that one is the same as player:playSound() in terms of implementation.
Player-based playSound is not suitable for this case because it does not play sound when the player is in GostMode.
well, it seems that UISound always follow position of player :/
public long playUISound(String var1) {
GameSound var2 = zombie.GameSounds.getSound(var1);
if (var2 != null && !var2.clips.isEmpty()) {
GameSoundClip var3 = var2.getRandomClip();
long var4 = this.uiEmitter.playClip(var3, null);
if (var4 != 0L && IsoPlayer.getInstance() != null) {
if (IsoPlayer.getInstance().getReanimatedCorpse() != null) {
this.uiEmitter
.setPos(
IsoPlayer.getInstance().getReanimatedCorpse().getX(),
IsoPlayer.getInstance().getReanimatedCorpse().getY(),
IsoPlayer.getInstance().getReanimatedCorpse().getZ()
);
} else {
this.uiEmitter.setPos(IsoPlayer.getInstance().getX(), IsoPlayer.getInstance().getY(), IsoPlayer.getInstance().getZ());
}
Yes, I know. So SoundManager#PlaySound seems to be the right choice for this case, but I am asking for best practices.
public Audio PlaySound(String var1, boolean var2, float var3) {
if (GameServer.bServer) {
return null;
} else if (IsoWorld.instance == null) {
return null;
} else {
BaseSoundEmitter var4 = IsoWorld.instance.getFreeEmitter();
var4.setPos(0.0F, 0.0F, 0.0F);
long var5 = var4.playSound(var1);
return var5 != 0L ? new FMODAudio(var4) : null;
}
}
So you should probably use
getSoundManager():PlaySound("XXX")
in the ISGameSounds.lua, this method was used :
function ISGameSounds.onPlaySound(args)
if not MainScreen.instance.inGame then
getSoundManager():StopMusic()
end
local self = args[1]
local gameSound = args[2].gameSound
-- getSoundManager():PlaySound(gameSound:getName(), false, 1.0)
self:onStopSound()
GameSounds.previewSound(gameSound:getName())
self.previewControl = args[2]
end
I am currently using PlaySound and am experiencing a problem. I want to play a sound that is independent of the character's position. 😦
playSound with the global instance of "getSoundManager()" ?
player:playSoundLocal(sound);
then its not heard by others
I believe so
Thank you.
I think so but the player-based playSound is not suitable for this case because it does not play sound when the player is in GostMode.
I think getSoundMangaer():PlaySound(“XXX”) (only String argument) is not defined. I would like to know if its overload, PlaySound(String, boolean, float), is suitable. I see that it is commented out in the ISGameSounds.lua that you taught me. However, the second and third arguments of this method are not used, so it looks like it is not a problem, and it is making me wonder if maybe this method itself is deprecated.
no sound at all was played when the player is in god mode
strange i see the method in my exported lua decompilation
or maybe :
function FMODSoundEmitter:playSound(arg0) end
getSoundManager():playSound("XXXX")
I tried above code, and got error.
[01-02-25 09:27:55.470] ERROR: General f:113, t:1738369675470> ExceptionLogger.logException> Exception thrown
java.lang.RuntimeException: Object tried to call nil in OnKeyPressed at KahluaUtil.fail(KahluaUtil.java:82).
Stack trace:
Anyway, thank you all for your replies, as far as I can see from the Java implementation, SoundManager#PlaySound(String, boolean, float) can play “position independent sound”, “sound not heard by other players”, “sound played even in Ghost mode” for the following reasons I think I will use this method because I think it can play those sounds for the following reasons
-- SoundManager.java
public Audio PlaySound(String var1, boolean var2, float var3) {
if (GameServer.bServer) {
return null;
} else if (IsoWorld.instance == null) {
return null;
} else {
BaseSoundEmitter var4 = IsoWorld.instance.getFreeEmitter();
var4.setPos(0.0F, 0.0F, 0.0F);
long var5 = var4.playSound(var1);
return var5 != 0L ? new FMODAudio(var4) : null;
}
}
- return null in case of server
- fix the emitter position at (0,0,0)
- there is no check logic for Ghost mode(0L)
If you have any best practices for sound effects for these uses, please let me know.
You have playSound instead of PlaySound. You'll also need to pass something for the other two required parameters
You mean "use PlaySound(String, boolean, float)" right?
If so, yes I tried use this method, and I got collect behavior.
Does anybody know how I can access an instance of GameServer from the lua environment, if possible?
https://zomboid-javadoc.com/41.78/zombie/network/GameServer.html
Javadoc Project Zomboid Modding API declaration: package: zombie.network, class: GameServer
Not seeing any getters in GlobalObject that would get me there.
you can't, it's not exposed
what would I use to check a player's skill? I wanna check the player's maintenance and tailoring skills for a script
anyone know how to retrieve the zombs within a short distance of the player?
I think you meant this for @vast pier
sure, sorry, tired 😢
character:getPerkLevel(perk)
you can use something like that :
radius = 10 -- example
x = playerObj:getX()
y = playerObj:getY()
z = playerObj:getZ()
for _x = x - radius, x + radius do
for _y = y - radius, y + radius do
local sq = getCell():getGridSquare(_x, _y, z);
if sq then
for i = sq:getMovingObjects():size(), 1, -1 do
local movingObject = sq:getMovingObjects():get(i - 1);
if instanceof(movingObject , "IsoZombie") then
-- Do what you want
end
end
end
end
end
ah interesting, so manually checking each space
ty will give it a try
https://steamcommunity.com/sharedfiles/filedetails/?id=3418513380
Hey everyone I just released the water filter straw update for B42. I know lots of ppl use this mod so I hope y'all enjoy it! It's been reworked from the ground up to be compatible and better with b42.
just found out my mod was broken for 5 days and i hadn't even gotten on the update to realize
it's so over
where are the annoying people yelling in the comments when you need them
lol what's the mod
moodle replacement one, Classic Moodles
they fucked with all the file structure for no reason
made it take like 4x more storage space for arguably worse effectiveness
player:getStats():getNumVeryCloseZombies()
Is there any way to create grayed out options when disable specific option in sandbox?
for example, you only can change specific skill multiplier value when you disable global option.
no
vanilla options don't use the same system available to mods so they can do a lot of things we can't
How would I go about making an item that I’m makin in a mod into a container? Like having storage space etc. is it as simple as adding another line in a script?
Hey everyone, I have a question.
I have an object in the world that I would like to click on directly and have it show a context menu with any recipes it may work for, similar to how you can do so in an inventory window and right clicking an item>action.
Is this possible?
I have figured out how to make a context menu and run a function from that previously, but not sure how to show the available recipes for the item.
For reference, the item is a machine/workbench type of item. Please let me know if anyone can give some help, thanks!
Is there a quick summary of the cell/grid/square relationship?
cell: 256x256 square area (300x300 in b41) made up of 8x8 square (10x10 in b41) chunks
the isocell object has nothing to do with an actual cell, it is just the entire currently loaded area, any functions that return one return the same one (there is only ever one)
okay so the 8x8 chunks are represented by IsoGridSquare?
offhand IsoGridSquare looks like an individual space (i.e. player-sized space)
a chunk is an 8x8 square area
Would it be inappropriate to make a mod that plays "Pumped up Kicks" when you enter a school?
Vanilla workbenches will show every recipe that they use when you click on them or do rightclick -> <object name>
I assume that is a property of the worlditem, but if not have a look at hose they do the context menu -> crafting menu code for those.
My mod need this otherwise, player would have to pickup the tile to craft recipe.... I looked into it.
I think we need to make a MULTIBUILD recipe (like chairs(no sure actually) but like walls for sure, you can upgrade with context menu and you can't pickup the wall) not the inventory recipe
or use workbench function (I have not yet tried to work with this, I have just tried once and nothing.... dunno if you can make any tile a workbench and if you did, how would you make it appear as source item for the recipe ? i know we can use lua Recipe.OnCreate to remove/destroy the tile or object source and replace it with the result)
In inventory, the context menu auto shows recipe available for crafting, no need to create those function with standard "inventory" recipe..
Although, with canBeDoneFromFloor, only items are sourced, I have not been able to source a tile from floor(placed), I rly need to pick it up.
is it possible to edit these values in game?
Yes, using DoParam()
Oh wait those might not work - mutlilien sub-section thingies
Try this from Very Salty Oreos:
local item = ScriptManager.instance:getItem("PipeBomb")
if item then
item:Load(item:getName(),
[[{
MaxRange = 10,
ExplosionPower = 0,
MaxDamage = 60,
ExtraDamage = 150,
AttachmentType = Hammer,
}]])
end
Sorry I mean I want to tinker the values in game. Every time I need to change the values I had to reload
That seems to be a way to load bits of script over the existing script, and hace multiline support, so may do what you need.
Some values will need a reload to take effect, some values will need you to spawn a new item to take effect
I see. I thought there's a debug feature that I can manually change the values so I can just copy it to my txt file
hi I'm totally new to modding this game so sry if I ask rlly stupid questions
is there a way to get a players limb/bone location in world space?
I don't think so, but if you can explain what you need that info for someone may have a suggestion on how to do it.
I'd like to add player/zombie footprints on snowy grounds
obv I need the players feet location for that :/
Nice idea. No idea if there's going to be any practical way to do it.
Also, if you do it for zombies as well it's going to be a lot of footprints.
thats annoying grr
plan was giving them a short lifetime or only limiting it to players
they would all vanish overtime
Happens a lot, you have an idea and look at how to do it and hit the Great Wall of Java
I'm having trouble identifying the code for knocking a zombie back. I've found combat code and damage code and I see variables like isStaggerBack being set to true in certain circumstances but I can't find the code that actually moves the zombie back
Maybe, but what about a cd of the song that only spawns in school backpacks
When I was making my mod that inserts all the skillbooks into every bookshelf I had to remind myself "oh yeah, no Aiming books in schools".
Could've been an oopsie.
Why no aiming books in school tho? I learned archery at school.
I'd say that would be in bad taste, for obvious reasons.
Might as well put AR-15s into school lockers. Same reason as to why not.
Smh.
Though finding an aiming 4/5 book in a school locker might turn some heads, I feel like aiming 1/2 could be reasonably explained to show up in a school library
Aiming books aren't all that rare because they spawn at gunstores, police stations, military spots, etc.
I've never not found Aiming 3-4-5
Yeah but 1/2
Don't even need the books for those 1-4 levels. Just score hits. 😄
Uses less ammo if you got em tho
Not saying you should, but if you wanted to make a school shooter story event then wouldn’t it make more sense for it to be a civilian hunting rifle?
Or a pistol?
Something a kid would reasonably be able to access in 90s Kentucky due to neglectful parents
I'll not partake in this discussion 🙂
😔
Okay then what do you think about a mod that makes your shoes/socks degrade from stomping zombies
But I might as well give some extra spawn chances for the Aiming and Reloading books in gunstores, PDs and stuff now that I think about it. To the endless to-do list it goes.
Shoes already degrade from stomping tho. Or did that break at B42?
I still feel like library wise it would make sense to have an archery book
I don’t think I’ve seen that in vanilla?
I could be wrong but I’ve always used AStompNerfMod to accomplish that function.
Maybe the mod is old enough to be redundant?
Back in B41.78 I remember my military boots or just boots always losing Condition and I thought it'd be because of me stomping.
Why else would they? Passive Condition loss from running?
Crawler zombies
I think shrubbery too?
Lol, I have never in my 2700 hours been bitten in the boot
I have. It’s an embarrassing way to die
Fence zombie lunges can damage your boots i think
The mod im talking about hasn’t been worked on since 2022 so idk the timeline. Im relatively new to zomboid
Pre-columbine (1999) it would be natural fit students to have hunting weapons in their vehicles, possibly even a school gun club.
Doesn't mean it's an appropriate thing to add in 2024 though
True true, but adding that in 2025 would be meh
Ikr
I feel I'm still trying to get a handle on the start of 2020
20 years ago was the 80s and you can't change my mind
Roleplay context > Modern context
I would rather appeal to the realism of the time the game is set in, instead of letting modern taboos hold back content/concepts
Feel free to mod it in then. 😄
Those would be simple as a handful of table.inserts
Does the school library not spawn aiming books currently?
Universities may, I'm not sure. Bookstores do.
The 90s were about ten years ago, so this checks out.
Some youngling: "How old are you?"
Me: "Yes"
How many people here learned to program using BASIC?
What is "learned to program"?
😂
I make cubes and cylinders in Blender and then twist 'em around until they sorta look like guns and then I type some text.
That is all. 😄
Self taught people are so funny cuz they’ll just do shit until it works right and then people will ask what tutorials were used
Tutorial? What’s that??
It’s me, im self taught people.
I mean this is literally that. I stared at an M60 on my other monitor and made cubes and cylinders.
I was so proud after I managed to put those rounds at the feed too lol
I should learn basic texturing in blender.
I can do a lot with 3D shapes due to 3D printing, but never looked into textures since those are useless for things you will 3D print and paint.
So when are we getting a random chance for a home to have tainted water in the plumbing due to lead pipes? 😎
I've worked with a lot of programmers who studied and got a degree... I'll take a self taught one over most of those.
How many games last long enough for heavy metal poisoning to have an effect?
Getting a degree for programming is kinda funny to me. What do you mean you paid money for a paper that says you have critical thinking skills, the ability to read docs, and use google?
/j I know it’s important for jobs
You could make a mod that does nothing, say it implements cancer from smoking and no one will live long enough to know it's a scam.
I wish they had critical thinking skills and the ability to use google.
Until you have someone smoke 300 packs of cigs and 100 bags of pipe tobacco to try to see the cancer and leave a comment
"You got lucky with the RNG of the mod. Just like in real life, some smokers get lung cancer in a week, others won't get it in 80 years"
Since I dropped out of engineering and got a job I have never been tasked with "solve these short unrelated problems without talking to any colleges or accessing any reference material" but that's what uni based grades on.
Even then, cancer doesn't show up right away
Nicotine poisoning though....
I just say fine, and make it so the moment you have a cigarette in your inventory your character develops skin cancer and dies. Every single save file that has this installed will realize very quickly that they forgot about the mod
I just got promoted to a programming job with no degree; I was loaned out to them for awhile from my previous department and it turned out I've got at least a little aptitude.
Mod bombs are funny but scary.
There isn’t really anything stopping a popular mod author from just one day putting in a function that kills your character outright randomly. Aside from social norms i guess
Spongie is just playing the long con. Soon their clothing will eat the player
And I'll introduce catastrophic failures to my guns.
Imagine being out there just sniping at a few zombies with your 7.62x51 sniper and KABLOOEY
Like that time when Kentucky Ballistics had a .50 BMG literally explode into his neck and chest
Don't trust cheap self-reloaded surplus ammo that's 20 years old
Me when i trust cheap self-reloaded surplus ammo that’s 20 years old
Years ago when playing heavily modded Minecraft there was stupid drama over inclusion in a Modpack when that an author didn't want their mod in so they made their mod destroy the world if it detected certain other mods
Was all very stupid
Oml thats so childish
That's very valid though. Unless given permission, ain't nobody got the right to "modpack" (=steal)
Minecraft modpacks aren’t what zomboid players refer to as modpacks
Yeah, that's a valid complaint but actively destroying saves isn't the right response
Ah. Well I haven't played MineCraft mp so I wouldn't know. But yeah.
Minecraft modpacks are usually more like workshop collections, not reuploads of mods crammed into one mod file
It’s like if you got mad your mod was added into a collection pack
That’s the equivalent
That makes more sense. Yeah then the dev was just being a brat
100%
Imagine you just so happened to be using those mods together and weren’t even playing the modpack that was being targeted
I'm pretty sure that happened to some people
Hit by the crossfire for no reason
I'm sure I can hack an aproximation together or smth
at least I got snow detection done rn
Would it be possible to add in new padding/patch materials? or is that java side
this is confusing me, if I understand this right, instead of returning the vec3 it wants to store it in a var?
Like if I wanted to make rubber patches a thing, would that require actually messing with the game's Java or is it capable of being done with lua/script?
hello im salvatore producer, I Want to Add My Own Music to Project Zomboid Version B42.2 as the Main Melody creating a Mod. How Do I Start? Can Someone Provide a Link or Explain the Folder Structure and Where to Test the Mod? This Is My First Mod.
my current structure looks like this, but at startup it is not displayed in the mod menu of project z SalvatoreColor/
│── media/
│ ├── sound/
│ │ ├── Future_Days.ogg
│ ├── lua/
│ │ ├── client/
│ │ │ ├── SalvatoreColorMusic.lua
│── mod.info
│── poster.png
C:\Users\abc\Zomboid\mods\SalvatoreColor
C:/Users/your_user/Zomboid/Workshop/ModTemplate
does anyone know how to make a recipe not lose items stored in container when being crafted from one container to another?
im assuming its hardcoded in java
im trying to make a carrier vest that can changed colors
but when i try crafting one form into another it causes loss of inventory
is there any way this can be prevented and all items transferred to the new vest?
at-least an option to empty the container before crafting
or smthing
From memory there's a field in clothing objects for cotton/denim/leather, but you'd need to test what happens if you make up a new value (or at least look in the lua for how that property gets used)
Might work, but might also crash the game when the parser is confused or if it's an enum in java
Try adding a new FabricType to ClothingRecipesDefinitions (from lua\shared\Definitions\ClothingRecipesDefinitions.lua) and using that as the FabricType for the clothing script.
I mean sure but then where do the protection values come in?
That is for tailoring patches though
I mean that is exactly what we're talking about tho so
Actually that makes sense - before tailoring 8 you get just the patch, ater 8 you repair and use the base objects's protection
I'm pretty sure the values are also used for padding so
Guessing there's no way for use to poke at this with lua
Interestingly the fabric typoe is stored as a string.
Or maybe an int... so it's possibel it won't crash if you add a new type, but it's not going to work properly.
So last night I was talking about modded cars spawning at prestine condition and fuel, even though settings are setup to only spawn very low condition, apparently the issue is that if the modded vehicles dont have a wrecked version, and the system want to spawn one, it spawns a prestine version 😐 PZK VLC is doing this to me.
Does it apply to burnt versiosn too, or just wrecked?
u can add OnCreate:Recipe.OnCreate.ChangeContainerStyle into recipe script
and this is ur lua code
function Recipe.OnCreate.ChangeContainerStyle(items, result, player)
local currentContainer = items:get(0)
-- after it add items from currentContainer into new one (`result` param = newContainer)
...
end
do i add this lua script or does it already exist in-game?
Recipe.OnCreate table is already exists. so u can just take my example, finish the code after my comment and put into lua file
Mostly Unrealated, but this was a test project I was working on last year, not sure if I will continue it.
im not sure how to finish it haha
im not that good with lua tbh
dont feel bad, coming from C++, lua hurts my brain.
yeah, scripts were super ez to figure out
i could pretty much do everything related to the scripts file
but lua fries my brain. i understand what it's trying to do, but idk where/how the commands come from
like is there commands/code specific to PZ or is it normal lua?
im so confused bout it
Is there a way to add custom clothing to existing zombie outfits or do I have to make all my own?
try this
p.s. rename Recipe.OnCreate.ChangeContainerStyle to Recipe.OnCreate.KeepItemsInContainer
function Recipe.OnCreate.KeepItemsInContainer(items, newContainer, player)
local currentContainer = items:get(0)
local newContainerInventory = newContainer:getInventory()
local currentContainerItems = currentContainer:getInventory():getItems()
for i = 0, currentContainerItems:size() - 1 do
local item = currentContainerItems:get(i)
newContainerInventory:AddItem(item)
end
end
if it works, i'll add u to credits bro. u good with that? 🙂
testing it rn
is CombatManager.getBoneWorldPos accessible in lua?
local visual = item:getVisual()
-- local newItem = instanceItem(itemType)
local newVisual = newItem:getVisual()
newVisual:setTint(visual:getTint(item:getClothingItem()))
newVisual:setBaseTexture(visual:getBaseTexture())
newVisual:setTextureChoice(visual:getTextureChoice())
newVisual:setDecal(visual:getDecal(item:getClothingItem()))
if newItem:IsInventoryContainer() and item:IsInventoryContainer() then
newItem:getItemContainer():setItems(item:getItemContainer():getItems())
-- Handle renamed bag
if item:getName() ~= item:getScriptItem():getDisplayName() then
newItem:setName(item:getName())
end
end
-- newItem:setDirtyness(item:getDirtyness())
-- newItem:setTexture(item:getTexture())
newItem:setColor(item:getColor())
newVisual:copyDirt(visual)
newVisual:copyBlood(visual)
newVisual:copyHoles(visual)
newVisual:copyPatches(visual)
if newItem:IsClothing() then
item:copyPatchesTo(newItem)
newItem:setWetness(item:getWetness())
end
if instanceof(newItem, "AlarmClockClothing") and instanceof(item, "AlarmClockClothing") then
newItem:setAlarmSet(item:isAlarmSet())
newItem:setHour(item:getHour())
newItem:setMinute(item:getMinute())
newItem:syncAlarmClock()
-- Network stuff
-- FIXME: is this done when dropping the watch?
item:setAlarmSet(false)
item:syncAlarmClock()
end
if newItem:getFluidContainer() and item:getFluidContainer() then
newItem:getFluidContainer():copyFluidsFrom(item:getFluidContainer())
end
newItem:setCondition(item:getCondition())
newItem:setFavorite(item:isFavorite())
if item:hasModData() then
newItem:copyModData(item:getModData())
end
newItem:synchWithVisual()
this is the code the vanilla game uses for this when using clothing extra actions so you can copy it to your own function and then use it for the recipe
im not sure how the current recipe functions work but you'd have to grab the original item from the recipe inputs at the start
the container part is here but the rest is normal clothing stuff