#mod_development
1 messages Β· Page 154 of 1
get him
a spawned iterm is InventoryItem
base definitions are ScriptItem
doParam modifies ScriptItem
doesn't that also then modify the spawned item?
so the general rule is: only items spwned while the mod is active have the modification
because I remember changing the deltause and it actually changed it's capacity
on an item that was already existing
BUT, for some parameters, when you look at an InventoryItem it instead forwards the get to the script item
So I was able to take the vanilla cooler and reskin it pretty easily, but this pen model is not wanting to cooperate :/
I arrived at the opposite conclusion π
yeah, that's not been my experience either
Certain ones get saved
really? when I was editing items almost everything updated on an item when I made changes, without having to generate a new one
that was the whole reason I made the mod, because I learned how well it was working, and wanted modders to stop completely redeclaring item defs
I started with B41.41 maybe it changed a little before that
my mod was meant for new modders who didn't know the ins and outs of modding
which scripts are not allowed to be loaded later, like Items since WorldDictionary throws error in debug.
which context is that regarding?
i imagine it's just items, i can't think of any others that should cause issues
WorldDictionnary needs a game loaded to be valid.
cause my code is loading during LUA reload
World dictionary errors are related to items on the ground and model scripts I believe
sorry I'm off context
No
hmm, no, this seems accurate actually
I tried importing the vanilla pen model into blender, but it seems theres nothing there
Name, condition/delta are usually the only things saved
that was my discovery as well
Things that change over time
yeah, i'm looking over the save methods and they're pretty good at only saving things that need to be saved
I changed things like attack speeds using it, and it would adjust accordingly
so I guess the real question is, is doing it clientside better, since it applies before someone tries to join, or when trying to join?
er, OnGameBoot vs OnLoad*
I'll try to figure out to the two issues I was having -- 1. Was anticheat, 2. Was that server or clients were not getting the changes and I couldn't complete functions
hm
i don't think there's very much difference really
OnLoad is only ran when players connect
but does that mean it runs on the server side each time?
i usually do my params in OnInitGlobalModData since it's the earliest event after sandbox options load, but if you don't need them i'm pretty sure you can do them at lua execute time and it'll work fine
For each client yes, but each client seems to have its own scriptManager it seems
I don't think I've ever heard of that one. OnInitGlobalModData
global moddata was added in b41, so if you've been away that one definitely wasn't around
ah that makes sense
yea, I hadn't done any modding for 7 years after some nasty stuff happened.
not gonna get into that though
We've all been through it brother/sister
so should some tests be done to find the optimal position to make changes before I update my mod's page to mention how to do things without using my mod?
Did the other mod mention why it moved it to onLoad?
I posted why on here in quotes a little while ago
Here
I wonder if my mod only works for the first instance of gameplay, then resets to default somehow
IE, load the mods, play, disconnect, then reconnect/reload again? =/
but I'm not sure why it would do that if it's loaded into the actual database
so I could be overthinking things
i'm not really sure i understand that, lua reloads and ongameboot is called every time you load a save anyway? but if i remember right that might not have always been the case
sorry I had to run to store. I couldnt find an emitter for the radio, but is it something like this?
yeah, should be
hmm, this might be wrong
i thought so too, but i've been seeing it reload every time regardless recently, but i'm reading the source and it doesn't seem like it should be doing that
like, if the entire modlist to load a save is already on when you launched, would it still try to refresh the LUA/scripts?
so it might be something weird about my setup
are you talking about my version (obsolete) ? 2510747487
if so I could answer
Not sure -- but sure
yes
mods modifications were not reloaded at B41.41 time when you have the same default mod list as the mod list of your current game. so for modders that change their mods based on ItemTweaker, it saved a crazy amount of time.
That was my motivation.
ah okay, so something changed after build 37, and then again potentially after that
yeah, i was wrong, if the mod lists match it won't reload
i must've been mistaken when i thought it was happening to me
I suppose that's what happens when code never gets tested regularly after 5+ years
That's what I probably experienced
and I only ever tested a single save, then exited the game to make tweaks. I never tried reloading the save after exiting the save
hm..
I make tons of errors every day, please do not take my lines for granted. I may have been wrong all along
if you guys do figure out how to make changes work reliably and for MP, I'll update my mod page to explain to how do it accordingly
7 years out of practice, and have no way to reliably focus on researching this =(
For me onLoad and pnGameBoot if isServer works to fire each once
For SP or MP
And avoids changes on the mainMenu
Which are wasted in the case of scripts
i'm not sure it actually needs any changes for mp, or we would've heard about more problems by now
depends on if the client has the same mod list pre-loaded?
The issue I had was trying to compare scripts in MP
Specific to what I needed at the time
No as the client runs onLoad regardless
I see
And servers runs GameBoot when they're loaded up
when the client joins it should reload lua and immediately fire ongameboot anyway, regardless of whether they had the same mods or not
so for clients instead of OnGameBoot -> OnLoad, and then the server has a version of it on OnGameBoot?
I put it in /shared/
oh it'd do it for both wouldn't it
hm
is stuff like this still possible?
if getActivatedMods():contains("OtherMod") then
end
if getActivatedMods():contains("OtherMod1") and getActivatedMods():contains("OtherMod2") then
end```
Events.OnLoad.Add(shopsAndTradersRecipe.addDeedRecipe)
if isServer() then Events.OnGameBoot.Add(shopsAndTradersRecipe.addDeedRecipe) end```
On mobile, so I may take a while to respond
no problem
For my uses and experiences, firing more than once caused anticheat issues
Then later I needed to compare scripts values in MP and it wasn't updated on one of the ends
I think it was server - but that may have been because I used onGameLoad now that I think about it
Weeks old trial and error π
well you know more than I do at this point.. lol
But the current method I've tested and it only fires once regardless as per the logs printing
I'm going off of build 34-37 memories
would you be willing to share the stripped down code that seems to work for testing purposes?
Once I'm home, sure
for the sake of minimizing future problems?
thanks
if we can solidify that it works, I can tell people to stop modding with my mod, and do it a better way
hmm, from my reading it should fire both on the server, i wonder what's going on there
my mod's been the cause of too many problems for me to feel like it deserves to keep going
also it's more redundant than it's worth now
i'm not really sure it's the cause of the issues as much as the derivatives are
that's the problem
I was using doParam for named Literature where I 0 out literature items
zero out literature items?
the mod designed to stop people from hard overwriting things and causing random incompatibility issues was hard overwritten causing random incompatibility issues 
that is why it was designed yes, but there was no reliable way to stop people from doing it, because so many modders wouldn't read the proper documentation on how not to do it
so the mod was meant to get people to notice there was a different way, and make use of it.. now that there's an official discord and my mod is more well-known, I can use my mod to direct people here, and learn to do it properly
I made the stats for literature items all 0 - and stored their original values as a table
ah
From tests it caused issues when I needed to do some math on server side I believe
But honestly, I'll have to do another test to confirm changes
I was more preoccupied with the mod working lol
Unrelated question: what can I use as an example for Z spawning ?
You and me both -.-
hmm, OnLoad doesn't fire on the server - that makes sense because it's triggered by IngameState, which you would naturally assume the server never enters, but why does it have server-specific code then 
If you are planning to rerelease the API as a new mod - could I suggest adding it to the community projects repo? The benefit of this is that it automatically uploads changes every Friday with no human interference. Given it's maintained. π
hmm yeah, maybe it's before lua loads
no, I'm not gonna rerelease it
I'm depreciating it and telling people to use the code as intended
but was the community project released at some point ?
I have it unlisted but available
There's only debug tools at the moment
But technically it's ready
my mod is completely redundant and unnecessary now. I'd rather just have it gone and people learn how to use the actual existing functions of the game
but I'm not removing the mod so existing mods don't break
True, doParam works but there is some rigamarole to calling scriptManager
wait, you're chuck the sheep?
And as we've seen when it's called it's important lol
Yessir
Ah nice
and a few more
I need to update that too, apparently it's not "military" enough π
you ever figure out the EHE raid siren problem?
well if you want to cannibalize my mod and make it work better, I can just tell people to use your community framework instead
assuming that's better than trusting people to do things the right way
i'm not really sure if there's a need for a 'better' itemtweaker
my issue with it has always been that it just doesn't do very much, it's not really worth a dependency to me
right, which is why I was trying to depreciate it
That's why adding it as a utility to the community may be helpful idk
I'd be curious to test firing doParam in different places
Also - as for the air raid sound we have a patch coming out soon.
nice
I had to remove it from my server cause we got sick of having to restart just to stop the noise lol
Yeah, it was a case of like 6 very tiny oversights -- kept finding a few more each "aha we got it" patches
Hopefully this was it
The issue stems from the fact soundEmitters playing loops can't move and sync across MP - at the time. I haven't bothered testing if that was fixed.
OH yea that makes sense
Sound types of emitters do play across MP I think - honestly sound stuff is really wonky to read through -- some of it disappears into FMOD
there's a lot of redundancy too, i think because of the transition to fmod
The weird inheritances that don't look like any other way classes inherit?
fmod?
i meant stuff like how a lot of the methods just call another method
(Quietly continues to sit in the dark corner in the room that supports a full rewrite of the API layer of PZ)
iirc playSoundLooped just calls playSound and doesn't do anything whatsoever to make it loop
I decided to write my own music engine in the Java code because this stuff is so winding.
Spent a few weeks on that.
It's because it's just that confusing.
Might as well make an API that makes sense, ya know?
Heya guys
it was actually the Impl variants that do this - speaking of, does anyone know what impl is supposed to mean in that context? my instant thoughts of 'impulse' and 'implicit' don't seem relevant
What im miss here?
hey jab quick question why am i not getting tips on the zedscript
What category of script?
sounds like the script is too undead to be helpful ;D
I only support item atm and I think recipe isn't showing atm due to WIP stuff.
Been slamming my head into the keyboard these past weeks optimizing and getting formatting and diagnostics implemented.
damn
im working on the items
Huh...
And you selected the language?
yea
And latest version?
the color changes but no tooltips
Throw me your file. I'll test it.
let me make sure its latest quick
If you don't hear back from me in say.. 6 hours, please ping me.
First bug report. yey
Sent where?
dm
I manually typed & transcribed the PZWiki and improved some of it for the extension.
If the tooltips don't work, use this for the time being.
glad you stepped up to that lol that is a lot of work
This is what I'm good at. Thanks.
Heh, my super old mod Vanilla Weapons Expanded just fires the script manager changes on Lua in shared to no detriment
I don't even use events
The savagery
Oh yeah, that's something that requires OnLoad/onGameBoot afaik
Trying to make a recipe dynamically generated using a string sandbox option
Does not work if I use onGameBoot in SP if I don't have the mod loaded in main menu
Just uses the default value
Also having issues as the recipe isn't Base
The ingredients show up, but stay faded if they're not fullType
I have it import Base so I'm not sure why it's a problem
there's a function that resolves that in RecipeManager
maybe the one that prints "forgot to import Base"
Hmm I'll try that out
I was going to parse the bits myself
Since it has keep or destroy optionally
Otherwise asking they use fullType should be enough - as players will totally read the sandbox options tooltip 
Curious as I'm using ParseScript - I'd assume it does the same internally
Perhaps there's a pre-step
Sorry to butt in on this convo. I'm trying to figure out if there's a way I can modify food on their use? I saw there was an event called onItemUse but it's deprecated.
So like, my use case for example is, if a food is being eaten, check if it's foodtype vegetable, if so, multiply hunger loss by 1.5
But as far as I can see, there's no event for that unless i did it tick-by-tick, and checked to see if there was a state-based var in the player called IsEating or something
you should hook the eating timed action
:/ I'm not sure what I'm doing wrong. I'm using the same structure as zomboid has for this pen model. Still refusing to show up, everything else is working though
what's your change to the item look like
i renamed the model and texture. Only thing I did was color the texture in black instead of the blue i think it had before?
its textureless and modeless
still stabs, its just invisible, placing it on the ground just leaves the icon
do you have a model script?
yeah, i copied the vanilla one and replaced it with the renamed model
the cooler i did earlier in the mod works, but this pen just isn't having it
PZ might lose me for a while. I played RimWorld on Sunday. Big mistake.
don't you need to do some lua to actually assign things?
unless that was Jab's old system -.-
What a throwback. Dear lord..
lol
so I didn't see any lua for weapons when i was digging around in the zomboid media folder
pertaining to the model that is
omg hahahahaha
I still have a picture of the first custom weapon model ever in PZ by a mod (ORGM)
might not wanna keep cluttering this channel with pictures though
so if this was a bad move for us, sorry
@fading horizon Did this for an entire day in here lol
oh lol
you shouldn't need any lua to set models
k, so i didnt miss that
yea must of have been the old unofficial framework we worked on in 2015 lol
can i post my model script, or would that be too obnoxious?
Would anyone be able to point me to a guide or give me a run down on how to cause zombies to spawn with specific clothing.
Developing something for a rp server of mine and when the players go to certain areas would like the zombies to spawn specifically with for example Hazmat Suits or Cultist robes or Scientists Coats
Yeah the cult robes from AuthenticZ are awesome i need to know how i can get for example a specific type of zombie or all zombies to spawn with that specific clothing item
....what
AuthenticZ spawns some zombies with a full costume
try looking in there for how they did it
I have been looking through it and tried some things myself but cant get the items to spawn specifically on certain or all zombies
er
For example if the rp event i bring the server up for could have all zombies spawn on that specific map for that day spawn with hazmat suits, then a special infected like from CDDA or Death Knell a mod that spawns a specific zombie type with a % chance spawn with the outfit of a scientist so lab coat, suit pants, shoes
Item scripts' OnUse is depreciated? @trim mist
This could be for a specific server file i just use for that event, players make new characters on a new server with their other characters names and stats, then the servers only map is the rp place i want it to take place, then the zombies with the specific outfits only spawn
yea okay, so authenticZ does it in a multi-step
I don't even know exactly how it works.. damn
Its all good i appreciate you taking the time to read my message and any help or advice you could provide, no stress if its to complex
using oneat would work, but would prevent compatibility with other mods that also use that approach
according to the wiki, yeah
there's an onEat?
guh
does anybody know where in the java docs events are?
so im looking at the vanilla model script for the pen, and they capitalize the w for the weapons folder, but its not capitalized.....
it's not an event, it's a script property
but you can find a nearly up-to-date event list here https://pzwiki.net/wiki/Modding:Lua_Events
that's what i was referencing lol
Yup.
sounds like you have another fan
nice. I like how the example is cigarettes
Oh true onEat would break if multiple mods use it
You'd have to do an automatic overwrite somehow using something like itemTweaker :9
AFAIK I'm the only person to write support the scripting format.
stop mocking me ;P
well..........i've got the default pen model to show up now with the weapon :/
You could add a function to OnEaten for the relevant items
I'd rather not interfere with other mods if I can help it
I'm just... trying to figure out how to hook a new function into this
#mod_development message I'm looking at this message but i'm waist-deep in the java docs trying to find what the appropriate function to extend is
hrm........model appears now, but its not applying my custom texture to it
anyone know a good site to look at a list of distribution containers
Look into Distributions.lua and ProceduralDistributions.lua directly
anyone have an idea of where I could look? I see this https://projectzomboid.com/modding/zombie/characters/CharacterTimedActions/package-summary.html
but there's nothing specific to eating. I'm guessing that's initialized using this format but idk where i'd find the actual eating timed action to extend
declaration: package: zombie.characters.CharacterTimedActions
for now I just have this. of course I don't know what the actual TimedActionEat function is lol
Why go for the java side of things? Check media/lua/client/TimedActions/ISEatFoodAction.lua
hey guys! I'm trying to add another "module" to my already existing mod, for user to choose between both.
Can't find info over the net but I see a lot of mods have different modules. It is just upload an existing mod from inside the game?
how do i target certain zombies to spawn certain loot
maybe I don't understand, but you can put multiple mods in the same workshop folder.
they knew has some code for it
ill check it out see if i can figure something out
this also results in a lot of headache for the mod author because there's no option to make them exclusive.
I'm looking in the file (and would post in here, if that's okay?) and don't see where hungerConsumed is actually applied. is it through this function?
i mean, there's this in that same file
so i dunno if there's an eat function attached to the character that fills based on the amount of time spent eating, vs. is applied at the end of the action
but i'm pretty sure if the former is true, i want to modify that one
Hello! does something knows if there's something like getClothLayer or something like that to know if a worn item is in an inner or outer layer?
The hunger math is probably handled in java, but that doesn't stop you from adding the extra hunger bonus when this action is performed
you can hook the IsoGameCharacter.Eat but it'd basically be the same thing either way
i don't think you can eat any way other than the timed action
ah yeah that must be... so I just upload and choose "update existent" instead of "create new"
Make sure both mods are inside the same folder's Contents/mods/ in your Workshop folder
thanks! π
adding texture to the model script should make the weapon use it right?
where are the icons of vanilla items stored in the folders?
in packs, probably easier to pull them off the wiki though
ah, gotcha, yeah i'll do that then
still having trouble sussing out exactly what to modify
Jeez, i've been staring at this for an hour lmao
My best guess is that the timed action restores hunger as it's performed, but... I have no way of confirming that. plus, in game I see moodle updates after eating is completed so
that's what the eat method is doing
in isoGameCharacter?
yeah
let me see if I can find that
you can't really modify how much hunger it gives, but you can just hook it and give extra independently of it
for sure, that's what I wanted to do--I wanted to tack a percentage on top when it applies
Sorry lol I just get excited
here it is in the documentation. I don't think this is findable in the code i'm able to look at.
I need to come up with a good item to include in my goth bags recipes so the user isn't bombarded with 20 crafting options every time they right click a leather strip
Any ideas?
Maybe black paint? I think that's in vanilla
You could straight up create a leather strip used only by your mod, and give the option to convert between the two
people right click on leather strips normally?
you could have it just make a base color like brown, then let there be a recipe that uses the bag + paint color
I'm not going to retexture 25 bags to brown just for that honestly
I think I'll make a recipe to turn leather strips into black leather strips
And use that for the backpacks
ah, sorry didnt know what colors you had
Yeah it's a lot
I'm going with crafting recipes because I'm scared of flooding the loot tables with all the items
haha, that'd be funny. "why is there so many goth bags in these school and policeman lockers"

