#mod_development
1 messages Β· Page 26 of 1
Oh, maybe somebody knows. I have managed to play a lot of animations by using the playEmote, but there are two animations that for some reason I can't, they run so weird (I think is the surrender one the default?). Any guide / information of what all the fields means in the .xml inside the animsets?
i am unaware of a guide but there are mods that make use of that system that u might poke at

Yeah I tried True Actions, Real Ladders, and others, and some are TimedActions (which I don't use for this) and others uses some variables that to be honest tried to replicate but I'm sure I'm failing in the .xml
how about Authentic Animations
and
PA Public Testing does a thing where it parses the animation wheel and turns them into chat commands
there's also a mod that does animations as hotkeys i think
Authentic Animations, will take a look at that one to see how it does it
But still I can't understand how I can play some animations but not all of them
i don't know enough to give you more insight, sorry x3
i'd poke around the same set of mods
to learn
so that's all i have! x3
might have more luck with insight into it in #modeling ?
oh also Vanilla Firearms Expanded and Brita's both have custom animations for gun reloading and holding and such
Thanks! will check at Authentic Animations, tootally forgot about that one
{
imports
{
UndeadSurvivor,
}
recipe ReconditionHeadhunterRifle
{
UndeadSurvivor.HeadhunterRifle=1,
ScrapMetal=120,
MetalPipe=1,
SmallSheetMetal=3,
MetalBar=1,
Screws=16,
BlowTorch=8.5,
keep [Recipe.GetItemTypes.WeldingMask],
keep [Recipe.GetItemTypes.Screwdriver],
keep [Recipe.GetItemTypes.Hammer],
keep [Recipe.GetItemTypes.Saw],
keep [Recipe.GetItemTypes.SharpKnife],
SkillRequired:MetalWelding=9;Aiming=6;Maintenance=5,
Sound:BlowTorch,
NeedToBeLearn:true,
Result:UndeadSurvivor.HeadhunterRifle,
Time:350.0,
Category:Firearm,
OnGiveXP:MetalWeldingAndMaintenance10,
OnCreate:ReconditionGun,
RemoveResultItem:true,
AllowDestroyedItem:true,
}
recipe ReconditionDeadlyHeadhunterRifle
{
UndeadSurvivor.DeadlyHeadhunterRifle=1,
ScrapMetal=120,
MetalPipe=1,
SmallSheetMetal=3,
MetalBar=1,
Screws=16,
BlowTorch=8.5,
keep [Recipe.GetItemTypes.WeldingMask],
keep [Recipe.GetItemTypes.Screwdriver],
keep [Recipe.GetItemTypes.Hammer],
keep [Recipe.GetItemTypes.Saw],
keep [Recipe.GetItemTypes.SharpKnife],
SkillRequired:MetalWelding=9;Aiming=6;Maintenance=5,
Sound:BlowTorch,
NeedToBeLearn:true,
Result:UndeadSurvivor.DeadlyHeadhunterRifle,
Time:350.0,
Category:Firearm,
OnGiveXP:MetalWeldingAndMaintenance10,
OnCreate:ReconditionGun,
RemoveResultItem:true,
AllowDestroyedItem:true,
}
}```
anyone see anything wrong in this script?
it causes the game to go into a GetItem loop
ERROR: General , 1663629861880> DebugLogStream.printException> Stack trace:
java.lang.reflect.InvocationTargetException
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.base/java.lang.reflect.Method.invoke(Unknown Source)
at se.krka.kahlua.integration.expose.caller.MethodCaller.call(MethodCaller.java:62)
at se.krka.kahlua.integration.expose.LuaJavaInvoker.call(LuaJavaInvoker.java:198)
at se.krka.kahlua.integration.expose.MultiLuaJavaInvoker.call(MultiLuaJavaInvoker.java:60)
at se.krka.kahlua.vm.KahluaThread.callJava(KahluaThread.java:182)
at se.krka.kahlua.vm.KahluaThread.luaMainloop(KahluaThread.java:1007)
at se.krka.kahlua.vm.KahluaThread.call(KahluaThread.java:163)
at se.krka.kahlua.vm.KahluaThread.pcall(KahluaThread.java:1980)
at se.krka.kahlua.vm.KahluaThread.pcallBoolean(KahluaThread.java:1924)
at se.krka.kahlua.integration.LuaCaller.protectedCallBoolean(LuaCaller.java:104)
at zombie.ui.UIElement.onMouseUp(UIElement.java:1228)
at zombie.ui.UIElement.onMouseUp(UIElement.java:1183)
at zombie.ui.UIElement.onMouseUp(UIElement.java:1183)
at zombie.ui.UIManager.update(UIManager.java:809)
at zombie.GameWindow.logic(GameWindow.java:261)
at zombie.core.profiling.AbstractPerformanceProfileProbe.invokeAndMeasure(AbstractPerformanceProfileProbe.java:71)
at zombie.GameWindow.frameStep(GameWindow.java:764)
at zombie.GameWindow.run_ez(GameWindow.java:680)
at zombie.GameWindow.mainThread(GameWindow.java:494)
at java.base/java.lang.Thread.run(Unknown Source)
Caused by: java.lang.StackOverflowError
at zombie.scripting.ScriptManager.getModule(ScriptManager.java:209)
at zombie.scripting.ScriptManager.getModule(ScriptManager.java:202)
at zombie.scripting.objects.ScriptModule.getItem(ScriptModule.java:479)```
the last line repeats indefinitely, the one about line 479
maybe i need to not import
i haven't done much importing besides base, maybe it is a mistake
i've heard people say something like "importing base makes your stuff accessible"
which makes it sound more like "export"
lol
so perhaps it works the inverse from what i intuit
that'd lead it to be a loop, so.. let's see
well that did fix it
reads the source to see if she can determine if import means what she thinks it means
well, doesn't matter, but in getItem there's nothing making sure that you don't end up in an infinite loop
so
it goes through the imports there rather than preprocessing them
meaning it will go on a loop if you import something that imports you
would be nice if code would detect that and prevent it, but i grant it could only do so for a depth of 1 without it being a performance concern
anyway mystery solved there..
still dunno what the other error is
oh and import just means "look through this when trying to get a thing" from the context im seeing here, which makes sense - i imagine that using full names avoids the necessity
so it was redundant for me anyway
Hi, idk if this is the right channel but you guys might have the tools to do this so
With the total estimate of zombies on the map being ~52000 in the normal multiplier, I would like to count all the beds in Knox county to see how realistic that population is (aswell as get an estimate on what the realistic population multiplier would be)
Counting by hand would be aboslutely barbaric so I was wondering if anyone had any tools to do this faster
Thanks
the anti-cheat is obtuse in its numbering so i can't be sure if this is really a mistake but..
public static boolean checkType8(UdpConnection var0, IPositional var1, IPositional var2, String var3) {
float var4 = IsoUtils.DistanceTo(var2.getX(), var2.getY(), var1.getX(), var1.getY());
boolean var5 = (double)var4 <= 10.0D * ServerOptions.instance.AntiCheatProtectionType3ThresholdMultiplier.getValue();
if (!var5 && ServerOptions.instance.AntiCheatProtectionType3.getValue() && doKickUser(var0, var3, "UI_ValidationFailed_Type3")) {
LoggerManager.getLogger("kick").write(String.format("Kick: player=\"%s\" type=\"%s\" issuer=\"%s\" value=\"%f\"", var0.username, "UI_ValidationFailed_Type3", var3, var4));
}
return var5;
}```
check type 8 uses the type 3 setting
i.. assume this is not intended
should be possible technically
You can get starteer here: https://github.com/FWolfe/Zomboid-Modding-Guide
For mods to reference and code examples in order to acheive this
https://steamcommunity.com/sharedfiles/filedetails/?id=2761962764
https://steamcommunity.com/sharedfiles/filedetails/?id=2487022075
ok thanks
im not sure if blowtorch 8.5 is ok? might be fine, but i've never seen people use fractional values for drainables
To my knowledge that would only aply if you use "usedelta" as delra works by dividing 1 by x to gain the amount of units within the drainable. Within a recipe you dob't say "hey drain the maximum" you just tell it the amount of units needed
hello i am having problem
in short
i drop my model on ground
my model doesn't render on ground
i equip my model
and it works
any idea how to fix while hearing this kind of issue
tis is sorta funny but in a smart sense
but why bother tho
probably missing worldstatic model iguess
yea, i tried using it but zomboid rejects to read model
would be interesting
check the model or use something vanila just to test it out.. thats what i would do
an interesting meme too
I ended up just counting all the houses in the main towns and then multiplying by 2.5 because thats around the average amount of beds in a house
and then for louisville I added +20% for good measure
https://docs.google.com/spreadsheets/d/1Gy_R_B29o38bVJUKGC5I4IoFkLDEZMZIzAaZcEWFmdQ/edit?usp=sharing here are the results if you're interested
Sheet1
Zombies,Houses,Estimated Beds,Estimated Pop,Actual
Maldrugh,4000,180,450,450,0.11
Riverside,2100,169,422,422,0.2
West Point,5000,175,437,437,0.08
Dixie,350,83,207,207,0.59
Rosewood,2500,53,132,132,0.05
Prison,3000,106,0.03
March Ridge,2400,217,542,542,0.22
Valley Station,4500,171,427,427,...
which animation is it? im trying the zombie eating on the floor ..couldnt make it work either
hahaha thats a lot of free time spent
only took like an hour
I suggest you simplify the recipes, removing most things one at a time, then slowly add things until it breaks again
perhaps since you already did call the module on the results
Is this where discussions about mods making hair and skin retexture?
modelling might be better
Ok.
Is Brita weapon pack broken or am I doing something wrong?
I used to have an older brita weapon back from what I remember but ever since the latest one needs a Arsenal(26) I cant fire a gun
Tried the PassOut_Front and PassOut_Back animations but I can't make them play. All the others I have tried, seems to work fine by just using the "playEmote"
interesting.
I've looked up cities in Kentucky, and it seems, that Louiseville had 269000 Pop in 1990
https://worldpopulationreview.com/us-cities/louisville-ky-population
So with 50.000 zombies the numbers are close.
yeah I'm counting it off the ingame louisville, however
theres only enough beds for ~8000 people
yeah, I thought so.
Just interesting to find how many live there
yeah
fractional blowtorch works fine, i've done it many times - can't with 100% certainty guarantee it doesn't round the number or something, but it doesn't break anything.
it was the imports line, it's in Base so it was impoting UndeadSurvivor, and UndeadSurvivor was importing Base.
i did say that on here someplace, guess ya missed that
im surprised there was no safeguard in place to prevent an import loop, i didn't realize it worked in a way where one could happen, but when i read the code it was pretty obvious
since i was using full names it was unnecessary anyway xD
i actually almost always use full names
avoids potential fuckery
i should probably start doing it for Base too, be consistent, lol
the problem i could not solve yesterday, which was more mysterious, was this one:
same code works, then runs again with diff index and throws an error about a symbol near an "=" that doesn't exist - but works anyway.
ah now thats a faster approach
besides the game devs aint gona do a very identical real life number of beds thing .
or will they ?
also have to keep in mind that nothing is stopping zeds from migrating in from elsewhere - presumably you make enough of a disturbance driving around and maybe firing a gun, chopping a tree, etc.. that it could echo for miles and they do migrate.
so im not sure if the population is too relevant to begin with
if we assume they wander off en masse when the exclusion zone is mostly dead then it explains the lower amount, and if we assume they wander back in when humans outside are less available and you become a better target

if it's about number-of-beds then yeah there's no way they are going to go for accuracy there
it'd be an impractical amount of detail and effort to make by hand
they'd have to either spend a lot of money paying people to drastically expand the map and entirely redo the spacing if we want realism or rely on generated map stuff to achieve it which would yield relatively low-quality copy-paste reseults
lots of liberties were taken with the map and i imagine that is one of them
could relatively easily iterate the whole map looking for beds if you really wanted to, though
go over the whole grid and check each tile for a bed and if you find one, increment counter - just make sure to only count one part of multi-tile beds
since it'd be a one-time non-gameplay thing you could do it without being particularly picky about speed/efficiency
Can anyone guide me on Noir's shops and how to modify them? Mainly the NPC shops, thank you!
Does anyone know of a way to change who the player is controlling? IE I would like to add an npc and switch the player to control that npc
you could programmatically re-bind the keys to custom functionality
not sure about if you'd wanna change the view or if that's plausible
Is there a Lua Event for when a player receives an injury? I didn't see one on the Lua Events wiki page.
could do checks and use OnPlayerUpdate
not sure if there's something more apt
might hook a function instead of an event tho
keep that in mind
Alright. Thanks.
https://www.youtube.com/watch?v=mF9Teca6O20 Holy crap, how did this mod render its projectiles? I wonder if that Z-offset is modifiable or if it's like every other projectile that comes out at the top of the player's head
look into the code and find out?
I'm trying to dissect the mod right now to sus it out
Omg remember me the stupid person who can kind of make noodles?
What determines which version of a mod is loaded when you have both the steam version and a version in ~/Zomboid/Workshop?
~/Zomboid/Workshop had been preferred over the steam version until now. I activated Mod Manager: Server, and I'm wondering if that's affected which version is loaded. If I deactive both Mod Manager: Server and Mod Manager, it will use my dev version, but if I activate Mod Manager (not the server version) it starts preferring steam over dev. Curious if anyone wrestled with this same issue?
yeah usually have to just avoid having both. I am always playing on my latest version and not the steam version just because its a pain to deal with, and bugs caused by that are really annoying to realize and debug
I set local deployments, to always deploy to steam workshop directory, somehow it doesn't read the ~/zomboid/workshop if there's lots of file differences, or massive distinction in the checksum, it will be a mess if i have to upload the WIP version to the workshop everytime, so this is probably a temporary solution, wish steam workshop have a git branching mechanism lol..
yeah i wrestled with same issues, but its fine as long as your changes are synchronized between both folder i think.
you can also set to sync with 3 or even 10 folder, had to setup a local dedicated server for a test, before deploying to main server, so yeah at least need to sync between ~client steam workshop dir, and local dedicated workshop dir.
also a question, could we apply auto reloadfile ontick? if there's checksum difference on certain file, it would apply it right away without us even reloading it manually ?, i'm thinking about hot module reloading.
can we create custom radio channels? like with custom text and so on? has this been done? π
all 3 folders, not sure if anyone realizes that when you run a local host game you have a 3rd steamapps folder created in the root of you zomboid installs. and the local host trashes you hard drive by making a 3rd copy of your mods folde between the steamapps and the userprofile\zomboid folder
i bitched about this, dunno if they changed it specifically for me - but with it the way it is now i can play on a server without having to move folders out of the workshop directory, and to dev i can unsub - to do it the other way around is more cumbersome so i prefer it
Hmm.. tbh it just seems inconsistent the way it is now. If I remove Noir's Attachments from my activated mods, the dev version of my mod loads. If I add Noir's Attachments back, my mod loads from the steam workshop directory. My mod has nothing to do with Noir's Attachments. Just seems like some race condition
And prior to today, it seemed to always load the dev versions of my mods
I downloaded a few more mods from steam workshop last night, and now it has become inconsistent 
How to check what foraging zone the player is in
nevermind
just digged thru game files lol
hello i am wondering if LuaEvents are all available on both client and server side. For example I see many mods that listen for the OnPlayerDeath Event on the client side and once that event gets triggered, they call the server side with a sendClientCommand call. All that just to do something on the server in case of an death. Cant the server use the OnPlayerDeath Event directly or is there a difference?
what am i missing?
3 Folders, 1 are in Dedicated Server, Project Zomboid Dedicated Server\steamapps\workshop\content\108600\2860226933\mods\, to update locally without uploading to workshop.
i dunno about the host one...
ok that.. is not how it works for me
if i unsub to just my own mod then the dev version of it will load, it has nothing to do with whether anything else is a workshop or local copy
Can I add an extra context to an items menu via lua, and where should I look to get started
There are some lua events to add entries to inventory items context menus
Gracias :)
Would you know where I should look if I wish to add the context to a vehicle door for example, if the player has a welding mask and a propane torch
I will look at documentation now though, thanks
function fillMenu(player, context, items)
context:addOption("Do my thing", items, doMyThing, player)
end
function doMyThing(items, player)
print("hi")
end
Events.OnFillInventoryObjectContextMenu.Add(fillMenu)
@boreal crow something like that
OK, that's a great starting point - I'll take a peak at some documentation and go from there, thank you once again!
If not that event, probably is a similar one for context menu when clicking on vehicles
I'm thinking of inventory vehicle doors, that have been removed - so your example is perfect actually 
what about a context thing in general? i want to have one where if i click on it, it sends a timedaction that i made myself, the timedaction works by itself but i just cant get the context thing to work
my mian issue was the event one, i just assigned a function that prints "hi" when its ran but it just didnt work
its just one where you right click anywhere and it shows up, like walk to and sit on ground
So you want an entry in the context menu that appears when you click in the game world?
on the ground, etc
yes
Events.OnFillWorldObjectContextMenu looks like it is for that
Events.OnFillIWorldObjectContextMenu.Add(fillMenu)
function fillMenu(player, context)
context:addOption("Do my thing", doMyThing, player)
end
function doMyThing(player)
print("hi")
end```
would this work?
not all events are available in both client and server. i've ran into issues because of this.
I think that's missing a parameter to addOption
Events.OnFillIWorldObjectContextMenu.Add(fillMenu)
function fillMenu(player, context, worldObjects)
context:addOption("Do my thing", worldObjects, doMyThing, player)
end
function doMyThing(worldObjects, player)
print("hi")
end```
Where is a good place to start on overriding a specific zomboid lua function?
e.g.: media\lua\server\Vehicles\Vehicles.lua has function Commands.takeEngineParts(player, args) and I'd like to override exclusively that, and leave everything else as-is
alr imma try that one
ill reply in a bit if it works
is there an article or knowledgebase where it states which event is available where? because the wiki does not differentiate at all
also does the first param have to be "" or can it be
getText("ContextMenu_(thing)")
```?
getText returns a localized string
no, just need to experiment and figure it out, or read the decompile. probably easier to just test it though
so either. Using getText allows you to localize it (have an english string, spanish string, etc)
Events.OnFillIWorldObjectContextMenu.Add(fillMenu)```
made the entire game break
broken letters and logs confirm its that line
override or patch its behavior? I'd patch it if possible bc it would be less brittle, less likely to break other mods
patch it I guess, I just want to change the amount of parts given to the player
Events.OnFillIWorldObjectContextMenu.Add(fillMenu) needs to be after the function it calls, not before.
put the events.blah.Add line to the bottom of the file
you need to define the function first
before you can add it. it doesn't work like a pointer
ok i moved the line to the bottom should work i think
imm atry again
dunno if filli or fill is correct tho lol
fill is correct
filli isn't a word, and you can compare it with vanilla code as well in future
yea it broke again
yea but blair sent filli
obviously a typo
lol
what on earth is with your fonts
idk it broke or osmething
I literally cut and pasted that from your code snippet π
yea so tyrir made the typo
bro idk with this game
wakeful is referred to as "needslesssleep"
i trust typos at tihs point
Generally something like this to patch a lua function
MyModNamespace.oldTakeEngineParts = Commands.takeEngineParts
function Commands.takeEngineParts(player, args)
-- do some stuff, modify args perhaps
MyModNamespace.oldTakeEngineParts(player, args)
-- do some more stuff maybe
end```
needs less sleep
ok good news it didnt break
"NeedsLessSleep", the code is case sensitive FYI.
yea ik its case sensitive im just too lazy to write it on discord
with cases
and sleepyhead is NeedsMoreSleep i think
ok thanks @hearty dew it works
dunno why it didnt work before but oh well
now imma just add checks and it should be good
yea yea it works
works as planned
ty yall
Hi - I've hit a bit of a wall reading data from https://projectzomboid.com/modding/zombie/characters/BodyDamage/BodyPart.html - all of the boolean return type methods seem to work, but those returning other types just give me a null table exception. Where am I going wrong? The commented lines are the ones I have issues with:
Nevermind, I rebooted the game and it started working as expected... weird.
I put a link to the folder on my pc so its not trashingmy local drive
I see images referenced in lua to files in media/ui that don't exist. Are they compressed in the .pack files in media/texturepacks or somewhere else? Is there info on how to decompress these packs, if that's where they are?
Looks like a proprietary format. The Indie Stone has a tool on their forums, TileZed, to manipulate the .pack files
is there anything like zombie:getOutfitName but for containers? To get the container name like "BathroomCabinet" that would usually be used in distribution tables?
I found OnFillContainer and it gives me the info I need at the time I need π
I am at https://projectzomboid.com/modding/ and honestly i am a software engineer, however i do not understand this weird documentation. I looked through a mod which uses the class NonPvpZone in Lua. Where and how can i find the class in this documentation? Where can I search? Where do I have to navigate?
don't use that, use https://zomboid-javadoc.com/41.65. that link is outdated. the 41.65 one is still outdated, but not alot more recent than the projectzomboid.com one
it also has a search bar making things alot easier
oh god, thank u. @shadow geyser u are amazing π
isobuildings have a getdef method. Not sure if that is the right one but you could try it
I have another question. If there is a zombie or several zombies that I want to remove. Can I just call the remove command on the zombie on the server side and the server syncs that automatically with all the clients? is the server authorative? or do i have to remove the zombies in my mod also at client side?
heya, i would like to ask if is it possible to cast inventoryitem to specific item type instance? I managed to grab radio data through getScriptManager:FindItem(fullType) but I can't grab those radio item's current channel
Hello everyone. I'm very new to discord. I heard on Reddit that could get some help for modding PZ.
Am currently looking a bit into the script file items_weapons.txt and there's a lot of properties under each items.
and all items does not have the same amount of properties.
how can I know which properties are required ?
and where are they used ?
no one here knows this?
can't remember of the top of my head. i suggest you look at the code for the admin tools for removing zombies
i get little confused with this __(operator), not defined things... do i have to define all of it
for every single __add, __mul, __sub, __lq lt le, etc
can u point me to the directory where that might be located
I believe it's in AdminContextMenu.lua DebugUIs client folder
very much appreciated, thank you
cant guarantee im right though, only briefly checked for it
it is a starting point for me π so helped either way
@summer rune
just ALT+SHIFT+F in your IDE, you shall be fine, load only the media folder, to check for vanilla stuff, so its not bloated with 3rd party stuff,
thank you very much. with media folder u mean C:\Program Files (x86)\Steam\steamapps\common\ProjectZomboid\media correct?
correct,
alright, this will get me started π thanks
also if you already had the decompiled source, it would be useful, to look for the java side as well, don't forget to change from "In Project" to Scope
Does anyone know how moodle framework functions, i can't seem to get it to work.
is there a way to invoke java reflect method? I'm stuck at this part and have no idea how to progress from here.
or you can only invoke it in debug mode?
My JavaDecompiler doesn't show me the content of .class file
but It works with .jar file is it normal ?
this one is working though http://www.javadecompilers.com/
Java decompilers online: *JAD, *JDCore, *Procyon, *Fernflower, *CFR. β A user interface to extract source code from .class and .jar βbinaryβ files.
not this one : http://java-decompiler.github.io/
JD Java Decompiler
weird
What ide are you using? π€
that's IntelliJ IDEA
https://www.jetbrains.com, got that free with student email lol...
part of https://education.github.com/pack as well
@lime hedge you are not a student ?
you can get the Community edition for free, itβs very good
do I looks like not a student to you, umm.. I was, and I'm planning to enroll again for my master
yeah, the community is also sufficient I think, for just regular coding stuff
jetbrains IDEs are good , but when it comes to cloud and container stuff, they are not that great.
@thin hornet Not sure if this is the correct place or anything, but im following the guide on github (https://github.com/Konijima/PZ-Libraries ) and its getting stuck on "Decompiling class zombie/characters/action/ActionTransition". Is that intentional?
well it has the best intellisense, especially for type safe language, the debugger are also good, for cloud and container I prefer manage that with the command line lol
i like vscode intellisense much more, however the refactoring tools are top notch. nothing beats jetbrains refactoring.
and i mean using dockerfiles to debug and stuff, jetbrains just aint good at that. always some problem
ah indeed, it just eats more memory and booting that up wasn't mean to be compared with lighter editor such as VScode.
for such stuff I mainly switch to my arch linux, whereas the IDE are only to edit the config files etc, I mainly debug everything with CLI
yes, arch linux. i like it.
so i don't really have a problem with that
i have to use windows for my work env tho π
not really that ease, if you forgot to update it for a month... lots of things to fix :S
true, with my arch setup script always something to change and fix
no worries, i switch to windows again due to games and WSL2... got kali in seamless mode, ubuntu and arch linux, also hackintosh via vmware on top of win11 lol
a win win solution lol.. the sad part i can't use my beloved i3WM conf.
qtile is my favorite
have to stick with windows UI haha
for sure
seems appealing, thanks for the info
@summer rune is it lighter than i3wm?
depends on what u mean. performance wise. no. easier to configure? yeah]
i saw the comparison page, the video got that wrong xD
that's the reason
python is reason enough for me to not use something
yep. for me i was more into performance, a lighter DE/WM, since i need more space in the ram and not burdening my weak CPU
for terminal I use tilix just for the quake mode.. also its fast enough.
to each their own. ur choice. but u are missing a lot if u limit ur self by language choice.
python are racing to the top now due to Machine learning lib and stuff...
golang is my favorite lang. π i introduced that everywhere i worked.
eventho it's python.. it just slow by nature, that's why there's Julia
it is a mixed bag between c++, python and c#
and python and lua for scripting, chefskiss
golang is great, it just.. has its own use case.
make sure you use the right versions of the jdk. I remember it wouldn't work when I used a single minor version newer jdk, but then no problems when using the correct versions
I'm sticking to node due to the ecosystem and the demand, hopefully deno will be a better iteration of node
javascript is okay, i dont like the prototype stuff.
but i gotta be honest, java is the worst π
haha avoid it.. there's alot of transpiler out there.. kotlin can be transpiled to js as well
even all of it will be transpiled to "prototype".. all of the syntatic sugar..
I mean, all over the net are filled with JS, I can make mods, altering behavior etc by monkey patch it for just any web based stuff lol.
understandable. i am using a ton of js and ts as well. still dont enjoy it.
possibilities are great. language is meh
right
its a weird language without TS, even with TS.. it just unrepairable lol
corrupting your mindset
once you dive in too deep with js, there's no easy way to get out. it may be good for your pocket and understanding, but not for your mental health.
lol
also the npm module are potentially bigger than cyberpunk2077*5 installation
btw IsoChunk has RemoveZombies method, i dont have the code infront of my but i was playing with it last night
thanks, appreciated π
im brand new to pz modding but have a lot of experience in lua, what would i have to learn to implement new animations such as weapon swings? i wanna make a mod that changes weapon attack animations based on proficiency level with that weapon
I have a more advanced jdk (the newest 1.8 afaik). It is decompiling but its taking forever
How can I extract the textures for using it in like mapmap?
There is this tool if you mean extracting the textures from texture packs @halcyon dagger
Is there a way to specify dependencies between workshop items in the workshop.txt file? Or do you have to do that via the steam UI?
I think something is wrong
What are some options for saving character-specific data (and specific to a game world too)? For example, if the user has enabled/disabled a feature of the mod for a particular character
cartozed https://theindiestone.com/forums/index.php?/topic/21633-cartozed/ just be warned it doesnt work on the expanded LV map so you need to move the lotheaders you want out of the vanilla map into a folder
Is there any way to check that if the food that was eaten contained "X" ingredient? like I made a salad and in the On_Eat I can see if it contains for example berries?
Or if I add an On_Eat to a berry that On_Eat automatically triggers when the salad is eaten because it contained that berry?
I don't know, but I happened across a function, I think it was called getExtraItems(), on the InventoryItem object. I assumed it was for that purpose, but I didn't verify, just a hunch. Might be a starting place if nobody else comes along with an answer
module Base
{
item Diary
{
Type = Normal,
DisplayName = Diary,
DisplayCategory = Literature,
Weight = 0.5,
Icon = Book,
WorldStaticModel = Book,
}
}
Will take a look! thanks!
I can't seem to get this to show up on a debug item list is there a field I'm missing?
Mod is loaded.
Nothing stands out as wrong. Do you perhaps have the same mod installed in a different location, ~/Zomboid/Workshop perhaps, that is loading instead of that one you are modifying?
I have it under my mods folder and I'm only loading this and some firearms mod so I can verify that stuff is loading properly.
You might try looking through console.txt to make sure that file is loaded when loading into a world with the mod activated
Actually, scripts files might not be logged in console.txt when they are read. Lua files certainly are
Oh, there ya go
Looks like it is what I was looking for. Much appreciated!!
public void addDirtβ(BloodBodyPartType bloodBodyPartType, java.lang.Integer integer, boolean boolean1)
Any idea what the boolean does?
Do recipes for crafting only give 1 item max? Where do I find a breakdown of how recipes are formatted?
I understand I can look at current recipes for this, but I need to know if I can specify multiple results
Otherwise, how can I fill a container with items, as it's own item? I would like to specify a crate full of items, and then result that in my recipe, if possible.
Does it require a perfect distribution entry in the dist table?
Also, how do I specify the amount of space within a new container item?
that's where u gotta go decompile the source and poke around to find out :P
there's a guide someplace
When I'm modding, do I have to relaunch the game to reload lua, or can I use a developer console command to reload
this link is dead on pzwiki.net
Is there anyway I could pay someone to create a mod with a single profession?
Like 5-10$
Usd
message me
what single profession?
I wanted something like a radio guy that is on when your in your car I just canβt think of a good name for it
I wanted something like a radio guy that is on when your in your car I just canβt think of a good name for it
does anyone happen to know how to get the container of a vehicles glovebox? i can get the part itself but i cant figure out how to get its inventory to add stuff to it
im assuming im taking the wrong approach by getting the part but im not sure how else i'd do it
you can give multiple of the same item, but you can't give different items without using the Oncreate to run a lua function that gives you the extra items
majority of the time you can reload lua files normally. there are some specific exceptions though such as UI stuff, and functions inserted into some event. Also if you are debugging on a dedicated server or hosted server, you can't reload server lua files without jumping through some extra hoops, so I almost always dev on SP, then jump to MP afterwards to make sure stuff works.
Is there a way to see what music plays when?
anyone has a servermsg script
Lua event question. I'm trying creating to create a function that places a static group of zombies in a location when an area is generated but I for the life of me can't figure out what Lua event I should be using to call it. The function works when attached to something like EveryTenMinutes and I happen to be in the area of the designated location.
Which Lua event fires off when/after a cell is generating its zombie population? I had hoped OnPostMapLoad would fit the bill but it seems to only go off when you load into the game (and also seems to be too "early" to spawn zombies).
try OnLoadGridSquare
I strictly followed the tuto from KoniJima. the decompilation worked like a charm
Once you get your first mod, what's the best way to test in PZ ? π
can I just drop it in the steamapps/workshop/contents ?
Not in that folder. use the workshop folder in your home folder ie "C:\Users\user\Zomboid\Workshop" just dev with my mod inside the workshop folder. makes it so much easier too when doing explorative stuff to try to learn things. my IDE just has the mod open in that folder. no point in making changes then moving files around, when you can just modify them in place
@tame mulch That looks like one I can use. Thanks.
ok thanks
Is there a function to find a specific steam account ?
If I remember well, there is something like player.getSteamID()
is there any way to start Pz in a minimal mode, so that it takes less time to startup ?
like I just need a crowbar and a zombie ?
you could try the debug scenarios? i haven't used them in a long time, but I think they don't load the whole map
might be faster
I just uploaded my very first PZ addon. It was kind of a pain to figure out how to work with PZ's LUA functions but I finally did it. Tell me what you think about it.
https://steamcommunity.com/sharedfiles/filedetails/?id=2866258937
https://www.youtube.com/watch?v=9Wlb9fdZpKc
doing UI things is a fancy thing for a first mod, grats
Thanks. Doing UI is my jam in programming. π
Hey guys, I have a question
I wanted to stop some items from spawning in the world altogether, so I am editing the proceduralgeneration.lua life
is this correct ?
So with 0 rolls, or 0 on the actual items there wouldnt be any spawns right ?
Looks great!
Will give that mod a try
Can I use item tags within recipes, and how do I put a recipe that keeps two items, so like keep WeldingMask&Blowtorch
just have 2 lines, one which is keep weldingmask and one which is keep blowtorch
and yes you can use item tags, but you need to write the getitemtypes function yourself. just take a look at the existing ones and base it on them
Thank you, I will try to find some examples
@shadow geyser for example, I found this in the games scripts:
keep [Recipe.GetItemTypes.WeldingMask]
Would I still need to define this myself, for the welding mask - or would it just use the predefined game code?
OK thank you!
I am having issues, I am using Intellij and I set the modules up and all of that - but there seems to be at least one missing lua file - VehicleCommands
but it's not in the zdoc-lua.jar file
I followed this:
https://github.com/Konijima/PZ-Libraries
I had no errors
are there any mods that rework PVP? like get rid of stun lock ect
hey, so I want to create custom events for my server. My current goal is to create a scenario where everyone starts in a church and every 24 in game hours a large horde appears with increasing difficulty. Is something like this possible with mods? Where should I start?
possible, but probably alot of work. there might be similiar mods that do parts of those already though, so you might be able to scrap together code and just duct tape it all together
any good sources for getting started in Lua?
Does anyone know why this way of creating a safezone does not work? SafeHouse.addSafeHouse(10927,8989,10843,8939, "BlockedNonClaimable", true)
there is no exception
in my personal experience, the coordinates in game compared to the one from the PZ online map are slightly off.
i walked to the positions ingame
and i used the admin panel safezone tool to test the creation. it worked from the ingame panel.
but i think i am using the lua function not correctly
wait, so is this not 2 cords? addSafeHouseβ(int x, int y, int w, int h, java.lang.String player, boolean remote)
seems like width and length?
Any tutorials on how to mod in custom occupations?
I wanna try to start modding just need some pointers
Can anyone help me with item removing code for mods
This line doesn't really work--
When I use AddItem it works-- but Remove doesn't work
What do I type in to make it removing specific item from the inventory
The uses of that function that accepts a string in the vanilla lua code don't have a module name:
self.character:getInventory():Remove("CampfireKit");```
Might try that.
Aside from that, might have a dig into the java decompiled code to figure out exactly what's happening, if nobody else has some insight they can share.
Might also try using an actual object rather than a string, if an object is available. Then you don't have to worry about getting the type id string right
There are a couple different methods other than the one that accepts a string as you are using
Thank you so much, you helped a ton.
It was as simple as removing the module-- LOVE YOU! β€οΈ
how can i find out if a statement is only workign on the client or server side?
you could print to the log and see which log it ends up in if you test on a dedicated server
:P
local function setSafehouseData(_title, _owner, _x, _y, _w, _h)
local playerObj = getSpecificPlayer(0);
local safeObj = SafeHouse.addSafeHouse(_x, _y, _w, _h, _owner, false);
safeObj:setTitle(_title);
safeObj:setOwner(_owner);
safeObj:updateSafehouse(playerObj);
safeObj:syncSafehouse();
end
this code is running inside the vanilla lua code on the client side within the admin panel.
can i make it work on the server side?
Does anyone know how to modify the attribute of an item that has already spawned?
I'm not even sure if it's possible; it could be in the saved game file. The only thing I've found in the workshop is someone who added a custom recipe where you use the old item to craft a new item, which then has the changed attribute.
Is there a way someone could assist me with making a magazine that gives you Level 5 Aiming, Level 5 Reloading and Level 5 Short Blade when reading?
I'd really appreciate it, as it's for a miliatry RP setup. Thank you so much. Please DM me!
I exported a weapon model as .fbx from blender but it's invisible in game :hmm:, any thoughts?
I believe models are X format not FBX (?)
Read up a bit, seems to be the case. Use a converter.
Any clues?
You can use .fbx models in PZ, and considering all the problems people have with the .x format you probably should.
Having said that, there are all sorts of ways a model can not appear in game that have nothing to do with the format, and can instead be due to errors with the model/item scripts, issues with the model itself, being subscribed to your mod while also trying to work on it on your home computer, etc.
Oh huh, my bad then.
Very much noted, will point people to this if a similar question comes up.
No matter what I do, my zdoc is generating incorrectly with Capsid - anyone got any experience?
Are there any mods on the workshop that allow safehouses in any area? (aka non residential etc) for multiplayer or co-op?
you can toggle that in settings
AdminsSafehouse: When set to true, only admins will be able to take safehouses for themselves.
DisableSafehouseWhenPlayerConnected: This will make it so that when the player who owns the safehouse is playing the game, other players can enter their base and take things. When set to False safehouse will be locked out at all times.
PlayerSafehouse: This is the setting which determines whether or not safehouse will be a part of the game at all. When set to false, noone can claim a safehouse.
SafeHouseRemovalTime: After the player has not visited their safehouse within this amount of time it will automatically be removed from their possession. The amount is in real-life hours.
SafeHouseAllowFire: Toggles whether or not fire can damage an active safehouse. True means that fire can destroy houses.
SafehouseAllowLoot: Allows players that arenβt apart of a safehouse to loot things out of the containers within the safehouse.
SafeHouseAllowRespawn: Allows players the ability to respawn within their safehouse. Players can toggle this option on and off within the Safehouse menu.
SafeHouseAllowTresspass: Allows other players that arenβt apart of a safehouse to enter uninvited. When set to false, other players wonβt be able to enter within 2 blocks of another playerβs safehouse.
SafehouseDaySurvivedToClaim: You can set a certain amount of in-game days that players must have survived before they are able to claim a safehouse for themselves.
ahhh okay tyvm
That's pretty awesome for your first mod. I really like it and find it useful :)
For some of the functions, instead of rewriting your own which are basically duplicates from ISHealthPanel, you may want to consider reusing and decorating them instead. That would allow your mod to integrate with other mods that improve the health panel
For example, ISHealthPanel.doBodyPartContextMenu
Some other mods add additional items to it, which are not displayed in the context menu in the ISMiniHealth panel
Or perhaps simply calling the ISHealthPanel functions. You may not even need to decorate them now that I think about it
I have a problem that the game does not display certain symbols of written text correctly in various interface menus. For example, the string "CαΊ§n cΓ³ Dao CαΊ‘o" is only displayed as "Cn c Dao Co". So all special characters not part of the latin alphabet disappear. Any ideas how this could be fixed?
Just a guess, but perhaps the strings are utf8 encoded while java expects utf16
thanks. I'll try a different encoding. Do you think it is sufficient to change the encoding of the .lua file in my text editor for that?
funny enough but utf16 .luas lead to total crash
got it to work by the way. FBX worked fine, i was naming the model wrong in my script lol
you can use FBX export straight from blender. it's pretty sick.
Maybe pz expects lua files to be utf8. I'm unsure. I haven't looked into how lua handled file encoding at all, so I'd have to research it.
That said, I think the proper way to handle this is to put your localized strings into the proper place so you can retrieve them via getText(), which should handle all the tricky localization and encoding for you
that's point... simply using getText("CαΊ§n cΓ³ Dao CαΊ‘o") also doesn't work for me. Is there anything special I need to add to my code to make the getText() command work properly?
What that amounts to is putting your strings into media/lua/shared/Translate in the appropriate directory and file. Each string will have an identifier. Then in your lua you use getText("IGUI_MYMOD_SomeString") instead of using the string literal.
For EN strings, that'd be media/lua/shared/Translate/EN/UI_EN.txt and it's contents would be
IGUI_EN = {
IGUI_MYMOD_SomeString = "Razor Needed",
}
For VI strings, that'd be media/lua/shared/Translate/VI/UI_VI.txt and it's contents would be
IGUI_VI = {
IGUI_MYMOD_SomeString = "CαΊ§n cΓ³ Dao CαΊ‘o",
}
oh thanks! I try that!
I'm not 100% sure the correct language tag is VI for vietnamese, but hopefully pz uses BCP 47 language tags, which uses vi for vietnamese, and my assumption is correct π
it should be VI
But doesn't work for me either. using getText("IGUI_MYMOD_SomeString") simply prints "IGUI_MYMOD_SomeString" while in game on the respective position. it does not access the data from the UI_VI.txt file
ah... now it works! should be UI_VI = { } and UI_MYMOD instead!
getText("IGUI_MYMOD_SomeString") simply prints "IGUI_MYMOD_SomeString"
getText() will simply print the string you give it when it can't find a localized version. It's not associating what you put into UI_VI.txt with that identifier for some reason
oh, nice :)
many thanks for help!!
maybe there is a difference whether the ui stuff is displayed while actually in game or in one of the menus before you start but not sure here... anyway everything seems to work now
Yea, I think that's true
Oh, other thing I'm noticing now is pain (with no injury) is not displayed/indicated on the doll
Although, it looks like you intentionally didn't include that from ISHealthPanel, so nm :)
How do I access the files of mods I've subscribed too? (win10)
Trying to learn from thm
They are downloaded to your steam folder, Steam/steamapps/workshop/content/10860
Thank you!!!
I think, by default, steam is located at C:/Program Files/Steam
but that's configurable
Ah okay! Thank you! It's appreciated!
Hello, I'm following the same pattern as the base game to create a VHS casette, but the name is not translated, do you know what could be happening here?
RecMedia["e5206ac2-3aee-11ed-a261-0242ac120002"] = {
itemDisplayName = "RM_78f211f6-3aef-11ed-a261-0242ac120002",
title = "RM_dd446b86-3aef-11ed-a261-0242ac120002",
subtitle = "RM_09ce9064-3af0-11ed-a261-0242ac120002",
author = nil,
extra = nil,
spawning = 0,
category = "Retail-VHS",
lines = {...}
This is part of what I have for recorded_media.lua
and in Translate/EN/Recorded_Media_EN.txt this:
RM_78f211f6-3aef-11ed-a261-0242ac120002 = "VHS: Letal Homemade Weapons"
Are you using wordzed?
WordZed Version 1 - download You can add custom radio data to the game via a mod. The radio data including final translation files should go into "media/radio/" within the mod directory. Optionally this simple mod package can be used to get started quickly: RadioTestMod Note: The current version ...
no
I think you need to use wordzed to make texts
the specific translation files, need to have the correct encoding. https://github.com/TheIndieStone/ProjectZomboidTranslations/issues/155
thanks for the info but my problems had already been resolved thanks to @hearty dew
Yeah it is intentional, it only display injuries. Glad you appreciate it π
Hello! Quick question. I am new to modding. I am trying to find where to put a custom item's icon file. Couldn't find it in any guide.
I currently have it in \texture\icon_file.png
but doesn't seem to be the correct location for it
I followed this guide but seems to be outdated
Do you guys have just one PZmod for every IntellijIDEA project ? Is it viable to work on multiples mods under the same Project ? how do you setup your source controls ?
Is some of you are modding together and share their progress with github, or something else ?
fixed!
is there a reason you don't just use itemDisplayName = VHS: How to make a Potato Launcher ?
its very nice
@violet fractal was it hard to get UI on screen?
i would like to know if it was hard because i do plan on making one UI mod myself
you could just copy over and derive new UI from base class
adjust as you wish
i see, i will keep it on my mind
Thanks! It took time to understand how all of those ISPanel functions works but once put together it's quite simple. I mainly looked at ISMiniMap.lua and various other mods such as XP Drops.
check the vanilla cheatmenu UI code, change the variable name and derivation name, then you can modify all the placement, logic and else
I would like to change values in the GlobalModData Table manually by hand. Can i connect with a sql db viewer, or open a text file? where is it located and how can i manipulate it?
Anyone know what happened to Better Cooking? I loved this mod and all of a sudden it was deleted and idk if anyone would happen to know why.
https://steamcommunity.com/sharedfiles/filedetails/?id=2701842297
what's the different between distribution and proceduraldistribution?.. haven't mess with that yet, so I need a little lead.
How do I add another line to an already existing vanilla .lua file with my mod? For example I wish to add another option to the HealthPanelUI -->
When I edit the main file I can add it-- but how do I do that without editing the main file but only by using my mod files?
--edit: nvm I figured that our.. All I have to do is copy the whole file and then edit it. It will overwrite the old one when loading the mod π
No, I was following the same pattern as the base game.
did you try it? it should work fine
And the translations?
you don't need one, as the display name is what will appear as the in game name
as far as i know how that works
debug mode is probably the easiest way to do it. I don't think you can access it externally without making some lua to take your changes. the table is just a lua table that is attached to the save, not an actual database
don't do that, just grab the UI object and add to it. much cleaner, and you will have alot less compatibility issues. Overwriting the entire file is very bad practice unless it is literally impossible to do it otherwise
if you want to do translations, you just need to add lines to the translation files for the displayname in you mod.
how do u do that
the problem is if TIS updates the file.
you just grab the lua object, they aren't local variables, so you should be able to do
cheatPartChangeSubMenu:addOption(asdfjkahsdbgflk)
from another file.
thats good to know thanks alot man
and if it is a local variable, you should still be able to grab it from the UI manager I think. which is more complicated, but still a much preferred method than overwriting a vanilla file.
i have modifyed the debug ui before .i just placed the zombie population button on the front. and i did the copy the file thing. i know you cant delete lua file u just empty it out but the thing is its the same name as the debug ui
so how do i go about undoing what i did
yeah, I don't know of a clean way to work around that weird steam issue. the last time it happened to me, I was just forced to make the change and hoped people would try to unsubscribe and resubscribe. But now that I think about it, it might be useful tov add some info popup to unsubscribe and subscribe, to try to help people fix the issue
I'm looking for someone to help me out with a mod I want to create. I have some coding experience but I've never made a mod before. I also haven't used said coding experience in probably 10 years. If anyone is willing to point me in the right direction I would greatly appreciate it.
Is it possible to attach persistent metadata to a vehicle? Or would I have to store that seperately?
As Capsid is no longer supported, what is best practice for mod making now? I love IDE Features, and I'm wondering how hard would it be and practical would it be to just copy and jar the media/lua and media/scripts to use
I'm not so much bothered about java as I don't intend on modding it too far out of the scope
Capsid still works, doesn't it?
It's not extracting the full lua library, and it's no longer supported
what is missing?
VehicleCommands.lua is one of htem
I am not sure what else could be missing
I even tried remaking the project, and re-importing it twice
hmm, even when it was supported it doesn't look like that file was generated
bug, possibly
could I just repackage the .jar?
the lua files in the folder you posted should work fine, right? I don't think you need it to be a jar to use it as a library
Try check pinned messages in this chat and check some simple mods in steam
Is it feasible to iterate through all the container in the world, then iterate through the items to update certain one?
every server time tick
god I hope not
Every tick? That would be bad
Why would you need to do that, what's the purpose? Maybe someone can direct you
Only the containers in the vicinity of a player "exist" in the world.
And yes, even with just the containers in the player vicinity, this could possibly have a bad effect on performance.
There's an example of searching in the vicinity I believe I read when looking at lua
the code for finding clothes to scrap
why isnt my recipe working
mod isnt turned on
Oops
I have never programmed lua before, what is the intention of this:
MyModName_RecipeCodes = MyModName_RecipeCodes or {};
Is it saying class MyModName_RecipeCodes should be equal to MyModName_RecipeCodes if exists, else create new array?
Is it saying class MyModName_RecipeCodes should be equal to MyModName_RecipeCodes if exists, else create new array?
Yes, but an object, not an array.
*table, not a object
true
Oh thank you
Hello I have a question. If Im starting to get lag from a stupid amount of mods, can I safely look passed the map mods?
They shouldnt be affecting performance if the player isnt close enough to load them in right?
apologies if Im misunderstanding how that works but Im not sure which types of mods to look at first
I would say as long as it's exclusively a map mod, the only thing you should get is extra load time - so I'd say you are right, but I also do not know
VenomousTweaks/scripts/recipes.txt Content: ```js
module Base
{
recipe Take Honey
{
TreeBranch,
keep Ketchup,
Result:Honey,
Time:10.0,
Category:Survivalist,
OnGiveXP:Recipe.OnGiveXP.WoodWork5,
}
}```
I am having issues with my recipe, so I made a very basic one that makes honey from a Tree Branch and Ketchup lol - but it doesn't seem to work still - am I missing something
is there a way to change colour of item name text?
fixed, needed to do as:
module MSGTweaks
{
imports {
Base
}
recipe Take Honey
{
TreeBranch,
keep Ketchup,
Result:Honey,
Time:10.0,
Category:Survivalist,
OnGiveXP:Recipe.OnGiveXP.WoodWork5,
}
}```
they can raise RAM usage
so if you don't have enough RAM they can make lag, otherwise generally yes, though if a map mod has a ton of content in an unusually dense place, etc., it could potentially impact performance
h.. how is ketchup.. what

It was just a test, lol
module MSGTweaks
{
imports {
Base
}
recipe Weld into Metal Plates
{
BlowTorch=1,
keep [Recipe.GetItemTypes.WeldingMask],
[MSGTweaks_RecipeCodes.GetItemTypes.CarScrapDoor],
SkillRequired:MetalWelding=1,
Sound:BlowTorch,
NeedToBeLearn:false,
Result:Base.SmallMetalSheet=1,
Time:100.0,
Category:Welding,
OnCreate:MSGTweaks_RecipeCodes.OnCreate.DismantleCarPart
OnGiveXP:MSGTweaks_RecipeCodes.OnGiveXP.CarPartScrapper15,
}
}```
very strange xD
that's what I am actually trying to do
yeah that's less weird
Haha :p
hey any clue why im getting this when hosting a server?
Can anyone show me how to make a ContextMenu option when other player on MP is right clicked that gives player an infection when clicked.. please
I spent 2 weeks now trying out tons of methods and none of them works-- best I could do is give myself an infection with player:getBodyDamage.. but idk how to do that to the other player π¦
hello all, I am attempting to override a recipe in a local mod I am creating. However it does not seem to want to override it and I can't seem to change the name of it if I just try to create a new item with a modified recipe. Does anyone have any ideas?
recipe Make Gears
{
HCCopperingot,
Charcoal,
Lighter/Matches/PercedWood/HCMagnesiumstriker/HCBowdrill,
HCGearmold,
keep Tongs,
keep HCWorkgloves,
keep HCSmelter2/HCFurnace2/HCBlastfurnace2,
CanBeDoneFromFloor:true,
Result:HCGearcopper=10,
NeedToBeLearn:true,
Time:100,
Category:Smithing,
OnGiveXP:HCWelding_OnGiveXP,
Override:true,
}
I just checked it is a local variable-- so if you have time please explain how to do it the more complicated way with UI manager
what function use to warp survival npc to my character
any example regarding adding combobox in sandbox options? what type other than bool,double,integer?
Hi all, I am trying to get into PZ modding, with the most minimal amount of experience in blender and none at all in all the other important areas. My goal for now is to just replace the player model with a different model I made in blender, but I am overwhelmed with the amount of information and don't even know where to start. Can anybody point me in the right direction and show me a good source to learn about modeling? There are plenty of videos about modeling clothing or weapons, but I am not sure if that is going to help me with my goal.
Is it possible to connect as client in debug mode?
So under the pinned messages there is a pzwiki with a link to the modding section. Not sure if this helps but thats where i would begin
Yes I have seen that, thanks. There are lots of resources, but none about specifically editing the character model, and right now I am still trying to figure out if an excourse into the other resources, which might take me a few hours, is even going to yield results.
In that case i would also check out the indie stone forums. There does happen to be an entire section on 3d modeling
https://theindiestone.com/forums/index.php?/topic/37647-the-one-stop-shop-for-3d-modeling-from-blender-to-zomboid/
Hello and Welcome! Here you will find a concise and comprehensive guide and tutorial of making 3D models for Project Zomboid. Currently, this will mainly pertain to custom Clothing creation but may include weapon creation in the future. This will present how to create models from scratch with Ble...
Okay I havent looked there before, thank you!!
not sure if it would be exactly what you're looking for but it does seem to go in depth in an easy to understand format. And no problem. I've been researching a ton myself to get more into the modding scene. I'm a bit slow on taking that plunge down the rabbit hole lol
I need to know when a player has accessed the mechanics menu on a vehicle. Is there a better way to do this other than overwriting ISVehicleMenu.lua?
Hi, I've been writing a mod that I've mostly got operational single player for testing and laying down the basic operation. I'm now ready to start moving to testing in a dedicated server environment. My LUA is loading and I can get print commands etc to execute, but I'm looking to try and find the right event to hook into to call when the server has finished booting. In SP I use the event "OnGameStart" which kicks everything off. This doesn't seem to be running on my server though, so was wondering, which event from https://pzwiki.net/wiki/Modding:Lua_Event can be used to hook into the server's startup cycle?
I receive a "Object tried to call nil" exception trying to use the same code which works for SP for OnGameStart
If I call my commands in a file called Z.lua which loads at the end of the loading process things seem to work...
@vast veldt All lua files in "client" folder are ignored by the server.
They are in either /server or /shared
Should work. OnGameStart, OnGameBoot, etc
It works provided I don't use the "ongamestart" event - if I call my initializer directly within Z.lua and then use EveryTenMinutes to hook the main program loop, it works, but onGameStart doesn't seem to fire on the dedicated server.
Check names, e.g. not onGameStart but OnGameStart.
Check syntax. I use this: https://rextester.com/l/lua_online_compiler
"attempt to index a nil value" means that syntax is ok.
I'll check it out now, ty
if isServer() then
-- Bind Initialization
Events.OnGameStart.Add(PGMG.Main.initialize);
end
The line above will not run, it gives a nil value exception. The same command:
PGMG.Main.initialize();
Will run provided it is in Z.lua. initialize() calls other classes which are not loaded at the point of LUA execution, although should be by OnGameStart()
Also you should have only one copy of the mod. Unsubscribe your mod that you published recently. Unsubscribe while the game is closed OR remove files manually while the game is running.
Ty. I'm confident I have only one copy, I have not published the mod to workshop yet, I am testing solely on my local client (where OnGameLoad works as I might otherwise expect), or my dedicated server, where I have specified it in the Mods= directive. The mod loads and works pretty much as expected when boot procedure is set in Z.lua
I meant isolate local copy if you are testing dedicated server.)
I can check the mod if you send it in zip.
Sure, one sec, I'll DM you.
https://theindiestone.com/forums/index.php?/topic/43951-how-to-make-interactable-action-with-other-players-in-the-world/&tab=comments#comment-330245
Does anyone have an answer for this?
@willow estuary sorry for ping, but Ive seen you answer some real complicated modding posts and I assume you might have the solution to this..
There is a mod to make syringes with cure and you can inject it to yourself and heal. It was intended as single-player mod. I'd like to upgrade it and make it possible to inject cure to other players and heal them. To do this I need a way to get other player's data. Something like otherPlayer:get...
its been a few months of my death, has there been any framework for adding new crops to the game? or any current-patch example of it?
preferrably a non-spaghetti option
I believe SoulFilcher's farming time adds new crops
the code part isn't all that challenging, being good at graphic art and making sprites is π
in fact, if you can do the sprites, I'll do the code for you.
I believe that one is broken
unless there's been an update to it, I think the mod page itself says that its broken
SoulFlicher even made a Let Us Farm Lettuce to serve as an example of a new crop mod, and I tried using that, did not work
I mean, it "works", crops just never grow, ever
so farmtime, at least last time I had a go at it, did not work
Looking for a tutor to help me through my first mod, I am proficient in modding, and have created mods for other games, however I am finding some issues in appropriating my knowledge here, and someone who could hel me would be appreciated. Private message me if youd be willing to show me the ropes. I have done thr tutorials available, but I will need a more knowledgeable person to help me through constructing the mod I am hoping to work on.
I'm looking to make a teleport function basically
like a console command?
I'd like to create a map teleport functon, either in context menu or otherwise, which will allow players to jump from a home base (safehouse) to a pre-decided spawn point with their current character. This is used to simulate the Tarkov loading into raid feature.
I understand the anticheat will not like this, and it will be unnecessary to make it work with the anticheat, I understand the setting will need to be turned off for this mod to work, similar to how TrueActions - Lying requires it
not at all, if the server executes the teleport, it won't trigger anticheat at all
thats awesome
what you essentially want is a server command that clients can send to trigger the teleport
I play on a server that has it, the added crops grow just fine
How do the loot 'rolls' work conceptually? How do they relate to the chance?
it's basically a ratio
if you want to examine the end result, run the game in Debug mode and turn on LootZed
you can then inspect any container and see exactly what the spawn chances are as a %age
then there must've been an update since I last tried, I can try again
tho its been a few months and it finally dawned on me that maybe adding crops to a trait mod is going a next mile that I shouldn't be going with
How does multiplayer work for modding? I've made a mod that makes changes to ISBuildMenu and buildutil. The changes to buildutil work fine in multiplayer but build menu not so much. Obviously fine in single player, any ideas?
function SomeOtherModFancyFunction()
print("You can't overwrite me");
end
SomeOtherModFancyFunction();```
Is there any clever way to overwrite a function like that defined and used within the same file?
Only thing I could think of is trying to load my file in my mod prior to SomeOtherMod's file and messing with the _G metatable.
yes, you'd need to create a function for __newindex on _G
when key == SomeOtherModFancyFunction - rawset to your code instead
that's some pretty vicious interference though; I'd suggest contacting the mod author as the first port of call
Question: Is there a way to change the context menu text for reading a map to something else other than "Read Map?"
E.g., "Read Tattered Map, "Read Note," etc.
any good mods that add like, push bars to cars or military modded vehicles? downloaded the '86 oshkosh p19A mod from KI5 and its a huge military truck. but it just does NOT go through zombies like youd expect...
Hello! I am working on a mod to add a new mechanic item. I finished the item addition part, but I am not sure how I am able to edit its context menu in-game or how it can be used when you're on a vehicle properties menu. I know it is tied to Lua scripting. Would anyone be able to point me in the right direction for a tutorial regarding that?
p.s.: I'm not totally new to scripting in general, just to Lua
okay so, i did some reverse engineering and was able to figure out the context menu part, however, I am not sure how I can make it so that it appears only when right clicking the battery. As of now, it appears when right clicking any vehicle part
@hollow current Is there an item / context menu option that does something similar to what you are trying to do? If so, I'd use that as a starting point by trying to see how it functions in the vanilla lua sourcd
Battery charger. I already tried searching for its source code and how it detects clicking on the battery exclusively. No luck finding it so far
How ISVehicleMechanics.lua handles inflating tires (search for onInflateTire in that file) might be a starting place. It sounds somewhat similar
I'll look for that, thanks!
I'm not familiar with the battery charger. Is there a string in the UI you can use to search for?
e.g. in the context menu
That's the problem. I can't even find it. No even via in game item spawner when I'm launched in debug mode lol, even though I'd normally find it via my playthroughs (not a modded item)
ISInventoryPaneContextMenu.createMenu checks if there is a car battery charger and adds an option if there is one
if carBatteryCharger then
context:addOption(getText("ContextMenu_CarBatteryCharger_Place"), playerObj, ISInventoryPaneContextMenu.onPlaceCarBatteryCharger, carBatteryCharger)
ISWorldObjectContextMenu.createMenu does something similar with a battery charger:
if carBatteryCharger and ISWorldObjectContextMenu.handleCarBatteryCharger(test, context, worldobjects, playerObj, playerInv) then
return true
end```
What you probably will need to do is decorate one or both of those methods to add another entry into whichever context menu is appropriate for what item/object your mod adds
I will try to put that into action, thank youu
So something like:
local function onOptionActivation(theFancyObject, player)
-- do important, amazing stuff with theFancyObject
end
local original_ISWorldObjectContextMenu_createMenu = ISWorldObjectContextMenu.createMenu
ISWorldObjectContextMenu.createMenu = function(player, worldobjects, x, y, test)
original_ISWorldObjectContextMenu_createMenu(player, worldobjects, x, y, test)
-- get theFancyObject from worldobjects or player inventory perhaps
context:addOption("My option name", theFancyObject, onOptionActivation, player)
end```
I really appreciate the time, thankss
tmk you should be able to have a file with the exact filename and structure, PZ will only load one of the files. I can't remember the exact mechanisms that loads them in which order, but that might be an easy way to make it work by just having an safe file that overwrites that file .
thats because the battery charger is a movable item. and they mostly don't appear in the debug menu because they are a tile. its like how you can't find the items for couchs or chairs in the debug menu. they technically have items associated to them, but they are excluded from that debug item spawner menu.
That makes sense
So, I've tried implementing this, mixed parts of it with the source code of another mod that slightly does a similar function of what I am trying to do. I'd love if someone explained what trueself is supposed to be, as well as what I am doing wrong in the code
--hook the menu to install our button
local old_ISVehicleMechanics_doPartContextMenu = ISVehicleMechanics.doPartContextMenu
function ISVehicleMechanics:doPartContextMenu(part, x,y)
if UIManager.getSpeedControls():getCurrentGameSpeed() == 0 then return; end
local playerObj = getSpecificPlayer(self.playerNum);
local option;
local trueself = self.parent;
if not trueself.context then trueself.context = ISContextMenu.get(trueself.playerNum, x + self:getX() + trueself:getAbsoluteX(), y + self:getY() + trueself:getAbsoluteY()) end--in cases doPart never created the menu, we do it
-- Call the old version of this function to handle all other parts and actions
old_ISVehicleMechanics_doPartContextMenu(self, part, x, y);
if part:getId() == "Battery" then
local JumpstartOption = context:addOption(getText("ContextMenu_BatteryJumpstarter"), trueself, ISVehicleMechanics.onBatteryJumpstart, playerObj)
end
end```
Base.CarBatteryCharger
there is also this code, which works perfectly fine except that its not exclusive to the battery only, but to every vehicle part
require "BatteryJumpstarter"
--hook the menu to install our button
local genuine_ISVehicleMechanics_onListRightMouseUp = ISVehicleMechanics.onListRightMouseUp
function ISVehicleMechanics:onListRightMouseUp(x, y)
genuine_ISVehicleMechanics_onListRightMouseUp(self, x, y);
local trueself = self.parent;--PZ mixes ISVehicleMechanics uses between parent and children, onListRightMouseUp is called on children. but children are not initialized.
if BatteryJumpstarter.OPTIONS.Verbose then print ("BatteryJumpstarter ISVehicleMechanics:onListRightMouseUp. playernum= "..trueself.playerNum); end
if not trueself.context then trueself.context = ISContextMenu.get(trueself.playerNum, x + self:getX() + trueself:getAbsoluteX(), y + self:getY() + trueself:getAbsoluteY()) end--in cases doPart never created the menu, we do it
local JumpstartOption = trueself.context:addOption(getText("ContextMenu_BatteryJumpstarter"), trueself, ISVehicleMechanics.onBatteryJumpstart, trueself.chr, trueself.vehicle)
end
I am sure this is because the function doesn't even have a part parameter to use, but would it be efficient to use this script with a little bit of tweaking?
That's weird. It doesn't appear on my side
Looks like something is breaking your item picker. Maybe it's another mod? I wouldn't suggest working on mods with other mods activated.
Test them with other mods activated, sure, but generally don't work on them w/other mods unless it's a patch for that other mod or something.
It's only the mod I am working with that is activated. I'll try joining the world with no mods at all and see if that fixes it
yea it was my own mod breaking it. Was breaking vehicle spawner as well for some reason
okay figured out both issues. Thanks for the help so much guys!
quick question, what to use to check if a vehicle part is missing and check current battery charge while it is installed in the vehicle (not in inventory)? Is there a way to check all the functions you can use with part:function()?
if part:getId() == "Battery" and part:getUsedDelta() == 1 then``` doesn't work because the ``getUsedDelta()`` is supposed to be for inventory items
for k,v in pairs(getmetatable(part).__index) do
print(k)
end```
Thanks!
oki another question, hopefully the last today. So, I added a drainable item. I have the following code:
function ISVehicleMechanics:doPartContextMenu(part, x,y)
if UIManager.getSpeedControls():getCurrentGameSpeed() == 0 then return; end
local playerObj = getSpecificPlayer(self.playerNum);
local option;
-- Call the old version of this function to handle all other parts and actions
old_ISVehicleMechanics_doPartContextMenu(self, part, x, y);
-- Conditions to jumpstart the Battery:
-- 1. Battery exists
-- 2. Player has Jumpstarter
-- 3. Jumpstarter is not empty
-- 4. Battery charge is 0%
if self.chr:getInventory():contains("Jumpstarter") then --If player has a Jumpstarter
if part:getId() == "Battery" then --If player right clicks on battery
if part:getInventoryItem():getUsedDelta() == 0 then --if battery charge is 0
JumpstartOption = self.context:addOption(getText("ContextMenu_BatteryJumpstarter"), playerObj, ISVehicleMechanics.onBatteryJumpstart, part);
else --This part sets battery charge to 0. For testing purposes only.
RechargeOption = self.context:addOption("Set charge to 0", playerObj, ISVehicleMechanics.ZeroCondition, part);
end
end
end
end
function ISVehicleMechanics.onBatteryJumpstart(playerObj, part)
--math.randomseed(os.time())
local chance = ZombRand(1,100) --Generate a random number between 1 and 100
if chance <= 75 then
part:getInventoryItem():setUsedDelta(0.05);
end
end
The way it should work is that it checks if player has a "Jumpstarter" in his inventory, and if so, and the If conditions are met, it uses up this jumpstarter to set the battery UsedDelta to 0.05, but it also should decrease the UsedDelta of the jumpstarter. How do I store that item in a variable and then manipulate its UsedDelta?
after a bit of searching, I gathered that I need to loop through inventory items. I stored the player's inventory in a variable, then tried to loop through it, but doesn't seem to work. What's wrong?
function ISVehicleMechanics.onBatteryJumpstart(playerObj, part)
local chance = ZombRand(1,100) --Generate a random number between 1 and 100
local invent = playerObj:getInventory()
if chance <= 75 then
part:getInventoryItem():setUsedDelta(0.05);
for i=0, invent:size()-1 do
local item = invent:get(i)
if item:getType() == "Jumpstarter" then
item:Use()
end
end
end
end
try just using getItemFromType() on the inventory to get the jumpstarter
Throws an error
function ISVehicleMechanics.onBatteryJumpstart(playerObj, part)
local chance = ZombRand(1,100) --Generate a random number between 1 and 100
local invent = playerObj:getInventory()
local item = invent.getItemFromType("Jumpstarter")
if chance <= 75 then
part:getInventoryItem():setUsedDelta(0.05);
item.Use()
end
end```
you need to use :
oh excuse me, still not used to lua haha
I think Use() also needs to be with a colon as well, but I might be mistaken
i think it successfully got the item and stored in the variable since it thrown an error at the use part
gonna add a semicolon and see if that fixes it
hmm nope, still throwing an error at item.Use();
... because it should be item:use i think
item:Use() without semicolon does work. It fixed it, thanks!
Although a problem is that if the player has a stack of jumpstarters, it only stores in the variable the first one
isn't that correct, its not like if you have 10 jumpstarters, you are using all ten to jumpstart the battery
What i mean is, assuming i have two, and one of them is fully depleted, would it be possible to have the script ignore it and move on the second?
oh I see, then just use getItemsFromType which will return an array of all of them, then just loop through to use one which has sufficient uses left
Lovely, thank you so much for time. It means a lot!
Does anyone know how to mamually install a mod? (i.e. a zip file containing a mod)
does anyone know where the code responsible for in game time is?
or the code responsible for item spawning?
It goes (uncompressed, unarchived) into Zomboid/mods, which is in your home directory
There is an example mod there that should serve as a guide to how the directories should be structured
Thanks man
hi .
is it posible to have a function act on items placed on ground? timebased
similar to despawn but instead of despawning it it does something else
How to check if the player sees a square?
Would anyone have an idea of how to show a textbox?
This line is included in a mod that uses a textbox but seems outdated.
local modal = ISTextBox:new(0, 0, 280, 180, getText("Change item name"), weapon:getName(), nil, ISInventoryRenameWeapon.onRenameWeaponClick, player, getSpecificPlayer(player), weapon);
What kind of textbox? Like a tooltip? Or a modal dialog that the user has to dismiss?
a window with a textbox where the player has the ability to write in, then can press the "ok" button
i think i figured it out though, gimme a min
nope, didn't
Okay I just did, thanks!
depends on what you mean. if you mean if is being rendered on the screen I am not so sure, but there is a java function if you want to check line of sight stuff called lineClear() in Losutil which you can probably use
btw, we allowed to publish own mods here, or is the channel dedicated for modding questions only?
Hello, has anyone has made an UI children button? I don't know what wrong I've done but I keep getting an error when I call the addchild() function
function ISMiniHealth:createChildren()
self.bottomPanel = ISPanel:new(5, 5, 20, 20)
self:addChild(self.bottomPanel)
end
Seeing other codes around they just call the addChild() with just the children element as an argument and that's it. But I doesn't want to let me to it in my code for some reason I still don't know...
just look at vanilla examples that use addchild, there is so much more that they do before addchild
I tried various things such like initialise() and instantiate() on the child element but I'm still getting this error
I took the piece of code from vanilla ISMiniMap.lua and it does nothing else before calling the addChild() function
function ISMiniMapOuter:createChildren()
local btnWid = 31
local btnHgt = self.bottomHeight - 1
self.bottomPanel = ISPanel:new(self.borderSize, self.inner:getBottom() + 1, self.inner.width, btnHgt)
self:addChild(self.bottomPanel)
self.bottomPanel:setVisible(false)
end
try setting self.bottomPanel.enable = true
Still same error
I even tryed to add self.bottomPanel.anchorBottom = false since the error stack trace on ISUIElement.lua stops there but still same issue
Might be some layout validation or child element validation that is occurring in java. I don't have the java code decompiled, but might be worth doing to see why setAnchorBottom is throwing that exception
or maybe it is a type mismatch, actually
Oh, hrm, it just looks like a boolean
self.bottomPanel = ISPanel:new(5, 5, 20, 20)
self.bottomPanel:initialise()
self.bottomPanel:setAnchorRight(false)
self.bottomPanel:setAnchorLeft(true)
self.bottomPanel:setAnchorBottom(false)
self.bottomPanel:setAnchorTop(false)
self:addChild(self.bottomPanel)
Does that work, explicitly setting all the anchors in a consistent manner?
Funny, now the stack trace stops at line 649 at ISUIElement.lua
I will try to fiddle with those
try taking a look at the UI api mod on workshop
Possibly could be something in parent that those values are validated against. Looking into those java methods could shed more light onto what exactly is happening. I don't have the java decompiled, otherwise I would
it has code for creating buttons really easily, so you can check how those functions are creating buttons, and it should inform you whats wrong
actually, is it only the button that is not working? do you have any other UI working?
This is the only time I try to add child element
ok can you send what the current code you have is, then the error you get when you run it
Good evening all, I have a quick question, is there a way/event I could use in shared lua code to edit an item (i.e. condition/name of a weapon) at the specific moment it is loaded in the container?
OnfillContainer
they are all listed here :https://pzwiki.net/wiki/Modding:Lua_Events
I think I fixed it
I changed where ISMiniHealth:createChildren() is called
It was called inside ISMiniHealth:new(), I moved it outside right after ISMiniHealth:initialize() and ISMiniHealth:instantiate() are called
Yeah it definitely fixed my issue. My function was called at the wrong place.
Well sorry, that was a kinda dumb mistake, thank for taking your time
Nice! Thanks Robot π
i know there's a way to loop get all items
but i can't find it atm, been a bit
anyone point me at that?
hm
so i need to loop through all recipe-teaching magazines/books
i am unable to find a way to just get all items and then loop through that and filter
anyone?
Why is it so hard to commission a mod? Is modding that hard? excuse me if i sound ignorant cuz i am but I literally just want a vending machine that only excepts gold jewelry. and if i could put my own items in it and set the price that would be great.
Its time consuming and usually done as a labor of love, just combing over the JavaDocs to be come familiar with the API takes time
Yeah it's usually hard and quite time consuming, and sometimes even for nothing. For example, I just spent the last 4 hours on a piece of enhancement code for an existing mod without any conclusive result. I mean, it's very nice when everything works out but it can also kind of feel like a job and it requires quite the motivation to persevere until a stable mod is achieved.
Quick question. I'v added an item on the server to a player's inventory and changed UsedDelta. How to transmit changes to the client?
(And not even speaking of maintenance here π )
Damn where do u even begin learning mod creation for this game? Id love to learn cuz i got plenty of great ideas
I found that this guide covers it well https://github.com/FWolfe/Zomboid-Modding-Guide
You also have the official wiki page with others https://pzwiki.net/wiki/Modding
So essentially you are learning coding or programming and it happens to be in a language that zomboid can understand and the side effect is that you can mod zomboid
like onkeen said its usually a labor of love and feels like a job. Modders are naturally in the coding field usually in the same language so its like they can come home and make magic happen after work in their spare time otherwise your living life and learning the language in the gaps
What's the best way to detect if a player is say within 5 squares of a body of water (natural water, not rain barrel or whatever)?
probably just loop through the outer tiles and check if the tile is a water tile
I would say the best way is to start really small, and not starting with anything particularly unique. its alot easier to try and make something similiar to another mod, as you can use another mod as a template to learn from, and slowly learn different aspects of zomboid modding
there's an example of this in Tread's Fuel Types API, i think it's pulled from vanilla and modified so there's also an example in vanilla but i don't know where :p
Good advice
i started by making my own versions of others' mods with permission
e.g., adding features and such
w/o needing permission, you could also try making plugins that modify and require existing mods
after a few of those you may feel confident enough to make your own stuff
or you can just jump into it 
i just did that because it was what i wanted to do at the time
i concur with robot's advice re: your own first few mods that aren't based on or plugins to others' tho
@shadow geyser do the server code will run even when there's no player?, tried to iterate every SH then the floor, for checking containers and the items in it.
Also, I made a syntatic recipes, to execute some moddata manipulation to the item(ingredients) with RemoveResulItem, tried every ways, when performing to all items, it doesn't loop thru item with the sam type, or either the loop wont stop at all.
I don't think so. if there are no players on the server im pretty sure nothing in the world is loaded.
@jaunty gate Personally if I was to go about checking for water around a players position it would be a double For loop (One inside the other), with a max of 5 iterations of both Checking if each tile is water, then breaking the loop as soon as it finds a confirmation, if no matches are found the 25 tiles checked, then when the player moves in a X/Y direction check the 5 tiles in said direction until a match was found.
there's a setting to pause the server or not when no players are on
it probably still means nothing is loaded
but
code still runs
e.g., plant watering updates happen, my update checking mod runs, and so on
ah... tried to print something in the server code, when I logged out, none was printed.
nvm, the print was on getDebug() scope, had to move it out... it works.. server code runs
So in short, i can do update to certain container when no player loaded that chunk at all?
wanted to iterate thru all of certain type of items in the world, and update moddata in it. i'm sure this should be done in server, since client only load what it sees.
since i dunno if there's function bridge to do that, i just iterate thru the safehouses and added extra tiles check, where it iterates container and the items in it.
@weak sierra @shadow geyser thanks anyway, there's another question, is there any different between require() and require "xx" ??, I saw in intelliJ, require("xx") are only accepting function param, let's say I wanted to require file client/Timed/A.lua (A.lua doesn't return anything, only global func inside of it) from another mod, what's the right way to require it? "client/Timed/A" or just "Timed/A", I'm not sure tho
@weak sierra ah yeah... seems it iterates nothing, even when there's player around (far from certain coordinates that should be checked), it still iterates nothing, do you know any way to iterates thru containers/items in existence without having the player to load it?
hehehe
yeah
no
you can't do a damn thing without things loaded
you could from java
the only way to do that would be to move a "character" through the world to load things like a cursor
afaik
it's best to run code on the client and throttle it by how long it's been since the code ran to kinda "simulate" having it run serverside instead
if the code itself has to execute from server then use a command sent from the client to the server
but getting complete lists of X in cell and such is an impossibility as it all depends on the reality bubble of a player
really wish they'd add functions to force a square, chunk, or cell to load completely
that way things like this could be done without pain
you could iterate through whatever spatial unit is required and do whatever
They are the same. In lua, you can call a single argument function without using the parens (if the argument is a string literal)
And in that scenario, you'd want require("Timed/A")
that's news to me
good to know
Ah I see... do you have any example for throttling/debouncing?, now I'm relying on throttling/debouncing guard on every10mins tick, i dunno if that's the right approach, would love to know if there's some kind of object/chunk onload to trigger function execution, so I dont have to rely on 10 min tick to check something, knowing the code will only run if the chunk is loaded, I assume this way -> if the player go far from that cells before the next event tick.. the code will not reach that object.
or probably I should try to derive from SGlobalObject to test on something, probably its possible to make it global like a plants
there's an on load for squares
LoadGridsquare and ReuseGridsquare
i have some code i wrote for vehicle-related stuff
Thanks!.. gonna check on it
i loop thru all vehicles loaded in the area on OnPlayerMove
but only run that if it's been N real minutes/seconds since the last
or if the cell changes
and then do proxy check on each
in one of my mods
may I see it? probably i could learn from it to handle my use case.. seems similar from what i'm trying to do
except this only for container/items check
in every loaded square with container in it
u might take a peek at Time Decreases Loot
and their proximity container code
cuz it's probably what ur trying to do..?
thanks alot man!, i'm gonna check on it
Does anyone by chance know what file contains how Carry weight is calculated?
IsoPlayer:setMaxWeightBase(value);
is the best ive found, problem is that it doesnt adjust with player health etc.
and id rather avoid repeat checks
well it's more like transforming the said item to another one after a period, probably like fresh to become rotten, I haven't seen the fresh/rotten code yet, since this is only a patch that i'm working on, I try not to do a total overhaul/override to the core concept of the transformation, so for now have to rely on timestamp moddata before it supposed to change, also this is some kind of playground for me to learn Lua as well
the code has flaw, where it only do daily tick, whereas if player fails to be on certain cell on that tick, it wont transform at all..
im pretty sure that that's what the base game does, has a timestamp and then calculates what should be done when the item updates
but i dont know for sure either
cuz stuff rots in ur inventory when ur offline
and that's stored in players.db in multiplayer
in a binary blob
so it isn't being updated while ur offline
therefore timestamp probably
i see.. seems have something to do with ongamestart as well, that's why im searching for "onload/onseen" function
ah great insight... thanks man!
getText("IGUI_char_Weight") .. ":", tostring(math.floor(self.char:getNutrition():getWeight())), self.weightBtn
Closest hint ive found so far
sadly thats player weight lol
have you check IsoGameCharacter.java ?
You sir, are my hero lol
idunno ifthat what ure lookin for
Thats EXCATLY it
yea there's this.BodyDamage.ReduceGeneralHealth(var2); since you're talkin abt health
where are you accessing that btw?
@meager lion btw it's 12k lines long.. :S
not surprised since it stores and handles all the stats of a player
@meager lion in the decompiled source, https://github.com/Konijima/PZ-Libraries
there's also setMaxWeightBase in there
Everything on the JavaDocs for IsoPlayer is in that lol
yep that's the needle since @meager lion mention abt it
yeah but not always the other way around
sometimes stuff is in there but not exposed
True
I was more interested in the formulas then anything since that was shrouded in mystery for me lol
the snippet of code we were seeing was fall damage
the setting of max weight is just.. thing = thing
I wonder if it's because a decompiled source, do devs really wrote 12k lines long? :S
Sadly some files end up that way
that has an impact but it's usually not ludicrously longer
bytecode only has so many interpretations
I just blatantly press ctrl+b (go to declaration/usages) all the time to scroll it..
all that var1,var2 etc params, do really need to be digested carefully, glad some of useful type were there
the names of locals are lost at compile time
thus the generic names for some things and not others
when u decompile
non-local things could be referenced by external code
thus they are in the output
the symbols
unless u have a debug build ofc
in which case it's all there
probably they should provide .pdb stuff like in C# for modders :S just my thought
that'd be nice :p
if there's an equivalent in java
ofc they could also just add a java modding hook
i'd kill for that π
lua is painful
and the exposed api is limited
have you check/try this yet? https://github.com/pzstorm/storm, i'm pretty curious about how it done, but have no guts to try it yet.
no point, i mod for my server
REALLY painful.. especially the debugging process
and ppl won't be installing a modding hook into their game files by hand
so
useless to me
no typesafe either.. i came from typescript.. so yeah.. make me pretty confused
ah i see
so it need hooks
there's a thing called pipewrench that lets u mod PZ in typescript
it has limitations
but
sounds nice ig? i dont know typescript and i've already learned lua tho
yea, thinking about that in my next project, if it could import 3rd lib as ease as developing for the web like lodash.. damn... i ask nothing more
you should try tho, it's some kind of C# derived concept (from microsoft), whereas C# are pretty similar to java, only the syntax tho
yesterday alr ask Konijima, he's not sure either, so probably I should just wait for the next version of pzpw before using it,
i have a decade or so of experience in C#
typescript sounds preferable to js
but it's js-based, not C#-based
if (this.Traits.Strong.isSet()) {
this.maxWeightDelta = 1.5F;
}
if (this.Traits.Weak.isSet()) {
this.maxWeightDelta = 0.75F;
}
if (this.Traits.Feeble.isSet()) {
this.maxWeightDelta = 0.9F;
}
if (this.Traits.Stout.isSet()) {
this.maxWeightDelta = 1.25F;
}```
Rather weird this is done it seems
this.getParentChar().setMaxWeight((int)((float)this.getParentChar().getMaxWeight() * ((IsoPlayer)this.getParentChar()).getMaxWeightDelta()));```
yep its a JS, I meant the language/TS compiler is designed by Microsoft just as C#.
multiplied with the delta, wheras the delta can be manipulated by another aspect as well?
you can set the Delta to adjust the multiplier, i would assume this is just a quick and easy tweak for strength
Heres where it gets kinda interesting 1 sec
heres the whole snippet for everyon
this.getParentChar().setMaxWeight((int)((float)this.getParentChar().getMaxWeightBase() * this.getParentChar().getWeightMod()) - var1);
if (this.getParentChar().getMaxWeight() < 0) {
this.getParentChar().setMaxWeight(0);
}
if (this.getParentChar().getMoodles().getMoodleLevel(MoodleType.FoodEaten) > 0) {
this.getParentChar().setMaxWeight(this.getParentChar().getMaxWeight() + 2);
}
if (this.getParentChar() instanceof IsoPlayer) {
this.getParentChar().setMaxWeight((int)((float)this.getParentChar().getMaxWeight() * ((IsoPlayer)this.getParentChar()).getMaxWeightDelta()));
}```
var1 is all moodlets
if (this.getParentChar().getMoodles().getMoodleLevel(MoodleType.Bleeding) == 4) {
++var1;
}```
Hungry, Thirst, Sick, Bleeding, Injured 2,3 & 4
Line 1791 of BodyDamage.java
is the strength modifier
ah yeahhh interesting tho, can you edit it with triple '''java
so ppl can see the syntax highlight, the chain method make it pretty mess to read
mb lol
its fine xD
is it exposed in the lua?
public float getWeightMod() {
int var1 = this.getPerkLevel(PerkFactory.Perks.Strength);
if (var1 == 1) {
return 0.9F;
} else if (var1 == 2) {
return 1.07F;
} else if (var1 == 3) {
return 1.24F;
} else if (var1 == 4) {
return 1.41F;
} else if (var1 == 5) {
return 1.58F;
} else if (var1 == 6) {
return 1.75F;
} else if (var1 == 7) {
return 1.92F;
} else if (var1 == 8) {
return 2.09F;
} else if (var1 == 9) {
return 2.26F;
} else {
return var1 == 10 ? 2.5F : 0.8F;
}
}```
Somewhat yes
setMaxWeightDeltaβ(float float1)
setMaxWeightβ(int int1)
setMaxWeightBaseβ(int int1)```
off of IsoPlayer
if (this.getParentChar().getMoodles().getMoodleLevel(MoodleType.FoodEaten) > 0) {
this.getParentChar().setMaxWeight(this.getParentChar().getMaxWeight() + 2);
}```
Never understood this. IRL I lift less if I'm overstuffed with food, but it's temporary strength buff in pz π
I wonder if Overstuffed isnt classified as a Positive Food eaten moodle?
few questions
1- How do I make it so that a context menu option that I added is reddened out (can't be pressed)
2- How do I add a tooltip to the context menu option so that it appears as some kind of a description when mouse is hovered over it
3- How do I get the "generator" object that is placed in the world, so that I can add an option to its context menu when its right clicked?
You may check sow seed code
#3, might look in ISWorldObjectsContextMenu.lua (I think that's the filename). If not, can try grepping around for the term 'generator'
ISFarmingMenu.canPlow = function(seedAvailable, typeOfSeed, option)
local tooltip = ISToolTip:new();
tooltip:initialise();
tooltip:setVisible(false);
option.toolTip = tooltip;
tooltip:setName(getText("Farming_" .. typeOfSeed));
local result = true;
tooltip.description = getText("Farming_Tooltip_MinWater") .. farming_vegetableconf.props[typeOfSeed].waterLvl .. "";
if farming_vegetableconf.props[typeOfSeed].waterLvlMax then
tooltip.description = tooltip.description .. " <LINE> " .. getText("Farming_Tooltip_MaxWater") .. farming_vegetableconf.props[typeOfSeed].waterLvlMax;
end
tooltip.description = tooltip.description .. " <LINE> " .. getText("Farming_Tooltip_TimeOfGrow") .. math.floor((farming_vegetableconf.props[typeOfSeed].timeToGrow * 7) / 24) .. " " .. getText("IGUI_Gametime_days");
local waterPlus = "";
if farming_vegetableconf.props[typeOfSeed].waterLvlMax then
waterPlus = "-" .. farming_vegetableconf.props[typeOfSeed].waterLvlMax;
end
tooltip.description = tooltip.description .. " <LINE> " .. getText("Farming_Tooltip_AverageWater") .. farming_vegetableconf.props[typeOfSeed].waterLvl .. waterPlus;
local rgb = "";
if seedAvailable < farming_vegetableconf.props[typeOfSeed].seedsRequired then
result = false;
rgb = "<RGB:1,0,0>";
end
tooltip.description = tooltip.description .. " <LINE> " .. rgb .. getText("Farming_Tooltip_RequiredSeeds") .. seedAvailable .. "/" .. farming_vegetableconf.props[typeOfSeed].seedsRequired;
tooltip:setTexture(farming_vegetableconf.props[typeOfSeed].texture);
if not result then
option.onSelect = nil;
option.notAvailable = true;
end
tooltip:setWidth(170);
end
#2, not sure about context menus specifically, but other ui elements have a tooltip key used for that purpose. If you have an example of a tooltip in a context menu in-game, you could take that string and try searching for it in the lua code. I don't know of any off the top of my head to search for
mix with OnPreFillInventoryObjectContextMenu or OnFillInventoryObjectContextMenu with params (player, context, items)
local MENU = context:addOption("Sow Seed", player, OnClick, args...), something like that
then your tooltips function like above .canplow which take option as the third args, so xxx:canPlow(arg1, arg2, MENU)
Thanks so much for the help!
hey guys, I ended up adding black wood to my home hosted server and it doesn't seem to come up as an option to spawn in, town is there and everything just no option to spawn in, anyone know how to fix this? or do I have to manually add the location?
I would assume you need to add in custom spawn locations
use either
servertest_spawnpoints.lua or
servertest_spawnregions.lua
@meager lion that's what I assumed, I had the conclusion that maybe not because it works fine on the steam hosted servers.
thanks man
np, gl
yup, gonna need it, this game makes it very hard to self host lol
@meager lion any clue how to check downloaded mods?
this is all I'm seeing
its done through servertest.ini
yeah, I'm just trying to find the main download of the mods
As for if they download that im not sure on, ive got a dedicated for my projects
just wondering is all
you cannot, without using loadgridsquare to load in the specific squares with the containers.
use require "path\to\filename" when you just want to ensure another file has been loaded first. use require("path\to\filename") when that file name also is returning an object, typically a lua table. the require function with the brackets is a nice way to access tables without having to put them into the global space, as you can store all the functions from that file inside their own table and return the table in that file. as an example:
library.lua:
mylib = {}
function mylib.foo ()
functionstuff
end
function mylib.bar()
functionstuff
end
return mylib
so in another lua file
mylib = require("path\to\library")
the mylib object now contains those functions. you can do this to store constants, or even just data for your mod. its a really good way to keep the global table clean
aha... is ErosionMain.LoadGridsquare what you mean by?
Ah... I see, for now I only want to ensure another file has been loaded first, somehow the original function in the mod that I patch still get called instead of the overridden func, probably because the code lies in the Client (original), meanwhile I override in the Client (patch) as well, then need to call those function in the Server, I guess I have to move it out to Shared so server can call the new function instead of the original one.
there should be one in isochunk. I've never actually personally used it, but it is a public function, so i figure you can use it
Thanks for the lead man!
local BatteryJumpstarter = {}
local generator = nil;
Events.OnFillWorldObjectContextMenu.Add(function(player, context, worldobjects)
local objects = player:getSquare():getObjects()
for i = 0, objects:size() - 1 do
local object = objects:get(i)
if instanceof(object, 'IsoGenerator') then
generator = object
end
end
if generator then
local playerObj = getSpecificPlayer(player)
local playerInv = playerObj:getInventory()
local option = context:addOption("test", worldobjects, BatteryJumpstarter.onJumpstarterRecharge, generator, player)
end
end)
function BatteryJumpstarter.onJumpstarterRecharge(worldobjects, generator, player)
print("test")
end
return BatteryJumpstarter```
Any idea why I get an error thrown at local objects = player:getSquare():getObjects()?
code is supposed to check the objects in the square that the player right clicks, and if it has a generator, it adds a context menu option
okay i figured it out, it should've been local objects = playerObj:getSquare():getObjects()
but now the option appears only when I stand on the generator. I guess this code checks the square where the player is standing, not where he presses
any idea how to get around it?
yes, notice the playerObj
How do I make it check for the click square instead of the playerobj square?
something about Cursor, try to check in farming code
@hollow current probably ISSelectCursor:onSquareSelected
What up, I'm here again and I brought this https://cdn.discordapp.com/attachments/819371542701801483/1023552253321289828/Project_Zomboid_2022.09.25_-_08.03.57.02.mp4
local objects = ISSelectCursor:onSquareSelected():getObjects()
throws an error
whoa looks awesome
@lime hedge I think the ISSelectCursor needs to be defined first? i am not sure
function ISSpawnHordeUI:onSelectNewSquare()
self.cursor = ISSelectCursor:new(self.chr, self, self.onSquareSelected)
getCell():setDrag(self.cursor, self.chr:getPlayerNum())
end
function ISSelectCursor:new(character, ui, onSquareSelected)
local o = {}
setmetatable(o, self)
self.__index = self
o:init()
o.ui = ui;
o.onSquareSelected = onSquareSelected;
o.character = character
o.player = character:getPlayerNum()
o.noNeedHammer = true
o.skipBuildAction = true
return o
end
fill required param
woah that looks great, how was the model made? that looks amazing
what the dog doin
require "" and require ("") are semantically equivalent. Just different syntax to call a function in the same way. Both return the return value of the chunk from the loaded module
isn't the following invalid syntax? I haven't actually tried it. the lua documentation also doesn't really have any examples
library = require "path\to\module"
might be correct, but in either case, ever where I see it being used, when actually catching the returned objects, I always see people using the bracketed version, and the keyword version when just making another lua file load first
stat ::= varlist β=β explist
varlist ::= var {β,β var}
explist ::= exp {β,β exp}
stat ::= functioncall
exp ::= nil | false | true | Numeral | LiteralString | β...β | functiondef |
prefixexp | tableconstructor | exp binop exp | unop exp
prefixexp ::= var | functioncall | β(β exp β)β
functioncall ::= prefixexp args
args ::= β(β [explist] β)β | tableconstructor | LiteralString```
Looks valid as an assignment statement either way with the grammar from the 5.4 lua documentation
Functions the same way too. Just tested it in pz.
local JSON = require "lib/JSON"```
Sorry, but I am not sure how I can exactly implement that in my code
By the way, I also looked at the vanilla source code
IsWorldObjectContextMenu.lua
it has something to define the generator, like:
ISWorldObjectContextMenu.fetch = function(v, player, doSquare)
local playerObj = getSpecificPlayer(player)
local playerInv = playerObj:getInventory()
local props = v:getSprite() and v:getSprite():getProperties() or nil
if v:getSquare() then
local worldItems = v:getSquare():getWorldObjects();
if worldItems and not worldItems:isEmpty() then
worldItem = worldItems:get(0);
end
end
if v:getSquare() then
building = v:getSquare():getBuilding();
end
if v:hasWater() then
-- Don't choose a puddle if a sink is available.
if not storeWater or isPuddleOrRiver(storeWater) then
storeWater = v;
end
end
c = c + 1;
if instanceof(v, "IsoGenerator") then
generator = v;
end
end```
i've tried to implement it in my code as well, but no luck so far. It doesn't throw any errors, but the option doesn't show up at all
I am currently working on a mod which adds new food items which can possibly be poisonous. Want to arrange things so that the player can detect that they are poisonous according to the same rules as in the vanilla game (i.e. depending on the player's cooking skill). What I have found out so far is that there is a java method called setPoisonDetectionLevel(int) which is somehow related to the visibility of poison in a food item.
Does anyone knows how this setPoisonDetectionLevel command exactly works? I did some play-testing with it but have not been able to see things clearly atm...
huh, thats good to know.
I don't know how that method works, but decompiling the java source could help provide some insight into how it functions. There were some instructions earlier today someone posted on how to do that
.
Thanks for the suggestion. If no one has any experience with said java command, I'll probably should have a look at it.... π
um im still facing issues. Can't solve it so far.
require 'ISUI/ISWorldObjectContextMenu'
ISWorldObjectContextMenu.fetchSquares = {}
local BatteryJumpstarter = {}
local generator = nil;
Events.OnPreFillWorldObjectContextMenu.Add(function(player, context, worldobjects)
--Detect if the generator exists, somehow?
end)
Events.OnFillWorldObjectContextMenu.Add(function(player, context, worldobjects)
local playerObj = getSpecificPlayer(player)
--local objects = playerObj:getSquare():getObjects()
--for i = 0, objects:size() - 1 do
--local object = objects:get(i)
--if instanceof(object, 'IsoGenerator') then
--generator = object
--end
--end
if generator then
if generator:isActivated() then
local playerInv = playerObj:getInventory();
local option = context:addOption("Recharge Jumpstarter", worldobjects, BatteryJumpstarter.onJumpstarterRecharge, generator, player);
end
end
end)```
This is what I have
poisonChance = 0, --percent chance the item is poisoned
poisonPowerMin = 0, --minimum amount of poison to apply
poisonPowerMax = 0, --maximum amount of poison to apply
poisonDetectionLevel = 0, --level required to detect the poison
That's from forageDefinitions.lua. Just a hunch, but I'm guessing that the value provided to the setPoisonDetectionLevel() method sets the cooking skill level at which a player can see whether an item is poisoned?
Many thanks! I searched the whole zomboid folder via a certain commands for the string "PoisonDetectionLevel" but this hasn't been shown to me in the result! Very helpful!!
ah no... I think I searched for "getPoisonDetection" and therefore missed that result.... XD