containers in schools like desks and lockers used to contain copious amounts of cigarettes.
@ media\lua\client\TimedActions\ISEatFoodAction.lua,
self.character:Eat(self.item, self.percentage);
What file / code line sets the size a zombie appears on your screen, if you were looking to make like a huge L4D tank like zombie that was actually bigger than normal zombies?
forageSystem = forageSystem or {};
function RemoveForagingDefs()
local PeanutsDef = forageSystem.itemDefs["Base.Peanuts"];
forageSystem.removeItemDef(PeanutsDef);
local SunflowerSeedsDef = forageSystem.itemDefs["Base.SunflowerSeeds"];
forageSystem.removeItemDef(SunflowerSeedsDef);
end
Events.OnGameStart.Add(RemoveForagingDefs);
Why does this code cause the foraging system to spit out tons of errors? It looks like the example code for the function in forageSystem.lua.
attempted index: altWorldTexture of non-table: null
STACK TRACE
function: new -- file: ISForageIcon.lua line # 180 | Vanilla
function: loadIcons -- file: ISSearchManager.lua line # 1013 | Vanilla
function: update -- file: ISSearchManager.lua line # 1240 | Vanilla
function: onToggleVisible -- file: ISSearchManager.lua line # 125 | Vanilla
function: setVisible -- file: ISUIElement.lua line # 579 | Vanilla
function: toggleSearchMode -- file: ISSearchManager.lua line # 1456 | Vanilla
function: onMouseUp -- file: ISButton.lua line # 56 | Vanilla
ERROR: General , 1682458217242> ExceptionLogger.logException> Exception thrown java.lang.RuntimeException: attempted index: altWorldTexture of non-table: null at KahluaThread.tableget line:1689.
ERROR: General , 1682458217242> DebugLogStream.printException> Stack trace:
java.lang.RuntimeException: attempted index: altWorldTexture of non-table: null
at se.krka.kahlua.vm.KahluaThread.tableget(KahluaThread.java:1689)
at se.krka.kahlua.vm.KahluaThread.luaMainloop(KahluaThread.java:492)
at se.krka.kahlua.vm.KahluaThread.call(KahluaThread.java:163)
at se.krka.kahlua.vm.KahluaThread.pcall(KahluaThread.java:1980)
at se.krka.kahlua.vm.KahluaThread.pcallBoolean(KahluaThread.java:1924)
at se.krka.kahlua.integration.LuaCaller.protectedCallBoolean(LuaCaller.java:104)
at zombie.ui.UIElement.onMouseUp(UIElement.java:1228)
at zombie.ui.UIElement.onMouseUp(UIElement.java:1183)
at zombie.ui.UIManager.update(UIManager.java:816)
at zombie.GameWindow.logic(GameWindow.java:262)
at zombie.core.profiling.AbstractPerformanceProfileProbe.invokeAndMeasure(AbstractPerformanceProfileProbe.java:71)
at zombie.GameWindow.frameStep(GameWindow.java:765)
at zombie.GameWindow.run_ez(GameWindow.java:681)
at zombie.GameWindow.mainThread(GameWindow.java:495)
at java.base/java.lang.Thread.run(Unknown Source)``
This is the error that gets spammed due to removing foraging itemDefs.
Much appreciated, i meant the eat function inside of IsoGameCharacter since that seems to be where hunger is actually applied
to see the java code, you need to decompile it.
moving objects
so its used for the trait that knocks down zed when come in contact with player... right?have you used it?
i've never used that mod
or that event
i think for zombies it would be OnCharacterCollide
steam is down
it's maintenance day
So question for someone not in software development and does this stuff as a hobbyβ¦ if you decompile the game codeβ¦ is there some other program you can idk βopenβ those files and be able to access all the custom classes, functions, etc? Am I making sense?
that's what decompiling is for
you can just open them in whatever you're using to code, preferably a real ide though
Decompiling allows you to read the code. not to change it. Does that answer your question ?
IDE? Iβve been doing everything with notepad 
notepad++ at least...?
Yes, apparently at the very least 
What should I be using fr?
I feel like Iβm about to have my mind blown and realize Iβve been living in the stone age this whole time
my preference is intellij idea, but vscode is free, popular in the pz community and pretty great for lua
Unless we're recompiling java like oneline8 does with their SSR mods, Notepad++ seems great enough for lua (to me). What am I missing Albion ?
Ohhhh is that what visual studio is? I might have to figure that out I guess⦠I tried installing it once and got overwhelmed by all the settings so I quit⦠is there certain things I need to install with it to mod zomboid?
visual studio and visual studio code are pretty different programs

notepad++ doesn't really have intellisense or project management stuff iirc
You can always use the PipeWrench typings...
: unhappy:
I'ma get all of you to use vscode muhahaha
Iβll use it. Anything special I need to do with it for zomboid modding or is it ready to go out of the box?
I don't know what the proper answer is for PipeWrench, but for Lua modding the lua-language-server plugin should suffice. If you want intellisense for PZ stuff, pz-zdoc works with some modifications to the .bat/.sh file
For scripting get my extension ZedScript
I'll always be a broken record for PipeWrench
Lol
It's not for everyone
If you like Typescript then ohhh boy
Where might one find this?
Heyo quick question for any clothingitem makers in here, what decides the body part coverage for clothing items is it the BloodLocations or the Bodylocations?
for like temperature and stuff? that'd be blood location
Vscode extension tab in the editor
I assume that applies to protection as well; thank you for the answer!
Idk where you should ask this this is just something that players should know?
I mean its not tech problem
Doesnt belong to mod support or mod dev
I guess its just a general chat concern?
Anyways to answer... if youre playing so you can only do it once
So if you installed a mod with sandbox
And you refuse to create new game
Then you are stuck with the defaults
If you play mp
Then admins can modify it anytime
Same with local hosted
You can modify it anytime. Too
@drifting ore
Iβm pretty sure thereβs a sandbox option for always locked carsβ¦ not sure about the alarm though
Ah
you're in the right place
Ahh
I think people were discussing/debating if vehicles kept modData - but you could apply a function and flag to not apply the function again as you come across cars
Yes you are
Sorry bout that
they do, but previously didn't
That seems to always be the case for stuff people disagree with lol
i'd heard from someone that moddata could only store numbers and strings, but i found the patchnote from when they changed that... in 2013 
If I'm trying to make a zombie outfit with a mix of vanilla and my modded items, do I just include the guid of the vanilla item, or do I need to redefine the vanilla item in my fileguidtable?
Blair approachith
You can just include vanilla item's guids along modded - I think if you do include modded ones that are not available it doesn't break anything as well
Perfect
You probably can have all vehicles alarmed and locked at spawn by tying into the Create function for a car part that all cars have, such as the engine, and setting the vehicle to be locked and alarmed there.
If youre making all cars lock by default then you dont need the sandbox setting. In fact you will bypass it
I guess
I dont know where exactly it is tho
Im mean what tells the car if jts lock or not
But i think its easier to look for the function where you try and entwr the vehicle
Check if lock
If true trigger the alarm (doesnt need to set it if you can force it to trigger)
Apply moddata so next time it wont trigger again
And if I include a probability for several backpacks, will there be a case where two of them spawn?
Or multiple
Or is there a way to force a table of items to only get one?
uh
if outfits already don't have a means to random select from a pool - the hacky way I can think of would be to create a dummy item that replaces itself
I dont think so but you can probably remove one when a player discovers the loot and see if there are 2 bags?
i'm sure they must not allow multiple clothing items from the same slot
It would be simpler than any other solution proposed or that I can think of.
hmmm
both good ideas
i think dummy item is the easier approach
since i'm not sure how to do the discover loot thing
but ive done a dummy item in my vape mod
or at least tried to lol
Unless they add an onCreate or onLoad event for cars, you'll have to rely on the parts as Blair says
What can be simple to one person can be practically impossible to another person.
Such is the nature of modding.
Only have a few spawn able the rest craft able
I think theres an event when it does the roll? Not sure tho
You could also tap into the 'attempt to unlock door' event - and set a value in the car's modData to 'true' and apply a locking function - bypass repeated calls to that function if the value is already there.
I thought your problem was having 2 of the same kind spawnning
Anything you do Jake is gonna take a bit o learning and trial and errorβ¦. Might take a few days
And just when you thought youre almost done
Bam roadblock
Kidding not ment to discourage
Just reality
And it takes another level of effort to overcome but that depends on the mod
But as you can see the community is willing to help
So you wont be alone doing what you do
Would anyone know if there's something that has a list of all loaded script modules? I don't see one in scriptManager
There's a list but it's private

Is this for api ? Or shop?
Just curious
shops
since the dynamic recipe doesn't seem to play well with modules I was going to write my own parser to add Base. if not present and if getItem() returns something
you could make a list by looping through all items and checking their modules, but 
Speaking of Base, I should see how it behaves with Base as the recipe's module
i think the debug item spawner has a list of modules formed basically that way, but i don't know if that code runs outside of debug?
If you have a mod.apple
And base.apple
And you Additem('apple')
What would you get?
base.apple
it grabs base first yeah
if my Base recipe has a modded item as a result - do I need to import the modded module?
if the module isn't written out, i think so
I do have it
the recipe didn't appear if I made the module Base
heh
I imported the modded module
but sure enough the recipe can't be activated if the sandbox option doesn't include Base.
This feels like a very specific vanilla bug
function InjectPropital(Items, result, player)
local timePassed = 0
local delayInSeconds = 1
local iterations = 20
local function update()
if iterations > 0 then
iterations = iterations - 1
local player = getSpecificPlayer(0) -- Get the first player
player:AddGeneralHealth(5) -- Increase the player's health by 5
print("Iteration:", 20 - iterations)
end
if iterations > 0 then
-- Reschedule the update function to run again after delayInSeconds
Events.OnTick.Add(update, math.floor(delayInSeconds * 1000))
else
-- Remove the event when iterations are complete
Events.OnTick.Remove(update)
end
end
-- Schedule the update function to run after delayInSeconds
Events.OnTick.Add(update, math.floor(delayInSeconds * 1000))
end
so this code alone creates a delay in the function applying an iteration that will repeat till its done but so Events.OnTick.Add/Events.OnTick.Remove is not a project zomboid modifier, what would i use instead?
You don't necessarily have to remove it
well no but what is the modifier that i can use for an OnTick
Not sure what you mean by modifier
so Events.OnTick.Add is not an actual call in the lua code for zomboid
well... no, it is
i need something to replace it that zomboid would recognize
Well, you aren't defining an argument in update(), but other than that sure
it would be update(player) id assume
yeah, giving Add two arguments doesn't make sense
actually yeah true
I'm trying to teleport the player when the player's health is too low. Everything works fine when the player dies from bleeding or when zombies kill the player. But in pvp situation, if the dying character teleports and the other player hits again, all functions work except teleport. To prevent this, I tried making the dying character ghost, but it didn't work.
Any ideas?
I reviewed this for teleportation: https://steamcommunity.com/sharedfiles/filedetails/?id=2892401130&searchtext=FastTravelMod
require "lua_timers"
function OnPlayerDead()
if isTeleporting then return end
local player = getPlayer()
local playerBody = player:getBodyDamage()
if playerBody:getHealth() > 10 then return end
player:setGhostMode(true)
player:setInvisible(true)
player:setNoDamage(true)
isTeleporting = true
player:dropHandItems()
--player:playEmote("salutecasual") -- ??
-- drop items here
local gridSquare = player:getCurrentSquare()
-- heal player
playerBody:RestoreToFullHealth()
player:playEmote("salutecasual")
player:setX(8594)
player:setY(10916)
player:setZ(0)
player:setLx(8594)
player:setLy(10916)
player:setLz(0)
timer:Simple(5, function()
player:playEmote("moveout")
player:setGhostMode(false)
player:setInvisible(false)
player:setNoDamage(false)
isTeleporting = false
end)
-- Other functions like drop items, add pain, add bills etc....
end
Events.OnPlayerUpdate.Add(OnPlayerDead)
might need alittle explanation as im still learning the coding for lua
i'm sort of confused about how this is supposed to work
was creating a function so that when a player takes (will use stempacks as the word here) a stempack it would add health to the player over time rather than all at once
local propitalIterations = 0
function PropitalEffects(player)
if propitalIterations > 0 then
propitalIterations = propitalIterations - 1
player:AddGeneralHealth(5) -- Increase the player's health by 5
print("Iterations:", propitalIterations)
end
end
Events.OnPlayerUpdate.Add(PropitalEffects)
This is basically all you need to do to handle effects over time -- but note this is horrid for scalability and adding more effects
Also you'd need to check if the player is dead
how would you go about checking that
Someone recently released a drug mod - perhaps it would help to look at that?
player:isDead() I believe
if your talking about The Krak Inn's drug mod i wrote most of the code for that one lol
How did you handle added effects if any?
thats what im tring to add now XD
atm we just have laced drugs where when taken has a random chance to kill the player
. _ .
this is the first time im working with a function that would be a spanded period of time
Well the above example would work - but if you're adding more than 1 type of drug you'd need to make it more of a table you can scan through and also learn how to mess with player's modData
well each drug has there own function as they all apply there own stats
so that strip of code would go in each of the drugs functions
My suggestion for the sake of your time to maintain the code would be to overlap as much as you can
Would be alot easier if you use a general function that calls on a table of effects
any drugs that do the same thing do apply to the same function
would have to look into this
wait
if i create a new outfit and only include my new backpack, the rest of the clothes will just be vanilla?
i'm looking at how another mod does it and it only adds their item
but ive seen that zombie in game and it wears clothes
---Contain all code within a local table to be returned later
local drugs = {}
drugs.Effects = {}
function drugs.Effects.Propital(player)
player:AddGeneralHealth(5)
end
function drugs.Effects.Crack(player)
player:Say("this crack is good")
end
---@param player IsoGameCharacter
function drugs.onUpdate(player)
---check if player is dead, if so return/stop
if player:isDead() then return end
---grab the player's modData -- free table given to all objects to add values to
local pMD = player:getModData()
--define this sub-table to modData as itself or an empty table as a means to initiate it
--we use a sub-table as to not clog up the main table
pMD.krakInsDrugMod = pMD.krakInsDrugMod or {}
--define a sub-sub-table as itself or a new table
--we use a sub-sub-table so that we can add other sub-sub-tables if needed in the future
pMD.krakInsDrugMod.iterations = pMD.krakInsDrugMod.iterations or {}
--define a local variable with a shorter name
local drugIterations = pMD.krakInsDrugMod.iterations
--for loop through a set of keys/values with in drugIterations
for drug,iteration in pairs(drugIterations) do
if iteration > 0 then
drugIterations[drug] = iteration-1
local func = drugs.Effects[drug]
if func then
func(player)
end
else
drugIterations[drug] = nil
end
end
end
Events.OnPlayerUpdate.Add(drugs.onUpdate)
---Return the table so it can be called on using `require "<this file>"`
return drugs
This should help you get started
When you "use" the drug you just need to add to this modData's iterations
You can change drugs.Effects and drugIterations key's to match item types
anyway, I gotta go
The onUse functions have to be in a separate file and global
local pMD = player:getModData()
pMD.krakInsDrugMod = pMD.krakInsDrugMod or {}
pMD.krakInsDrugMod.iterations = pMD.krakInsDrugMod.iterations or {}
pMD.krakInsDrugMod.iterations[DRUG] = 20
Where DRUG is a string based on the item used - should also match the entry in effects
@fast galleon wait. When the perform function of a timed action is called, does that mean it's finished?
referencing this image
I was looking at a different mod that modifies the eat food action and they did this
yeah, perform means successfully completed
I learned a lesson to not rush through things. Forgot to watch my syntax and felt dumb afterwards trying to see what i did wrong
Hey guys wanna learn PZ Modding anyone have a suggested video or guide?
Taking the plunge. I'm learning x86 assembly.
Where the fuck did this come from??? I assumed no one did UML in PZ modding except me..
lol
random russian guy copied the whole TimedEatAction file and added that one line
Haha.
i found it on steam under "food heals you" mod
The more UMLs out there the better.
Okay. Here's my idea for making food of a certain type do more hunger restoration. Tell my why this wont work lmao
I have to go to bed
Made my first mod, simple reskin of one of the sledgehammers, however when I load into PZ the sledgehammer itself is invisible and I get a warning for 'MeshAssetManager.load'. Double checked the mod folder, the scripts, the textures and FBX file. Dunno what is breaking it haha.
hmm after reading through here wondering if my offset value is off even though i pulled the value from the vanilla sledgehammer
i wouldnt recommend referencing that mod.. its messy .. i mean the way i wrote it..
here wrote this for you
local function teleport(player, destX, destY, destZ)
player:setX(destX)
player:setLx(destX)
player:setY(destY)
player:setLy(destY)
player:setZ(destZ)
player:setLz(destZ)
end
---@param player IsoPlayer
---@param source STRING
---@param damage FLOAT
---@param x, y, z coordinates
local function ouch(player, source, damage)
local x, y, z = 12304, 6757, 0
local threshold = 20 --20%
if player:getBodyDamage():getHealth() <= threshold then
teleport(player, x, y, z)
end
end
Events.OnPlayerGetDamage.Add(bounce)
--Glytch3r
--Team Orbit
maybe #modeling knows
Will try there ty
for the eat you need to hook / patch both stop and perform since they both make the character eat the item. You can then edit the food item's properties or replicate what happens when you eat something.
The guide by chernobill also works, but it will not decompile everything because last version of Intellij breaks in some classes.
Hey guys would there be any source of documentation or a module on using a database for PZ?
Is there a way to disable spawnpoints in a mod if a soft mod dependency isn't in the mod list?
For my MoreLZ mod I was wondering if there was a way to add Raven Creek spawnpoints that only show up if the Raven Creek mod is loaded.
Failing that I'll just release a different mod for with the spawnpoints
You might be right
Managed to get my sprite to load into a SP world, the static model to appear on the ground, and it still functions as a sledgehammer/has all the right noises. Cannot get it to appear in my char's hands. Any ideas what I'm missing in my scripts? First mod btw.
For inhand you need to make the WeaponSprite the inhand model
I'm at a loss haha
Would that fix the MeshAssetManager.load warning I get? It doesn't throw a code, just a warning
You might find more knowledgeable people in #modeling tbh
I would presume there's a model script that's not right
Specifically the mesh param
Okay will try there ty
woooo
your daily suffering π good luck
I don't know how people can work in such messy files.
lol
ctrl+c / ctrl+v team
Heya guys
is there any simple way to add foraging item in the forage definition ??
or do I have to copy the vanilla forage definition .lua and edit it then overwrite it ?
i know when i insert item distribution, i can use table.insert
is there any way to do the same for foraging definition?
I'm not sure I've seen a guide that focuses on forage definitions. Maybe you can make one. π
i mean it looks like this
looks way diff. than item distribution list
which is
table.insert(SuburbsDistributions.all.inventorymale.items, "WURO_items.Valentine")
table.insert(SuburbsDistributions.all.inventorymale.items, 20.0);
if I do that
i know ill be adding "wuro_items.Valentine", 20.0,
but how would I add the " = " sign??
since in foraging def. it has minCount = 1,
or can I just do ```table.insert(forageDefs, type = "Base.Avocado")
table.insert(forageDefs, minCount = 1)
actually table.insert(forageDefs.Avocado, type = "Base.Avocado") table.insert(forageDefs.Avocado, minCount = 1) ???
If it's a Lua table editing it is possible
Just require the original file
Insert only applies to unkeyed tables
Otherwise you'll have to use existing keys or define new ones
forageDefs.Cherry = totally new table if you wanted.
forageDefs.Cherry.minCount = 2
Would change that one value
hmm i see
so if i want to create a new type within Cherry = { } table
i can do table.insert(forgeDefs.Cherry.type = "Vege")?
Still java 17?
how about this API idea:
- read document in a language like russian
- translate to data format that can be viewed with programs like excel
- normalise values based on similar items
- generate ZedScript
What do you mean?
For decompiling the zomboid code, we're up to java 20 now but the guide says 17, my time with minecraft tells me to ask and double check lol (presetup, Setup the new project step)
bueno
No, it doesn't use insert
If this was Minecraft I'd recommend a plugin I wrote for recursive language packaging.
forgeDefs.Cherry.type = "Vege" that's it
table.insert(t, thing) is the same thing as t[#t+1] = thing.
You can control position with a second argument -- but I don't think you'd use insert for keyed tables as keyed tables don't have an order.
Because Lua is so screwed up.
Table is array and dictionary and object and and and
It's all tables all the way down
hey
I've used copytable to make Lua tables more like objects
It's very handy for modData structures
Too bad I wrote my own copy table before being told PZ has one already 
We need these birds for B42: https://youtu.be/R6iJtF8SO5I
Lyrebird is one of the most unique in the world. the super lyrebird can mimic almost any sound, from a car alarm, chainsaw, even laser gun.
#shorts #lyrebird #bird #birds #nature #animal #animals #animalfacts #animalshorts #animaldocumentary
To make a buildable storage container (Like the base game crate) do you need lua? I did some digging around in the base game files but couldn't find a section with the crates.
yes, buildings include 2 things. Lua part for building and a tile part for adding tile to game.
Tile part should be completed, But I believe I am missing code to allow you to actually build the object and have yet to find anything to help me create it.
the carpentry menu for building must be an old system, it's rather hardcoded from what I remember. You could check how other mods do it, I think there's some that add a lot of building options.
There's scripts for multistage building but I've never used that system.
https://pzwiki.net/wiki/Scripts_guide/Multistage_Build_Script_Guide
A simple way is to make a recipe and then players place the object. Probably best options if it's a moveable tile.
So I can make it as a recipe and then place the item? I have done this with 3d model items but not from a Tilesheet.
https://github.com/radx5Blue/ImmersiveSolarArrays/blob/3eb578c27ca653b3aba267d104b7109d046eaaba/Contents/mods/ImmersiveSolarArrays/media/scripts/ISARecipes.txt#L96
this is a recipe for a moveable, "place" a moveable item has a different meaning from "place" an item.
I can work with this I believe, thank you.
Hello! I made a mod but have some issues with it, I managed to upload it to the steam workshop just fine but when I try to enable it ingame the mod disables itself and there's no "reloading lua" notice in the top right corner of my screen, is there something I forgot to do when creating it? I hope this doesnt sound dumb, but when making the mod I didnt create a "lua" folder since I didn't know if I'd need it (all the mod does is add three new food items and recipes), is that why I can't enable it?
Has anyone used this guide?
https://github.com/Konijima/PZ-Libraries
Is it possible, when creating the mod, to not have access to all the methods?
The truth is that the autocomplete helps.
But I don't know if they are still working on it, or if I extracted the information wrong.
it usually fails on some files
i've never noticed anything specific on the java going missing, but i have noticed it fails on the vehicle commands lua file
Is there any other autocomplete method?
I was looking at a project in typescript I think.
If I remember correctly, it was that one.
But I have not tested it.
You're not forced to include a lua folder. Do you have a mod.info file in your mod's folder?
Yeah, it has a mod.info file. Should I send a screenshot of it here?
You should paste it using back-ticks
alrighty
name= Salt's Milanesa mod poster= poster.png id= MilanesaMod description= Adds milanesas to PZ
this is it
Yummy, milanesas, can it be with pureed?
What determines the blood overlay used on a tile? Is there anything simple I can change (especially in tile properties) to change or remove the blood overlay for a specific tile?
Having to throw away around 600 lines of code which was ~10 hours of work.
Oh well. Onto the next line.
Got to get a working linter for ZedScript. >=/
anyone knows how to remove equipped ZedDmg without clearing the inventory]
It might be stupid question but is there a official "name" for Two hands as a slot? by that i mean that Primary hand is called firstHand, Secondary hand is called secondHand (at least in mod im trying to learn from). Im trying to learn by looking at one of the mods that allows you to change one weapon into other while keeping it in primary hand, and after change the weapon remains in that hand, however the code for it uses firstHand and secondHand names for it and i wondered if there is name for when i'd like to make it work but for Two handed weapons to remain in both hands after change?
two handed weapons are just in both
Release when
You better have sanguches de mila put into it π
you taliking about dhert's mod?
brutal handwork
check out how bleach removes it
There is mod Undead Survivor, and it has a knife in it that allows you to use it in diffrent ways (Swing or stab, it simply replaces one item with another), however this mod includes lua script that makes it if you have weapon in your right hand and you "change(swap item)" it replaces it with other item but its still in right hand
i managed to reproduce it with my item, however item im using is crowbar and its two handed and im not sure how to make it work to put in two hands, so i thought im missing name of slot for both hands
you just use both slots
function InjectHemostatica(items, result, player)
local bodyDamage = player:getBodyDamage();
bodyDamage:setBleedingTime(math.max(((bodyDamage:getBleedingTime()) +(10)),0));
end
so on its own this strip of code should work but its not, is setBleedingTime not a bodyDamage? iv tried stats as well and it wont work
it's BodyPart
so player:getBodyPart?
BodyDamage:getBodyPart(BodyPartType type)
just replaced it to local bodyDamage = player:getBodyPart(); and it didnt work where you have Bodypart Type how would you cover the whole body?
what do you mean loop through, im sorry im still new to lua
local bodyParts = bodyDamage:getBodyParts()
for i = 0, bodyParts:size()-1 do
local bodyPart = bodyParts:get(i)
bodyPart:setBleedingTime(bodyPart:getBleedingTime() + 10)
end
you might need a lower value than 10 though, i think this is the same as a max severity scratch on every limb
but how does this call to the player in the function?
you get the bodyDamage from the player
i didn't include that part since it would be specific to how your variables are named
i feel like i might not be understanding how that function works then π¦ im use to simple functions.
So where you have for i = 0, what is that calling too?
or what is that defining
that's a for loop, it loops adding 1 to i each time until i is greater than bodyParts:size()-1
so its like an over time effect?
no, it happens in one frame
ah okay cool
getBodyParts() is a list of all the player's body parts, so when we loop i from zero to the size of the list (minus one) and use :get(i) it does the code to every part
normally you loop from 1 in lua, but getBodyParts() returns a java array so it starts from zero instead
okay so there is an existing table already that we are just calling too
yeah, pretty much
doing array:get(i) is the java array equivalent of doing table[i] to a lua table
so i was told never to copy and paste code unless you know what it does, i tried your strip of code thinking i knew what it was doing but it still throws an error >.<
what im trying to get it to do is when you use a said item, it slows the bleeding down
oh, the way it is now it'll actually increase bleeding
bodyPart:setBleedingTime(math.max(bodyPart:getBleedingTime() - 1, 0)) would probably be closer to what you want
but i don't think that's related to it erroring
function InjectHemostatica(items, result, player)
local bodyParts = bodyDamage:getBodyParts()
for i = 0, bodyParts:size()-1 do
local bodyPart = bodyParts:get(i)
bodyPart:setBleedingTime(bodyPart:getBleedingTime() - 10)
end
end
this is what i have so far not sure if i missed something or im calling the wrong things in the function
add to the start
local bodyDamage = player:getBodyDamage()
function InjectHemostatica(items, result, player)
local bodyDamage:getBodyDamage()
local bodyParts = bodyDamage:getBodyParts()
for i = 0, bodyParts:size()-1 do
local bodyPart = bodyParts:get(i)
bodyPart:setBleedingTime(bodyPart:getBleedingTime() + 10)
end
end
so like that?
that worked thank you @bronze yoke you are the best β€οΈ and you explain things very nicely β€οΈ
can y'all think of anything to add to my mod preview image
i feel like its too plain
it looks great to me
will this replace the existing type and overwrite the one I put?
I have this code that im trying to get to add health to the player. I can take the item but it doesnt add the health. Am i missing something? ```lua
function InjectPropital(items, result, player)
local stats = player:getStats();
local bodyDamage = player:getBodyDamage();
local char = player;
player:setHealth(math.max(((player:getHealth()) + (10)), 0));
end
the original idea was to do health over time but i cant figure it out
is player health range from 0 - 100?
I was thinking it was
Might be in a better situation since I started rewriting my linter.
Took a different approach with my recursion and it seems to be holding up with nested scopes. The problem will be identifying false positives for scopes that are actually properties.
I might use something like scope;root.module.foo.bar to add as an extra step to ensure if the property is a valid scope based on where it's placed.
Yes, it will alter the lua table
0 - 1
I'm trying to list the community projects as public but cannot :\
well then like what Chuck says, you might want to re calculate ur sethealth
My blabbering on about linting is boring but the result will be really cool.
gotcha, thanks ill try it
Not sure what is going on
linting will be the reason why my VSCode extension will have diagnostics and error-detection.
I even threw $5 on the wallet as the PZ was gifted to the account
I hope I don't have to enable 2FA
?
Trying to list this as public: https://steamcommunity.com/sharedfiles/filedetails/?id=2909488957
module Base
{
animation Runtime1
{
CopyFrame
{
frame = 1,
source = Bob_IdleDrinkPopCan,
sourceFrame = 1,
}
CopyFrame
{
frame = 21,
source = Bob_IdleDrinkPopCan,
sourceFrame = 21,
}
}
animation Runtime2
{
CopyFrames
{
frame = 1,
source = Bob_IdleDrinkPopCan,
sourceFrame1 = 1,
sourceFrame2 = 21,
}
}
[
{
"type": "error",
"location": {
"start": {
"row": 30,
"col": 1
},
"stop": {
"row": 30,
"col": 2
}
},
"message": "Missing '}'."
}
]
Again, boring stuff.
Won't be so boring when people are told their errors instead of wasting silly amounts of time looking for something as simple as a missing bracket.
lol
Tried to pretty up the workshop page and github landing page:
https://github.com/Project-Zomboid-Community-Modding/pz-community-modding
In order to format ZedScript, it needs to pass the linter. In order to lint ZedScript, it needs to tokenize without issues.
so 2 passes.
fuck doing all that i barely understand coding lol
is there a library of the color values mostly used in project zomboid?
Seems like you do need to enable steam guard to make content public :/
That's unfortunate
Is it possible to pass the 100 capacity limit on containers? The TileDef stops at 100 and increasing it in the generated def file has no effect, is this just a hardcoded limiter? My goal was to create a buildable container that has has the storage capacity of the three stacked crates so that I would not have as many inventories to scroll through in my item storage.
so i changed the number but it still is not adding health. ```lua
function InjectPropital(items, result, player)
local stats = player:getStats();
local bodyDamage = player:getBodyDamage();
local char = player;
player:setHealth(math.max(((player:getHealth()) + (0.25)), 0));
end
anyone familiar with Noir's Attachments? I was trying to make a mod to allow a cooler from my mod to be attached to the container slot, and its not quite working :/
@dusty wigeon how are you examining whether or not it's adding health?
I would suggest the best way is to print the result of getHealth before and after you change it
im in debug mode looking at the health bar on the character panel
umm, print the value out, looking at the meter isn't very scientific
it's possible that you are adding something, but 0.25 is too small of a step to be visually tangible
i was just going off something i heard earlier that the health is somewhere between 0-1 so idk whats going on
ive tried raising the number to see if i could see it move the bar to no avail
that might be the case, still print the value. This will give you a proper number to read and also act as a form of verification that your code is actually running
ok how would i write the print function and where should i place it
print(player:getHealth())
do it before and after you set the health
the in-game lua console will display the value
so health is indeed incrementing by 10
but why does this remain like this
i was just looking to give overall health
the original plan was to try to increase the regeneration of health but that was being a pain
yeah, I don't quite remember how the game utilises the overall health value, I suspect it's used for stuff like poisoning or dying from infection
if you drink bleach, does the health of your body parts decrease or just the main meter?
there's definitely some sort of composite relationship between overall health and individual body parts - stuff like hands can drop to zero but you'll survive. neck dropping to zero on the other hand is lethal
Is this the chat to learn about making mods aswell as chatting about them?
Or do you go to other places for that
if you have absolutely no programming experience, YouTube and googling for tutorials is probably the best place to start
What about just general questions about modding?
well either way, nobody's going to be offended, ask and see if someone has the answer
yea i just tested bleach and every body part drops as well as the main meter
my suggestion would be to iterate over the body parts then and distribute the health addition across them
you can either take the blunt approach and just increment each part by a fixed value, or you can inspect its current health and calculate the difference between how many points it needs to be full and how many you have available to distribute
ooo this is gonna be a lot harder than i imagined. would increasing the health regen rate be faster?
thats the way i originally wanted to go
are you able to control health regen rate from lua?
I have the vague feeling that increased regen is internal to java and only triggered by being well fed
ill have to do more research i suppose
hm, actually
player:getBodyDamage():setHealthFromFood
it takes a float argument
play around with it, I suspect the argument is meant to be the amount you want to increase body health by
there's also setHealthFromFoodTimer which presumably does the same thing, but not instantly
ok
in fact, I would wager the latter function is basically what does the "increased health regen"
i wish they actually showed some examples of how its used
decompile the java code
i have no idea how to even do that
Ah i see, ok thanks π
Well i do have a question rn then
How hard is it to learn animation in java? Which is the game engine zomboid runs on
Modding section on pzwiki explains how to do it
Java isn't a game engine
it's a general purpose programming language
a lot of the anims are in the DirectX format, but I believe the game supports them embedded in FBX files too
I haven't had cause to do any animation yet, but exporting my models from Blender as FBX has turned out just peachy
@dusty wigeon you can just use BodyDamage:AddGeneralHealth(amount)
Hi everyone, in a multiplayer mod, I wanna spread an information from the server to all clients.
Is there a better solution than sending a sendServerCommand to each clients (looping on getOnlineUsers array) ?
I see, I have had people say java is a programming language before, i was just wondering in general how difficult it is to do animations
or if that is the most difficult thing about modding
the only real challenge is familiarising yourself with a 3D modelling tool like blender. After that, you're just exporting files
its still not working idk if im doing it wrong or what but ive been up all night trying to figure this out so im going to bed and ill try again later
Could you learn about a program here? Or is it strictly just for zomboid modding
if it's related to zomboid modding, sure, but dedicated places for those programs would probably be more helpful than here
Plenty of videos on YouTube for learning blender
if you don't add a player arg, it sends the command to all players.
Thanx, that helps a lot. My data is a "state", so I'll have to manage reconnexions manually. Is there some sort of global mod data automatically shared on server's update ? That would simplify even more.
Fair enough, but i prefer to learn off a good teacher tho while video and written tutorials are helpful i often get lost and have lots of questions
But im also very annoying, so theres that and lazy xD
You could watch a few teachers on youtube who are selling courses if you want that tutor/mentor aid. Most seem to have courses they sell at reasonable prices that would give you access to them as a tutor of sorts
But IMO your best getting stuck into it and playing with the tools. Don't know how this works? Youtube will tell you. If your still stuck just pop on the discord for the software and you'll find someone to answer your question
tru tru
Does anyone understand how HealthFromFood, and related functions like SetHealthFromFood/SetHealthFromFoodTimer work?
In the general chat channel someone suggested a mod that would trip a player walking backwards. I love the general idea of it but I'm a beginner with lua. I've been able to make a mod that has a low chance of "bumping" a player when they move at high panic but it's not the best implementation of the idea -- Is there a way to specify the direction the player is moving in lua, like getplayermovedir ("forward") or something?
yes: you can compare the player orientation and the player movement direction.
character:getAnimAngleRadians();--player orientation (To be verified: this is angle 0 = East, 90 = South, -90=North, 180=West)
character:getForwardDirection():getDirection();--player direction in radian (to be verified what 0 refers to)
hm, thanks! I'll see what I can make of it
This should be pretty easy to implement, though I'm not sure if there's any animation for falling/tripping backwards like there is for forwards
what? why does it say radians if it's in degrees
it is radians, not degree, the values of my comment are wrong
Happy.
Very happy.
linter properly seeing properties and nested scopes.
module Base
{
animation Runtime1
{
CopyFrame
{
frame = 1,
source = Bob_IdleDrinkPopCan,
sourceFrame = 1,
}
CopyFrame
{
frame = 21,
source = Bob_IdleDrinkPopCan,
sourceFrame = 21,
}
}
animation Runtime2
{
CopyFrames
{
frame = 1,
source = Bob_IdleDrinkPopCan,
sourceFrame1 = 1,
sourceFrame2 = 21,
}
}
}
// intoScope(module)
// intoScope(animation)
// intoScope(copyframe)
// Property Detected: key=frame value=1
// Property Detected: key=source value=Bob_IdleDrinkPopCan
// Property Detected: key=sourceFrame value=1
// outOfScope(copyframe)
// intoScope(copyframe)
// Property Detected: key=frame value=21
// Property Detected: key=source value=Bob_IdleDrinkPopCan
// Property Detected: key=sourceFrame value=21
// outOfScope(copyframe)
// outOfScope(animation)
// intoScope(animation)
So I'm having an issue with mod I've made, it is turning as a burnt vehicle instead of normal, and then when spawn in it is there as mesh but invisible too π€
Easy question. I've been seeing a lot of code using the ":" operator. e.g. getCharacter():getBodyDamage()
That said, does lua, and more importantly, PZ allow for the use of the "." operators? Could I use getCharacter.BodyDamage?
I think the . operator is used for the table members in that sense you can use the operator from function modules to directly use a function instead of declaring a whole new member to use it
Kinda like the ItemFactory
Awesome, thank you both. @neon bronze I'm unfamiliar with table members. Are these all the terms that require BodyDamage? Like OverallBodyHealth, hunger, etc?
I'm a C#/C++ guy so I'm still learning the lingo.
Nah lua can and will make almost everything a table
Think of it as like a function that you would declare in a struct
But you can kinda access it from the outside without actually making a whole new variable for that function
I see. So if I have a table, I can just use something from within it like
MyTableName().tableMember
Again, without needing to create a new variable for it.
MyTableName.tableMember
Thats how you would access it if you have a table filled
But again it works for functions not for tables
So would BodyDamage be a table and getOverallBodyHealth be a method within that table?
so far im aware you cant access BodyDamage like that since it needs the character to check for
hence you use character:getBodyDamage()
OHHH, that might be why I'm having issues. I can't just get into BodyDamage without the character.
the ":" uses the variable before as self for the function to check for it
so character:getbodydamage() would use character to check
variable names but not internal, i call them character someone else calls them players but i think you need IsoPlayer for that
I ask for the (items, result, player) arguments I see all the time.
actually you need IsoGameCharacter
i suspect its from the event?
yes, it is.
I'm basically bugtesting a function that OnCreate adds some stuff to my inventory (which works) and also increases my health by 5.0f (doesnt work)
local t = {}
function t:test()
print(self==t)
end
t:test()
t.test(t)
it's same thing
exactly but t:test() is simpler and better syntax than t.test(t)
local t = {}
function t.test(self)
print(self==t)
end
--or
t.test = function(self)
print(self==t)
end
lua
function Divide_LC_Salt(items, result, player)
local bodyDamage = getPlayer().BodyDamage
local currentHealth = 0.0f
currentHealth = bodyDamage.getOverallBodyHealth
if currentHealth == nil then
print("currentHealth did not initialize properly.")
else
print("currentHealth initialized correctly. Value = " .. tostring(currentHealth))
end
end```
why not just char:getBodyDamage()?
Essentially I'm just trying to make it print the health of the player, but it's... well not doing that.
That top bit is the working code for the addition of items to inventory.
I was just leaving it separate and trying to get the rest to work on it's own.
different variable names and all that. Let me polish it up.
There we go. Edited for clarity on what isn't behaving itself like a good little code block.
Removing all the fluff and sticking with just what is above, the game throws an exception for "if currentHealth == nil then"
It says "Object tried to call nil", so maybe I wrote that incorrectly.
function Divide_LC_Salt(items, result, player)
local bodyDamage = player:getBodyDamage()
local currentHealth = bodyDamage.OverallBodyHealth
if not currentHealth then
print("Currenthealth did not init properly")
else
print("Currenthealth initialized correctly with health = " .. tostring(currentHealth))
end
end
try that maybe
Ah there is one
Ok so that corrected the game breaking bug, but it does in fact generate the "did not init properly" text. I'm going to swap the OverallBodyHealth for getOverallBodyHealth() and give that a shot.We're making progress
(you can do some weird reflection stuff to get fields anyway but it's ugly and sucks)
Haha @bronze yoke great minds
I mean kudos to indie stone atleast some getters are good and make sense
We're back to "Object tried to call nil" again. Hmmmmmm
lua
function Divide_LC_Salt(items, result, player)
local bodyDamage = player:getBodyDamage()
local currentHealth = bodyDamage.getOverallBodyHealth()
if not currentHealth then
print("Currenthealth did not init properly")
else
print("Currenthealth initialized correctly with health = " .. tostring(currentHealth))
end
end```
use **:**getOverallBodyHealth()
it is part of bodydamage
unless it's static you should always use colon for java methods
(or if you're caching them)
so getPlayer():getBodyDamage(). player:getBodyDamage() or player:BodyDamage() ?
@bronze yoke I will, but what is the reason for this?
Just a best practice?
colon in lua passes the object before it as the first parameter
player:getBodyDamage():getOverallBodyHealth()
it's part of the way it fakes oop
if you don't use it, kahlua doesn't know which object you're calling the method on
lua
local currentHealth = player:getBodyDamage():getOverallBodyHealth()
if not currentHealth then
print("Currenthealth did not init properly")
else
print("Currenthealth initialized correctly with health = " .. tostring(currentHealth))
end
WE HAVE SUCCESS!
Gave me the proper float value for my injured character.
well done
Many thanks to you @neon bronze @fast galleon @bronze yoke
lua
local char = player:getBodyDamage()
local currentHealth = char:getOverallBodyHealth()
if not currentHealth then
print("Currenthealth did not init properly")
else
print("Currenthealth initialized correctly with health = " .. tostring(currentHealth))
end
char:setOverallBodyHealth(currentHealth + 5.0f)
currentHealth = char:getOverallBodyHealth()
if not currentHealth then
print("UpdatedHealth did not init properly")
else
print("UpdatedHealth initialized correctly with health = " .. tostring(currentHealth))
end
And now this code tells me what my current OverallBodyHealth is before adding 5.0f to that value and then telling me what my new OverallBodyHealth is. Worked like a charm. BOOYAH!
Quick edit: This code does not do what I need it to do. Going to update below here with the fix and WHY it wasn't working before.
Now I just need to figure out how to look the addition of 5.0f with a small delay to simulate a regeneration effect.
Isn't there a Timed method
anyone familiar with Noir's Attachments? I'm trying to get a container from my mod to be attached to the container slot. I can get everything working except for displaying the correct model :/
Hey everyone I just dropped the Goth Backpacks & Bags mod. It adds 24 new backpacks to the game. Hope y'all give it a try and enjoy!
https://steamcommunity.com/sharedfiles/filedetails/?id=2967995766
@calm depot Is there? I'll have a look around.
A crafting tree for an upcoming recycling/crafting mod I am working on rn. It will make use of the crafting benches from "Crafting Core Enhanced" (+ some I've made myself) and will also include all of the "The Workshop" mods recipes, "bushcraft gear tools", "Yaki's makeshift clothing" and "That's It I'm Weaving" as well as a few items from smaller mods.
This code did not work as intended because I was using the setOverallBodyHealth, which as far as I can tell is not allowed. OverallBodyHealth is determined by the aggregate condition of all the body parts of the player. The AddGeneralHealth() function is what I needed and it behaves like so:
java
public void AddGeneralHealth(float var1) {
int var2 = 0;
for(int var3 = 0; var3 < BodyPartType.ToIndex(BodyPartType.MAX); ++var3) {
if (((BodyPart)this.getBodyParts().get(var3)).getHealth() < 100.0F) {
++var2;
}
}
if (var2 > 0) {
float var5 = var1 / (float)var2;
for(int var4 = 0; var4 < BodyPartType.ToIndex(BodyPartType.MAX); ++var4) {
if (((BodyPart)this.getBodyParts().get(var4)).getHealth() < 100.0F) {
((BodyPart)this.getBodyParts().get(var4)).AddHealth(var5);
}
}
}
}
First, the code uses a for loop to determine how many injured body parts a player has.
Second, it divides the health we wish to add to the player by how many injured body parts there are.
Finally, it adds the divided total health between the body parts. I would assume equally, but there' some behind the scenes stuff that increased my less injured parts by a smaller value than my more injured body parts.
In my previous code, I used "char:setOverallBodyHealth(currentHealth + 5.0f)", which would print to console correctly, but my debug view and medical tab both showed no change at all.
By changing this line to "char:AddGeneralHealth(30.0f)" it increased the health of my character by ~9.5f in total, and each limb was healed by ~2.0f.
Hope this is helpful to someone trying to heal their character with items.
@solid dawn We will gladly use this on our server if you get it up and running. I'd be happy to playtest it for you. I've grown increasingly frustrated with some blacksmithing mods that don't allow for melting of metal tools. especially considering most metal things in the base game already have a "metal value" that could be used to calculate how much metal they give.
Some things to watch out for:
- Do not use equipped or favorited items from the players inventory. Lost too many essential tools in a recipe because it searched across all recipes instead of the item I was right-clicking on.
- Allow for the melting of "broken" items. Just because my screwdriver is unusable doesn't make it any less metal.
- If you intend to integrate this with other smithing mods, please do not create new smithing tools or fuel. We currently have three versions of "smithing tongs" from Blacksmith, Real Metalworking, and The_Cure mods.
- If you intend to make forges work like ovens, ensure "progress" updates with the server. Blacksmith mod will not update an items status in MP until you leave the area and return. Real Metalworking only requires the player to be nearby the forge and have the items. Simplicity is key here, I believe. It's cool if the forge behaves like an oven, but if it causes issues then having simple recipes that ONLY require nearby items would be the better option.
- Try to avoid requiring stacks of items. It's honestly annoying to need x6 of an item when I could easily break one of them down into a smaller bit of metal. A drainable "workable iron" could be created with 0.1 useDelta(), and then combined with another to make a whole one.
- Please make components combinable. Having 17 0.01 useDelta workable iron that can't be hammered together is irritating.
Those are just my immediate thoughts. If you want help with this mod, I'd be happy to learn with you and playtest.
Came back to a wall of text lol
{
"scope": "root.module[Base].animation[Runtime2].copyframes",
"type": "warning",
"location": {
"start": {
"row": 26,
"col": 13
},
"stop": {
"row": 26,
"col": 25
}
},
"message": "Unknown property: sourceFrame2"
}
Example of progress on the linter.
The boring side of modding. =)
Hello modders! How can I test my mod before publish it on steam ?
I did a update on mine and I would like to test before ... what folder I need to put ?
but have 3 folders of this and not show in game Mod option
write here your three folders paths
- C:\Users\romar\Zomboid\mods ... 2. C:\Zomboid\mods ... 3. C:\Program Files (x86)\Steam\steamapps\common\ProjectZomboid\mods
2 is not related to the game
1 is where you should put your own mods
3 is where go the mods when you hit subscribe on steam
C:\Users\romar\Zomboid\Workshop is where you should put your mods to update steam
I do no know, how do you write the mod ? using an IDE ?
be sure to NOT subscribe to your own mods when you edit them
An IDE what is that? Idk kkkk I just wrote and publish and voilΓ‘... but now I dont remember how to add some news updates. I will try to use this folder like u said
Anyone could help me understand why, when I start my local server ("servertest") with mods, it overrides its SandboxVar.lua without any mod subnode ?
@setlocal enableextensions
@cd /d "%~dp0"
SET PZ_CLASSPATH=istack-commons-runtime.jar;jassimp.jar;javacord-2.0.17-shaded.jar;javax.activation-api.jar;jaxb-api.jar;jaxb-runtime.jar;lwjgl.jar;lwjgl-natives-windows.jar;lwjgl-glfw.jar;lwjgl-glfw-natives-windows.jar;lwjgl-jemalloc.jar;lwjgl-jemalloc-natives-windows.jar;lwjgl-opengl.jar;lwjgl-opengl-natives-windows.jar;lwjgl_util.jar;commons-compress-1.18.jar;sqlite-jdbc-3.27.2.1.jar;trove-3.0.3.jar;uncommons-maths-1.2.3.jar;./
".\jre64\bin\java.exe" -Djava.awt.headless=true -Dzomboid.steam=0 -Dzomboid.znetlog=1 -XX:+UseZGC -XX:-CreateCoredumpOnCrash -XX:-OmitStackTraceInFastThrow -Xmx3072m -Djava.library.path=./natives/;./natives/win64/;./ -cp %PZ_CLASSPATH% zombie.network.GameServer
PAUSE
above is my server start script. I use the same steam folder for my server and my clients.
@fading horizon We are busy WORKING!
?
So I'm not allowed to post one message in between?
Ooooh I was so confused I thought you were upset haha
Lol nah, I'm just being a goober. You can ignore me
Good work on your mod, btw. Looks great.
can someone explain why some stuff is indented more than others or does that matter for profession
ok
thank you!!
i wonder if there is a way to make it so you can flip a light switch even if the power is out
i mean it is definitely possible, but i wonder how to do that
Does anyone know of any good modding resources for an almost total beginner?
start with the pins
https://imgur.com/gqzwnyH
Meet little ms Grim Leaper (WIP)
literallyy named mod resources
https://discord.com/channels/136501320340209664/1070852229654917180
thats not nightmare fuel at all >.>
terrifying
if that ran at me i'm immediately using the suicide mod
If we manage to implement the drag down animation as hit reaction
Then this will always instant kill
I always wondered, if you get dragged down is it an auto kill in multiplayer? or can somebody else kill them before you die?
just found out theres an incompatibility with one of my mods
i have no idea where
theres no errors
||I have over 400 mods to go through to check for the issue||

sorry if this is a common question, but is there any information on how to create animations for pz? like what tools are available, the method for making new or replacing existing ones (i mostly wanna replace combat animations of 2h melee weapons, like bat n stuff, so idle, movement and attack)
anyone know anything about creating professions? I created this it pops up but doesnt give the perks. ```lua
ProfessionFramework.addProfession('CDC Scientist', {
name = "CDC Scientist",
icon = "profession_CDCScientist",
cost = -5,
xp = {
[Perks.Chemist] = 3, --rename with custom Perks
[Perks.SmallBlade] = 1,
[Perks.FirstAid] = 2,
},
traits = {"FastReader2", "FastLearner2", "Organized2", "ThinSkinned2",}, --rename quoted items to custom trait name
})
is it not triggering at all or something else?

