#mod_development
1 messages Ā· Page 31 of 1
That may only work on non--debug clients though
I'll test that too. I'm curious :p
local x = "hi"
print("This should be 3329")
print(getClassFunction(x,4):invoke(x))```
This works with `-debug`.
Without `-debug`, however, causes an error because `invoke` isn't exposed.
LOG : General , 1664924179296> This should be 3329
LOG : General , 1664924179302> -------------------------------------------------------------
attempted index: invoke of non-table: public int java.lang.String.hashCode()```
in zombie.Lua.LuaManager.Exposer:exposeAll(),java if (Core.bDebug) { this.setExposed(Field.class); this.setExposed(Method.class); this.setExposed(Coroutine.class); }
java.lang.reflect.Method is only exposed when Core.bDebug is true. So calling java.lang.reflect.Method:invoke() fails with that error in non-debug clients
Can any modders here please look in mod support, i really just am trying to figure this issue out
Hello! I'm sorry to interrupt you, Tyrir.
I'm making a mod that utilizes corpses and I'm currently creating the recipes for it.
Unfortunately, picking up a female zombie corpse turns it to a male corpse ( the item type - not visual ) and so I'd like a right click drop-down menu for male and female ( and maybe even race )
TL;DR I was wondering if I could create a drop-down menu in a recipe code? Much like ClothingItemExtra / ClothingItemExtraOption found in clothing scripts. Is it possible?
` recipe White Female Corpse Splayed Hair Clothes
CorpseMale,
Result:Body_Femme_b_01,
Time:100.0,
OnCreate:Recipe.OnCreate.Body_Femme_b_01,
Category:General,
`
Any pointers appreciated.
i don't understand what you're asking here
Could try implementing a simple hash function for strings if you don't need anything cryptographically secure. This is djb2
function djb2(str)
if type(str) ~= "string" then
error("don't do that")
end
local hash = 5381
for i = 1, #str do
local c = str:byte(i)
hash = hash * 33 + c
end
return hash
end
Quick question
I am trying to debug an issue that is caused when my mod is running with another mod.
for _,worldObject in ipairs(worldobjects) do
for _, size in pairs(Basement.Sizes) do
The first line is from mine, the second line is from the other mod. I am not sure, but could it be the _ of both mods overlapping together? As in some kind of a variable name/value overlapping?
yeah, I don't need anything secure, just unique for small changes
ideally this would be unique enough to see what ItemTweaker changes happened
so that will probably do the job
Thanks for looking into it for me!
also no worries about the delay, I'm mostly information-gathering right now
these variables are always local
no, _ is a lua convention for a discarded/unused variable
aah im gonna have to look into it further then, thanks!
I'm looking for a drop-down menu for crafting recipes.
Sorry, it's difficult to explain for me.
Main option ->
Option 1
Option 2
Option 3
(Though I'm starting to believe it isn't possible. Thanks again though)
When right-clicking an item in the inventory or in the game world?
Yes, when right clicking an item. It's a crafting recipe that I need this to apply to.
Not a clothing item.
You can add another entry to the context menu that is rendered when you right click an inventory item, yep
Any tips or guides for zombie behavior? or how they move?
O hey 8hoursofsleep, it's Mister E!
And thank you so very much Tyrir, I'll give it a shot. Goodluck with your work.
@median prairie You do it in lua though
sec, that was for world object, not inventory items
Here is the basic code for it
Oh that is so much easier. Thanks! You've saved me from pulling out (most) of my hair š
Heya Stubbs! š¤£
Good to see you around
Put that in media/lua/client/mymodid_contextmenu.lua
Anyone here have experience with Noir's Shop/ShopX mods?
Specifically I need to know if there's an upper limit to the # of tabs you can have, as I've triple checked everything yet my custom tabs are not appearing
the All tab contains all of the items listed for each tab, but the categories themselves don't show
Are some tabs appearing?
Can you scroll through tabs?
If there's a finite space for them to appear I would assume that'd be it?
No, the tabs aren't showing at all. I have Favorites, Sell, and All showing which are defaults
How do thangs
I've got the definitions set up, the individual .Lua files named correctly for each tab and the translations set up, but no dice
I've never used that mod, but if custom tabs is a feature the maybe the author is here or you can leave a comment
Hey, so just to get it out of the way, I am complete code illiterate, so I was wondering if someone with absolutely no background in coding could essentially splice two mods together to create an ultimately new concept; To elobrate - There is RV interior mod, and then there is a black hawk mod. - more or less a good starting point for what im trying to do; Now I bring this up because Im trying to recreate a complete meme of a conversion of a sikorsky utility helicopter into a flying RV. https://www.motor1.com/news/598285/winnebago-flying-rv-camper-cabin/ - To summarize, im just wondering if one would consider it ethical first off to use the codes of others to create this,(I plan to post credit where its due), furthermore could anyone point me in the right direction as far as tools I would need to undertake such a meme of a project?
Hrm.. is it possible to run pz or the dedicated server in non-steam mod while having available your dev mods in ~/Zomboid/Workshop? It's a pain to get the client to connect to the dedicated server via steam (You have to have a publicly visible IP, it seems. Local loopback or LAN IPs don't seem to work)
If I were on linux, I could make symlinks into ~/Zomboid/Workshop from ~/Zomboid/mods, but can't make symlinks to directories on windows 7 afaik (at least not with cygwin tools)
As far as I'm concerned, we all copy, if you copy too much of something, you will have to add credits or ask the creator for permission, everything will depend on the license that he has in the mod description. You can also go the extra mile to copy and enhance, modify so much that it's no longer recognizable, you'll be able to get out of a DMCA request, that said, it'll all be on your conscience.
God teir meme
where can i find the script to add evolved recipe
item Lemon
{
DisplayName = Lemon,
DisplayCategory = Food,
Type = Food,
Weight = 0.2,
Icon = Lemon,
EvolvedRecipe = HotDrink:2;HotDrinkRed:2;HotDrinkWhite:2;HotDrinkSpiffo:2;HotDrinkTea:2;Cake:5;FruitSalad:5;Pancakes:5;Waffles:5;Muffin:5;PieSweet:5;Stir fry Griddle Pan:5;Stir fry:5;Soup:10;Beverage:2;Beverage2:2;Beer:2;Beer2;Taco:2;Burrito:2,
FoodType = Citrus,
Spice = true,
DaysFresh = 7,
DaysTotallyRotten = 9,
HungerChange = -10,
ThirstChange = -5,
Calories = 17,
Carbohydrates = 5.41,
Lipids = 0.17,
Proteins = 0.64,
CustomEatSound = EatingFruit,
StaticModel = RoundFood_Yellow,
WorldStaticModel = Lemon_Ground,
Tags = HerbalTea,
}
or do i use item tweaker?
to add my own item on the evolved recipe?
Guide updated and added 3 examples
- Example 1 - Sending data to Server
- Example 2 - Sending data to other clients
- Example 3 - Sync player instances
Nifty little tool to simulate network latency, dropped packets, bandwidth limits on windows
Hello, when I reload lua in debug mode F11, it's updating just fine, but the source code preview still shows old code. Have to quit and continue to see updates. Any chance to fix this?
there's a refresh button, I am not sure about the exact wording. it's right below the code
Ah really? Must've missed it. Thanks!
Also, might try closing the old source code preview windows in the debug UI. They seem to stay up forever until you close them
I tested dedicated server's behavior with isClient() and isServer(), and it seems to function identically as coop hosted MP, if anyone was curious.
In Singleplayer, pz is run as a single process. Both isClient() and isServer() are false. No surprises there.
In Co-op Hosted Multiplayer,
- pz runs two separate lua environments
-- Actually, it forks a separate process running java.exe to runzombie.network.GameServer(the same code the dedicated server runs), so in fact a separate process space. - In the client process,
isClient()istrueandisServer()isfalse. - In the server process,
isClient()isfalseandisServer()istrue. - The lua environment on the client loads
shared/thenclient/thenserver/. - The lua env on the server loads
shared/thenserver/(it skips lua files inclient/). - Each environment has its own
_Gas you might expect. - The list of events that are registered are equivalent on server-side and client-side. However, the
Eventstables (the one in the client process and the one in the server process) and its values are separate.
-- Interestingly,Events.OnTickis raised roughly every frame on the client, and it is raised 10 times per second on the server.
The Dedicated Server Multiplayer seems to function nearly identically to co-op hosted multiplayer, except of course the java process that runs zombie.network.GameServer is started manually, instead of forked from ProjectZomboid.exe.
shouldRunServerCode = function()
-- | isClient() | isServer() |
-- Singleplayer | false | false |
-- Multiplayer Client | true | false |
-- Co-op Host (client process) | true | false |
-- Co-op Host (server process) | false | true |
-- Dedicated Server | false | true |
--
-- This is a single player game or is a coop host server process or is a dedicated server
return not isClient()
end
shouldRunClientCode = function()
-- This is a single player game or is a coop host client process or is a client connected to a remote server
return not isServer()
end
wow thnx for this
how does EvolvedRecipe actually work
how do you change the item type...i have a shop mod that doesnt yet support literature items and i have another mod thats literature...wanna change its type so i can put it in the shop
I can't, but this definitely needs crosses, arrows and such, to mark visited homes and show directions
got u covered fam
that's a mod I'd use. And I don't use many for usual š
Is there a mod that allows to set player zombies as sprinters?
I want a landscaping mod to make my own beaches
I've had no issues connecting to local servers, I've actually run servertest in dedicated mode quite a lot. As for symlinks, look into link shell extension https://schinagl.priv.at/nt/hardlinkshellext/linkshellextension.html - what you want are called "junctions" on windows.
I'm running a couple junctions from <data>/workshop/ to <data>/mods with no issue.
yo, that's really cool!
Yes, I am doing this using junctions on windows, and it works quite nicely
Are there mods that make food not rot if it's cold weather?
Is it possible to require files from another mod? š¤
Yes it is
Which is the syntax for it?
In my mods I do require like this
require "Utils"
But this is usually limited to files in the current folde
I donāt really know, but ātsar true actionsā require its framework to work
Look it up
similarly the current version of ItemTweaker does the same. https://steamcommunity.com/sharedfiles/filedetails/?id=566115016
-----------------------------------------------------------------------Begin File
if getActivatedMods():contains("ItemTweakerAPI") then
require("ItemTweaker_Core");
else return end
TweakItem("Base.Needle","Icon", "Worm");
TweakItem("Base.Needle","Tooltip", "Wearable: Waist");
TweakItem("Base.Needle","DisplayCategory", "Repair");
-----------------------------------------------------------------------End File
What happens to a savefile (multiplayer) if a map is updated and people actively live/play around that area?
Interesting š¤
syntax is the same, regardless if the file is in your mod, another mod, or vanilla
require "path/file" with path excluding shared/client/server prefixes
So, if my file is pz-Transmogv2\Contents\mods\Transmogv2\media\lua\shared\GenerateTransmog.lua
And the file that needs to import it is pz-Transmogv2\Contents\mods\Transmogv2Default\media\lua\shared\TransmogV2DefaultGen.lua
Then inside TransmogV2DefaultGen.lua I can require the GenerateTransmog.lua by using require "GenerateTransmog" right?
yes
ya
Does lua not care about the difference between require "" and require("")?
they're both effectively the same
Alright, thank you both

i think any function that takes a single string argument can be used that way
So I notice dual wielding is just for show and there are no good mods to make it do anything worthwhile (such as let you attack faster). Is this a limitation of the mod engines (e.g., making character attack with left hand weapon is just not allowed on a fundamental level somehow), or have modders just not gotten around to doing it well? (Or does everyone who mods PZ hate dual wielding as a premise?)
aren't there a couple dual wield mods already?
I think this only works when the argument is literal (ie: not another variable)
yeah i've never seen it used that way (and using it that way would look a bit confusing anyway)
Lua 5.1.5 Copyright (C) 1994-2012 Lua.org, PUC-Rio
> function x(a) print(a) end
> x "t"
t
this one accepts fine
> y = "t"
> x y
stdin:1: '=' expected near 'y'
this one does not
valid:
for _,y in ipairs {"a","b"} do end
invalid:
> z = {"a", "b"}
> for _,y in ipairs z do end
stdin:1: 'do' expected near 'z'
weird design choice if you ask me, like you said just makes it needlessly confusing
i like using it on my requires because i think it looks pretty, but i only do that because requires are usually pretty isolated from the rest of the code, so inconsistent syntax doesn't really matter
otherwise doing things inconsistently like that really doesn't offer you anything to gain
its fairly common on require, often you see the () version on requires that return a table/module, so i tend to stick to that format. bracketless for no return requires
but other then require ya i wouldnt use that feature anywhere else
anyone know why this is happening when I try to host a test server on 41.77?
[05-10-22 10:20:35.191] ERROR: General , 1664979635191> 833,831,166> java.net.ConnectException: Connection Startup Failed. Code: 5.
[05-10-22 10:20:35.191] ERROR: General , 1664979635191> 833,831,166> at zombie.core.raknet.UdpEngine.<init>(UdpEngine.java:80).
[05-10-22 10:20:35.191] ERROR: General , 1664979635191> 833,831,166> at zombie.network.GameServer.startServer(GameServer.java:1449).
[05-10-22 10:20:35.191] ERROR: General , 1664979635191> 833,831,166> at zombie.network.GameServer.main(GameServer.java:740).
This is from the main menu's host option, for the record
The two I see are not working well to various degrees. One doesn't really change anything and just lets you alternate swings afaik... one adds dual-wield combos, but unfortunately the off-hand just sort of shoves the enemy (it's not really animating as an attack as in the off-hand mod)... I'm sort of looking for a blend, where both weapons swing and overall attack rate can be slightly higher (since I assume damage per hit is higher when two-handing, as that would make sense and is pretty standard).
Does anyone have a profession mod template by chance? Does such a thing exist? Or could I perhaps use someone else's code as a template and credit you if/when I publish it?
Not template, but you can download any profession mod from the Workshop and check out the source code.
Oh, okay, thanks. Will attempt that and combine that info with the link to the GitHub for Profession Framework
tried searching for this but can't find it -- is there a simple way to change zombie spawns so that a higher ratio spawn indoors?
is it possible to debug server-side lua code?
This mod implies there is a way... Simple, idk: https://steamcommunity.com/sharedfiles/filedetails/?id=2182855819
found that one, but chatter sounds like it's been broken
to my knowledge, the indoor spawn code is completely different from the normal code
Hey is there a mod that makes it possible to teleport between worlds?
like from kentucky to cherbourg?
without losing player progress?
is this the channel to ask to learn how to make mods
anyway to check how hot the water is when pouring into a cup
thers generally a bar or color on the item if you looking for temperature than no i dont think so
just following up on this. Anyone else having similar problems? This happens with no no mods enabled even, so I can probably make a #1019767076094758924 about it, but here seems to be most familiar with 41.77 right now.
Let's say I did ```lua
local moodles = player:getMoodles()
How to get the player back?
```lua
local player = ?????? (moodles) ?????
You can't, I guess... at least not that way, but you already have the player
If the moodle object doesn't have a reference back you'd be out of luck
Not many cases where that would be needed tbh
Once again asking for help with the Graffiti mod š
I put it on github
if anyone's interested in helping out
What's the issue? ||https://dontasktoask.com/||
Well I basically had someone else working the code side of this and I designed all the tile sheets being utilized in it and came up with the initial concept;
currently it works this way: You press Y to paint after using the lua console to set the text or symbol, as well as determining what style is chosen.
The problems that prevent it from being done are this:
- Need to have a spray can in your inventory in order paint
- Need to fix the Tag Wall UI so that you can choose the style, symbol or text to be sprayed
- Need to tie the color to be relevant to the spray can used
- Durability of the can should drain upon use
- Anim for spray painting? This is just polish at this point.
That's about it I think
wow. I'm going to be keeping that link for now. I see this happening so many times, and get annoyed at having to just keep repeat asking them to actually ask what the issue is everytime
personally I find it a little passive aggressive
well, its easier than having to type it out every time
that's like telling someone to "just google it" -- or linking them to google. But I digress, I forgot to say what the problem I was having is so whatever
because multiple times, I have just said a simple, "what is the problem" and them still not wanting to put the effort in. and wanting for someone to commit to helping before elaborating
Yeah, that's just people unfortunately but now we're burying my call for help with meta talk >.<
That's a lot of work, but nothing complicated, maybe at night I can solve some points
There's already a UI built, it's just not totally finished yet I think
Like currently it doesn't populate the style list with options, and hitting tag does nothing
And I guess before we were doing it so that you can select what color the thing is from this menu, but I think having predefined colors would be more realistic and graceful
Oh nice. Thanks. I had sysinternals tools sitting around and it happened to have a program for creating junctions that did exactly this. Thanks
Makes me wonder why cygwin's ln doesn't create junctions when symlinking š¤
The CDDA zombies mod does this (along with a bunch of other things)
Oh, wait, nm
The one on steam doesn't do that
My understanding it's for primarily there for creating languages on top of lua e.g. to structure data in a way that is readable and also can be processed as lua (rather than for writing general procedural code). It does look confusing imo when using that optional () syntax in general lua code
No mods. Unhappiness Level falls down -1 per sec. Why?
I guess some mod changed some multiplier before I turned them all off.
Not sure if this is the right channel but I'm looking for a mod that let's you enhance vehicles in game? Like roll cages or stuff like that is there anything?
Does anyone know if there is a way to mark a VHS tape as listened to, without actually watching it?
The only thing i was able to find so far is the static class MediaData.MediaLineData.getTextGuid() which wont let me select a certain tape.
There also only seems to be one way to learn a tape and that is by the lines that are broadcasted on tv, using player:addKnownMediaLine(mediaLine)
But i can't seem to find a way to fetch these lines anywhere, could anyone point me in the right direction?
the skill recovery mod does save into the moddata for the journal, which media lines the player has listened to. So you can probably take a look at that mod at detail to figure it out
here is one of the functions which I think is likely relevant
---@param player IsoPlayer|IsoGameCharacter
function SRJ.getListenedToMedia(player)
local knownMediaLines = {}
local ZR = getZomboidRadio():getRecordedMedia()
local categories = ZR:getCategories()
for i=1,categories:size() do
local category = categories:get(i-1)
local mediaType = RecordedMedia.getMediaTypeForCategory(category)
local list = ZR:getAllMediaForType(mediaType)
for j=1,list:size() do
---@type MediaData
local mediaData = list:get(j-1)
print("Watched - mediaData: ".." ("..mediaData:getId()..") "..mediaData:getLineCount())
for jj=1, mediaData:getLineCount() do
---@type MediaData.MediaLineData
local mediaLineData = mediaData:getLine(jj-1)
if mediaLineData then
print(" ---getTextGuid: "..mediaLineData:getTextGuid())
local lineGuid = mediaLineData:getTextGuid()
if lineGuid and player:isKnownMediaLine(lineGuid) then
print("Watched - "..tostring(lineGuid))
table.insert(knownMediaLines, lineGuid)
end
end
end
end
end
return knownMediaLines
end
On steam workshop search autotsar, or tuning or bear bus, there is a modder that does a lot of vehicles mod
yeah i looked there, the function is uncommented and the entire media part does not work atm. if it ever did work, i guess some patch made it bug out
oh mb
thanks for trying to help š
managed to make my tv spit out the lines i need, but this requires actually watching the tape
search Recorded_Media_EN.txt for the lines you need
thanks
How do i add flags to Project 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...
Fr
Once you have your flag created in blender, that guide has instructions on how to package it into into a pz mod
I know nothing abt modding i just want my flag in gameš„
I once made an orange in blender o7
Thought of a mod idea today but I don't mod. Functioning radio stations/towers. Other survivors on the map can tune into it and maybe it can be a way of recruiting survivors to your encampment when NPCs are implemented into the game
isn't that a vanilla feature
Is there a way to require X number of units of tainted water in a recipe directly?
How to tune existing recipes (not by overriding)?
See examples in the game code: ```js
recipe Clean Bandage
{
BandageDirty,
Water,
Result:Bandage,
Time:40.0,
Category:Health,
OnTest:Recipe.OnTest.NotTaintedWater,
}```
-- check that the water isn't tainted when used in a recipe
function Recipe.OnTest.NotTaintedWater(item)
if item:isWaterSource() then
if item:isTaintedWater() then return false; end
end
return true;
end
You just need to make your own function and mention it in your recipe
That is exactly what I was looking for, but wasn't sure what to even begin searching with haha... Thanks @undone elbow ā¤ļø
you can already pretty much do that with the radios and walkie talkies. What I would like to see, but currently don't know if it's possible, is if you could run a tv station
a small map mod that puts a tv station somewhere , probably luisville
give it power and VHS tapes, and whatever is on the tapes gets broadcast
could be a neat way for server admins to help new players well after the power goes out
i could give it a try
i've been messing around with those sorts of things recently, not completely sure if it's possible but if it is i could probably find out how
I know you can turn the power back on, but can you trick the tv's into running again? Might have to create your own channel, again if that's possible. It sounds like a fun project
anyone know what offroad efficiency actually does? I've set it to 0 and to 100 and had no appreciable difference in how the vehicle runs offroad, is it just a durability thing?
ah ya, there is a chance of vehicle parts taking random damage over time. The vehicle itself has an offroad efficiency, and each individual part also has a modifier for offroad damage. Now I know
i'm never touching grass ever again
Looks like how well you drive offroad is the same for every vehicle
best I can tell, your engine force is divided by your current Gear*1.5 while offroad... which means the higher gear you're in the weaker your engine becomes, which I guess makes sense
Also explains why my Semi hauling a Trailer filled with the organized trait could only move in 1st gear offroad
Can public members of java classes be accessed, or only methods?
how do you access a field?
Don't think visibility even matters when using java reflection (haven't messed with that in years, so no sure
The global object has 3 functions related to fields, if I remember right. One to enumerate the fields of an object, one to get the field, and a third to get the value of that field from the object
but none to write to it?
Don't think so.. However, java.lang.reflection.Field probably has a method to set a value, and that should be exposed lua-side
ya, I have no idea how that would work trying to do it from lua, it would be hard enough in java
Once you have a field object, try printing it out. Then try printing out its metatable too using this ```lua
printR = function(t, depth)
if not depth then
depth = 1
end
local printR_cache={}
local function subPrintR(t, indent, depth)
if depth == 0 then
print (indent, 'max depth reached')
return
end
if (printR_cache[t]) then
print(indent.."*"..tostring(t))
else
printR_cache[t] = true
if (type(t)=="table") then
for pos,val in pairs(t) do
if (type(val)=="table") then
print(indent.."["..tostring(pos).."] => "..tostring(t).." {")
subPrintR(val,indent..string.rep(" ",string.len(tostring(pos))+8), depth - 1)
print(indent..string.rep(" ",string.len(tostring(pos))+6).."}")
elseif (type(val)=="string") then
print(indent.."["..tostring(pos)..'] => "'..val..'"')
elseif (type(val)=="userdata") then
print(indent.."["..tostring(pos).."] => ".."("..type(val)..") "..tostring(val))
else
print(indent.."["..tostring(pos).."] => "..tostring(val))
end
end
elseif (type(t)=="string") then
print(indent..'"'..t..'"')
elseif (type(t)=="userdata") then
print(indent.."("..type(t)..") "..tostring(t))
else
print(indent..tostring(t))
end
end
end
if (type(t)=="table") then
print(tostring(t).." {")
subPrintR(t," ", depth)
print("}")
else
subPrintR(t," ", depth)
end
print()
end```
hmm, let check java's docs to see what you'd look for
If it has set() exposed, that's what you want
That just recursively prints out the object you pass it as a parameter
lol, so to call a method you do vehicle:method(), a field, well...
Here's how you invoke hashCode() on a java.lang.String object (but it only works in debug mode
Do you have a particular field you are trying to set? I can try real quick
if I can find a way to get ahold of an instance of the java class in the lua console
BaseVehicle.forcedFriction
Offhand, know a way I can get a BaseVehicle object via the console?
getVehicleById(int id) is typically the way I roll, but you'd need the id of a vehicle that's currently loaded. I think there are other global functions like that though, I'd have to look
Do you know how I can work out an id of one that's loaded real quick to try that?
something like this is what I'm currently doing:
local newMechanicsAction = ISOpenMechanicsUIAction["new"]
function ISOpenMechanicsUIAction:new(character, vehicle, usedHood)
print(vehicle:getId())
return newMechanicsAction(self, character, vehicle, usedHood)
end
then it just prints out the id when I open the hood
I haven't fiddled with vehicles yet, so figured be quicker to ask than to figure out myself :)
no worries
x=getVehicleById(252) ; print(getClassFieldVal(x,getClassField(x,233)))```
that prints it out
for i=0,getNumClassFields(x)-1 do print(i, getClassField(x,i)) end```
that enumerates the fields
LOG : General , 1665031851843> 233 public float zombie.vehicles.BaseVehicle.forcedFriction```
Setting works too.. but I just realized, it too, like Methods, is only exposed when running in debug mode :/
getClassField(x,233):setFloat(x,5)```
Set it to 5 there
I mean, you can call methods all day out of debug mode
as long as they're exposed, of course, but most are
but yes, I managed to read from the field this time, its -1, which is expected
This java code is what exposes java to lua. It exposes Method, Field, and Coroutine only in debug mode. So you can use the global getClassFieldVal to get the value because that's a method in zombie.Lua.LuaManager.GlobalObject. However, you can't directly invoke setFloat on Field, because that's in the java.lang.reflect.Field class, which is only exposed in debug mode
so I guess long story short is Fields are read only
yea, except in debug mode
not the end of the world, I can still mess with wheel friction by messing with the wheels themselves, it just would have been real handy to use the vehicle level override that was that field
thanks for looking into it
Can also muck around with the effects of those fields by changing them in debug mod without having to reload a mod
getClassField(x,132):setFloat(x,1)```
Set mass to 1

hahaha ya, messing with mass is hilarious, near zero you just go sideways if you try to accel
its also not a bad way to give the vehicle the impression of being more powerful, because it can accel a lot easier
tends to flip real easy though
weird, could have sworn the mechanics UI showed tired friction, now its gone. I guess we'll give this another stab tomorrow
Huh.. I increased the maxSpeed to light speed and it uses up fuel absurdly quick, before I even get up to a reasonable speed :p
that's interesting. Hadn't look into fuel efficiency yet
whelp, I'm not convinced wheel friction does anything, at least not on roads. Normal limits are 0.2 to 2.3, and with shenanigans I've even tried it at 0 at 10, no noticeable difference in acceleration, turning radius, stopping time or distance or anything else that I can think of. Either it only matters off-road, or only makes your tires squeal marginally louder/quieter or something else hard to notice
guess I'll try to dig deeper in the code tomorrow. Problem is these values are fed to the Bullet physics engine, which I don't appear to have the source code for
1 and 5 completed, probably tomorrow continue, I did a PR to your repository in case something happens
How to get item property like "WorldRender" etc? Seems there is no function for it.
š
man i can barely read that shit š this is why i need storm api to become mainstream for zomboid
i can barely understand c#
I was wondering, did anyone develop a parser for the .txt files zomboid uses for items and vehicles?
Like this kind of file media\scripts\clothing\clothing_bags.txt
someone should make a mod where "The Gonk" plays after you die
is it possible to call a server function without args. if the function doesnt need any variables ?
We need a mod called "Fucked Starts" where you just spawn in a locked jail cell and shit so you can experience what it is liked to be fucked.
Just credit me with the idea in the bio when you make it.
You jest but I'd actually like that just for dynamic stories with your friends where you have to save someone
That wasn't jest, I want to RP.
Dear god
is there documentation on the ContextMenu's addOption function? I was trying to find it in the code but can't find its definition anywhere
Does anyone know how SoundRadius and SoundVolume affect zombies when you use a firearm?
to my knowledge SoundRadius is directly the number of tiles the sound will reach, and volume likely has something to do with their hearing abilities
the hearing ability sandbox setting just multiplies the radius that a sound can be heard from by 3 for pinpoint and 0.75 for the hard of hearing setting, im not at home right now but its in world sound manager just search for sandbox. I wanted zombies to hear generators and found the hard coded 20 setting point there and then found the hearing setting. the problem is it scales all sounds.
if you mean with sendclientcommand, you can just give an empty table. you can only give either 3 or 4 arguments. this is from the decompile.
public static void sendClientCommand(String var0, String var1, KahluaTable var2)
public static void sendClientCommand(IsoPlayer var0, String var1, String var2, KahluaTable var3)
addoption is a lua function. you can find it inside ISContextMenu.lua
could have sworn I looked in there, thanks
in other news, the live-update function of my remake of itemtweaker is starting to come together, bar stupid issues I wasn't able to test until recently
TVK_ITE: WARN: Updating live info for Base.AssaultRifle.
TVK_ITE: ERROR: Update function for [MinRange] is not currently supported.
TVK_ITE: ERROR: Update function for [MaxRange] is not currently supported.
Aloha, friends.
Is there a simple mod that lets me access any container in inventory at any time without equipping it?
It's pretty stupid that I have to equip things to open and inspect them.
drop them
That's a clever solution but a bit annoying lol
Lol
Needing to unequip other things makes sense to a degree, but honestly not even that. I could easily lean my bat on my shoulder while I open a backpack and thus have it .25 seconds from being useful while also looking inside of a bag in real life.
As far as i know on a serious point, there isnt
š
No worries
I'm looking at the sac mod in ExtraSauce QoL
Not sure how it works or how it makes container life easier
Might be my only hope
Odds are it wouldnt be hard to make happen, albeit a bit time consuing
Since the only thing that stops you from looking through them normally is they need to be equipped. One approach that could be taken is allowing players to equip more then one, another is make proxy equipped containers that weigh nothing but are populated with the items of the corresponding one
3rd idea would be a floating dummy object at the players feet if all else fails, but that would be the last route i would take
Fair enough. I am gonna try EasySauce's Sac and get back to you. (That's not nice, EasySauce.)
what if i need it to be server to server
not quite sure what you mean by sending a command from server to server, as there is only 1 server. what would it be communicating with ?
ammm cuz i need it to read files from serverside but whn i do it as client it reads it from client side
idk how to make it read a file on the server... i was only able to write the file using client to server ...
can you explain what you're trying to do?
just move the reading code into the server folder
Need a bit of explanation on client/server interactions.
I have a mod that adds a new healing action. It currently doesn't work when one player applies it to another player because I didn't write code to handle that properly. So I need to make a sendClientCommand that has the client send an alert that this healing action has occurred and let the server apply the effects of the action to its own copy of the healed player, right?
Is that it? Everyone (including the person being healed) will see the effects of the item? Or does the server also need a function to send out a notice to all clients (or at least to the person getting healed)?
ow ok ill do that
no, unfortunately, health only exists on the client, so you'd have to have the server then send it to the player being healed
Alright. Thanks.
Code in the server folder also runs on the client, also the folder the code is in doesn't determine where it runs, the only real effect it has it that /client/ code isn't accessible by the server
If you want the folder to read a file, but the trigger to make that happen is client side, like through a GUI, you would have to send a client command to tell the server to read the file, and likely a server command to send the data back to the client if it's needed there
this is only true in SP. code in the server folder does not run on clients in MP
check this https://steamcommunity.com/sharedfiles/filedetails/?id=2735092774 especially the code of example 3 that probably will solve your issue
it does
@ruby urchin Thanks. That makes things very clear.
When you know your update didn't break anything.

very nice
in other news, the fact that Indie Stone is inconsistent about their is* function capitalization is driving me up a wall. You've got IsWeapon and isTrap, etc, all on the same item.
not to mention the mix of public and private attributes on the Item class that seem to be a buildup over time of different code styles
nop
I think, never I did use it like that, but from what I remember, if it's a Base module, you just need add the name model, if it's other module, should be something like Dislaik.MyModel_Ground
thanks
GUYS please HELP HOW to remove scratch from trees ? i am tring to modify outdoorsman trait in main creations lua but i dont know what to do anyone can help me ??
i remeber a mod called "Extra Trait Effects" and they made thick skinned avoid this kind of damage
look it up
now i need your help because i can't look it up, anyone knows where to look for icons from main game?
Hey, want to maybe make a mod for a server was wondering is there any way to make it so a specific safehouse is tresspassable and lootable for a set amount of time?
The end goal would be to make players have to schedule their raids against a specific safehouse rather than doing it at any time without warning
any idea why my pills can't be ingested?
Well, after beating my head against the wall for a few hours, I give up and I think I've decided that you just... can't read the public fields on a zombie.scripting.objects.Item
can we get an adjacent square but a bit further?
no fields, only methods, final destination
hush 
the truth is you can read fields, just can't write to them unless you're in debug mode
you can see it up here
#mod_development message
If I recall IsoSquare should have like a North() South() for each direction
oh no
You can also call getSquare() using another squares xyz
Medicine ingestion is Java isn't it?
indeed
There's like 3 hard coded variables
If you wanted to make more types of medicine you'd have to create your own health system from scratch
There's a medicine overhaul nod
or b) make it a food thing
antibiotics are food iirc
huh. Reading is all I need, so I'll look into that. I must be doing something wrong.
reading requires you to use the java reflection methods exposed to the lua, its not nearly as straightforward as using methods, but it does work
oh you need to do weird shit with getclassvariable huh. Easier to just use the stored variables I have. I was trying to read from a prototype to set an instantiated item, which would be better done using the prototype since it can do type-correctness checking. But I'm not gonna try to do weird things that hardcode to specific variables like that
when I already have the data, better to maybe break by having bad data than to definitely break when the class structure changes
thats fair, I would avoid using it if possible as well
good to know, though
to my memory, the pills and just like sleeping tablets and antibiotics. They are all hard coded to have the "take pill" action in the java, so it is not trivial to mimic medicine. and if you just want to utilize food, I faintly remember it needing a minimum of 1 hunger, for the eat option to be there.
probably the best way to simulate medicine is to make it a drainable, then just add a custom context menu for it
yes, i just don't know how drainables work
so i do second thing, i make pills unpackable
Still want this no cap
You should make a map that is just a forest, I love to suffer
yeah i just learn this .. if only i knew this sooner tho
but u can add multiple arg with the table
fun fact,
item Antibiotics
{
DisplayCategory = FirstAid,
Weight = 0.1,
Type = Food,
DisplayName = Antibiotics,
Icon = Antibiotics,
ReduceInfectionPower = 50,
CustomContextMenu = Take,
CantBeFrozen = TRUE,
Tooltip = Tooltip_Antibiotics,
Medical = TRUE,
WorldStaticModel = Antibiotics,
}```
it doesn't need to nutricous to be ingested
it just need type food to be edible
how do i get like 4 tiles away from player as offset
Top 10 silliest moments in pz
When you have the IsoPlayer you can use getX, getY, getZ inside of getSquare
@ancient grail
You can do x + 4 for example
I would make a scrap laser gun mod but it would take me the rest of my human lifespan
If you need ALL tiles within 4 tiles there's a bit more to it
i took me 2 weeks to get gun to work
so somewhat near that
I done rimwrodl modding and I can make a mod in 10 mins that will get like 1000 downolds
modding rimworld is another story ain't it?
Yeah I stopped cuz c# is cursed
I do know lua tho
But idk how to even start making a mod so
i know neighter of them, i made a progress because peeps help me out there
i mean there is one tutorial
it just bit outdated
ok kk thnx
I use python as my main for data scaince but c loungufes are just horrible
And it also needs models
I do have a friend who is a modeller
But I wouldn't want to waste his time if I don't even know how to make a mod
Just a gun or two that allow you to shot a laser gun
That can be crafted and uses battery's as ammo
And some sort of way to recharge batteries
I mean I could try but idk if it is worth the effort
If you would have fun after doing it why not?
Disappointed might be imessurble and day has a chance to be ruined
10/10
My dream tho is to make either a basic chemsitry system or RC vehicles
Idk what wpuld be the effec of mustard gas on zs
But RC vehicles would defo be cool
Like strap a pipe bomb to a RC car and drive it into a horde
yeah thats definitely something im going to try to take a crack at, once they release the fluids update
Hopefully there's an event for mixing included out the gate
Would love to see some SS13 level chemistry achieved in PZ
maybye all that tutorials how to made homemade illegal stuff from bait videos will be put into use when they would implement chemistry
on antoher note
can someone help me
{
imports {
Base
}
recipe Open box of active charcoal
{
destroy ACT,
Time:10,
Result:ACTP=10,
OnCreate:Recipe.OnCreate.OpenACT,
Sound:PutItemInBag,
Category:Health,
}
}```
the zomboid simply doesn't read that
whats funnier
i use same formula in other mod of mine- it works
any idea why it just doesn't work?
Is destroy actually a thing?
Afaik item types alone are for ingredients, and : for a value/delta
"keep itemType", would not use the thing
You also wouldn't need an oncreate unless you want extra stuff to happen
this allows you to right click it and open it
like egg carton
OnCreate is for adding extra functionality - the recipe itself adds a context menu
okay then i will check
I also don't recall seeing "destroy" used as a syntax before
i used propably one of this
recipe Empty Frying Pan
{
destroy PanFriedVegetables,
Result:Pan,
OnGiveXP:Recipe.OnGiveXP.None,
Time:40.0,
Category:Cooking,
Sound:EmptyPan,
}
its from main game
Weird
I'd have to look that up, maybe it's redundancy / new for clarity's sake
The other issue might be the fact you're not using the module for ACT
Might have to be DAC.ACT even if you import base
i tried doing it but game doesn't care
{
imports {
Base
}
recipe Open box of active charcoal
{
DAC.ACT,
Time:10,
Result:DAC.ACTP=15,
Sound:PutItemInBag,
Category:Health,
}
}```
i think i found a issue
module NeuroTraits {
imports {
Base
}
/**
If the name of an item starts with 'Pills' then in the ISInventoryPaneContextMenu
You can hook into ISInventoryPaneContextMenu.onPillsItems
As an alternative, if are not using Drainable items,
you can copy how the cigarette works via overriding the oneat function (OnEat_Cigarettes)
**/
item PillsAdderal
{
DisplayCategory = FirstAid,
Weight = 0.2,
Type = Drainable,
UseDelta = 0.05,
UseWhileEquipped = FALSE,
DisplayName = Adderal,
Icon = PillsBetablocker,
Tooltip = Tooltip_PillsAdderal,
StaticModel = PillBottle,
WorldStaticModel = PillBottleGround,
Medical = TRUE,
}
}
require "TimedActions/ISBaseTimedAction"
local old_ISTakePillAction_perform = ISTakePillAction.perform
function ISTakePillAction:perform()
local result = old_ISTakePillAction_perform(self)
if self.item:getModule() == 'NeuroTraits' then
self:useNeuroTraitPills()
self.item:Use();
end
return result
end
function ISTakePillAction:useNeuroTraitPills()
local type = self.item:getType()
if type == "PillsAdderal" then
ADHDCore.applyMedication()
end
end
This is how I implemented pills in my mod, using as little code as possible
can i use it?
Sure, have fun
thanks m8
Just taking a guess, but maybe that recipe needs Destroy to not activate the PanFriedVegetables' ReplaceOnUse? Like just "PanFriedVegetables," would end up giving back two frying pans?
Do i apply my own
ADHDCore.applyMedication()```
i need to make function that removes nuesea
don't i?
@gilded hawk ?
Yeah, inside this function
function ISTakePillAction:useNeuroTraitPills()
local type = self.item:getType()
if type == "YourItemNameHere" then
YOUR CODE HERE
end
end
allright then i have to find how to change food poisoning level
i will continue tommorow
my head is crushing me rn
hey how do ya decrement an item's uses programmatically
does it use condition for that?
or is it that "jobDelta" thing
oh it's probably "Uses"
derp, didn't see that

EasySauce's Sac did the trick. It's lovely.
No regrets about trying Sac
on the oncreate functions for recipe it says
(item result player)
ammm which o e is the props? or source?
or maybe im looking at the wrong thing
ithink i should look at on test
i only wanted to make a recipe that uses hot water only and dont need to cook cuz after the recipe makes the character do animation then its cooked
How would I change the model of a pop can?
I've made my own model, put it in models_x and made the texture in textures
In my code file i've set it to be
StaticModel = MYMODEL,
WorldStaticModel = MYMODEL,
However it still does't work. It takes the vanilla pop can and fucks the texture up on it
u need model {mesh=, texture=,}
yea I tried that to like
model CocaCola
{
mesh= .x file
texture = .png file
}
still nothing
And then ofc staticmodel = CocaCola etc
item CocaCola
{
StaticModel = CocaColaModel,
WorldStaticModel = CocaColaModel,
}
model CocaColaModel
{
mesh = CocaColaCan,
texture = CocaColaCanTexture,
}
ahh perhaps its supppppppppeeeeeerrrrrrr tiny
I used a regular pop can as scale as my model
try adding scale=,
Yea scale = 1 did nothing either ;_;
might still worth a shot sir
if u dont put the scale the 1 is the scale
also try puting it on
WorldItems folders both the texture and the mesh but on their respective parent folder
``models_X/WorldItems/CocaColaCan
textures/World Items/CocaColaCanTexture``
Awesome good to know
@mystic meteor Are you still in need of a general purpose hash function in lua? I might have something if you still do
I want to make a mod that lets you build a wall using vehicle tires, so far I got a new "moveable" but I'm stuck - where's a good resource to learn how to make a new moveable?
someone should make dismemberment modddd
I could still use something yeah
More vehicle testing today, and the results are:
Wheel friction just really doesn't matter at all. Set it from -100, to 0, to 100 and had absolutely no noticeable difference in how the vehicle runs. Normal limits on it are 0.2-2.3, btw
Engine loudness is affected by RPMs, but there is a lot of RNG as to how loud it is at any particular moment and the differences between the standard levels you'll normally see is pretty small. For example, a sportscar with a perfect engine and performance muffler has a noise radius of a few car lengths, while a beat up truck with no muffler at all going full speed has a noise range of maybe triple that, going out to about a block in length
A little bit disheartening for me, as I'm making my own mechanics overhaul mod but I am finding the list of things we have access to is fairly small and many of them don't seem to have much effect
Interesting. I'd have expected the noise radius to be a bit greater in those 2 scenarios, but it just seems on par with what I'd expect from a normal car in good condition. Did you notice whether the car noise radius much greater while the car is in reverse?
Regarding the wheel friction, maybe that friction refers to the static friction of the tires against the road (not the rolling friction)
i.e. how far it'll slide when spinning out or when brakes lock up (idk if pz cars have anti-lock brakes š )
I went 150 mph into a full e-brake slide and it still didn't seem to matter, lol
Oh well :p
Might just be some properties that were added in but never used or perhaps changed but the properties were left in
I'd love to look into the physics engine and know for sure, but I don't have the source or any documentation on it
lets see how loud speed-demon reverse actually is...
TahvohckUtils = TahvohckUtils or {}
TahvohckUtils.rshift = function(a, disp)
if disp < 0 then return TahvohckUtils.lshift(a, -disp) end
return math.floor(math.fmod(a, 2^32) / 2^disp)
end
TahvohckUtils.lshift = function(a, disp)
if disp < 0 then return TahvohckUtils.rshift(a, -disp) end
return math.fmod(a * 2^disp, 2^32)
end
TahvohckUtils.isArray = function(t)
local i = 0
for _ in pairs(t) do
i = i + 1
if t[i] == nil then return false end
end
return i
end
TahvohckUtils.create_multitype_comparator = function(to_comparable)
to_comparable = to_comparable or tostring
return function(left, right)
local left_type = type(left)
local right_type = type(right)
if left_type ~= right_type then
return left_type < right_type
elseif left_type == "number" or left_type == "string" then
return left < right
elseif left_type == "boolean" or left_type == "nil" then
return not left and right
else -- "table" or "function" or "userdata" or "thread"
return to_comparable(left) < to_comparable(right)
end
end
end
TahvohckUtils.sorted_pairs = function(t, compare)
local sorted_keys = {}
local initial_control_variable = nil
--for k in next, t do -- wtf. kahlua 2 has removed next
for k in pairs(t) do
table.insert(sorted_keys, k)
end
table.sort(sorted_keys, compare)
return function(state, control_variable)
local next_key = table.remove(state)
if next_key ~= nil then
return next_key, t[next_key]
end
end, sorted_keys, initial_control_variable --, closing_value
end
TahvohckUtils.knuth = function(x, lengthInBits)
--[[
-- knuth multiplicative hash
-- Numerous issues because this hash functions on integers that overflow, while lua uses doubles for numbers.
-- Numbers beyond 9007199254740991 lose precision, eventually causing hash to always be 0
if type(str) ~= "number" and math.floor(x) ~= x then
error(string.format("TahvohckUtils.djb2: Can't hash non-integer types (%s)", tostring(str)))
end
]]
local hash = 2654435769 * x
if lengthInBits then
hash = TahvohckUtils.rshift(hash, 32 - lengthInBits)
end
return hash
end
TahvohckUtils.djb2 = function(str)
--[[
-- djb2 hash
if type(str) ~= "string" then
error(string.format("TahvohckUtils.djb2: Can't hash %s types (%s)", type(str), tostring(str)))
end
]]
local hash = 5381
for i = 1, #str do
local c = str:byte(i)
hash = TahvohckUtils.lshift(hash, 5) + hash + c -- = hash * 33 + c
end
return hash
end
And here's the actual hash function to call:
TahvohckUtils.hash = function(x, lengthInBits, strict, state)
--assert(lengthInBits > 0 and lengthInBits <= 32)
lengthInBits = lengthInBits or 32
strict = strict == nil and true or strict
local t = type(x)
local hash = 99531109
if t == "number" then
if math.floor(x) == x and x < 3393263 and x > -3393263 then
-- Hash integers in the range that won't cause issues due to no integer overlow and precision loss due to
-- doubles, which all lua numbers are. On 64bit, precision loss happens beyond +-9007199254740991
-- Alternatively, could hash all numbers as strings, but the string hash is O(log x) while this is O(1)
hash = TahvohckUtils.knuth(x)
else
-- Hash doubles and large integers as strings
hash = TahvohckUtils.djb2(t..tostring(x))
end
elseif t == "string" or t == "boolean" or t == "nil" then
if t ~= "string" then x = t..tostring(x) end
hash = TahvohckUtils.djb2(x)
elseif t == "table" then
state = state or {}
state.hashcache = state.hashcache or {}
state.hashcachecount = state.hashcachecount or 1
local cachedhash = state.hashcache[x]
if cachedhash then
return cachedhash
else
-- Because tables may be recursive, we cannot cache the hash of the table. Also since a table's hash
-- is not unique to an instance (e.g. all empty tables have the same hash), we do not cache the hash
-- of the table. Instead, a hash of a counter is cached. This enables the final hash to capture whether
-- the same instance of a table was inside the containing table multiple times. For example, it can
-- distinguish between {a,b,b} and {a,a,b} where a={} and b={}
state.hashcache[x] = TahvohckUtils.hash(state.hashcachecount, lengthInBits, strict, state)
state.hashcachecount = state.hashcachecount + 1
local array_length = TahvohckUtils.isArray(x)
if array_length then
for i=1,array_length do
hash = TahvohckUtils.lshift(hash, 5) + hash + TahvohckUtils.hash(i, lengthInBits, strict, state)
hash = TahvohckUtils.lshift(hash, 5) + hash + TahvohckUtils.hash(x[i], lengthInBits, strict, state)
end
else
local to_comparable = function(a)
if strict then
error(string.format("TahvohckUtils: Cannot reliably compare %s type (%s)", type(a), tostring(a)))
end
return type(a)
end
for i, j in TahvohckUtils.sorted_pairs(x, TahvohckUtils.create_multitype_comparator(to_comparable)) do
hash = TahvohckUtils.lshift(hash, 5) + hash + TahvohckUtils.hash(i, lengthInBits, strict, state)
hash = TahvohckUtils.lshift(hash, 5) + hash + TahvohckUtils.hash(j, lengthInBits, strict, state)
end
end
end
else --elseif t == "function" or t == "userdata" or t == "thread" then
if strict then
error(string.format("TahvohckUtils: Cannot reliably hash %s types (%s)", t, tostring(x)))
end
-- Hand wavy hash based only on the type
hash = TahvohckUtils.djb2(t)
end
-- In Kahlua, the % operator breaks on on sufficiently big numbers, so using math.fmod.
-- Verify with 2^37%100 and 2^38%100
return math.fmod(hash, 2^lengthInBits)
end
print( TahvohckUtils.hash("woohoo") )
print( TahvohckUtils.hash( { "my", "array" } ) )
Kinda slow, but seems to work well, in so far as hashing can be done in lua :p
If you set the strict parameter to false, it will do its best to hash functions, threads, and userdata (things like IsoZombie objects from java). But on those objects, lua (or kahlua in the case of functions) don't have a good way to hash/fingerprint those types. Also if it encounters a table with another table as a key, it will error because it can't sort those keys (same for functions, userdata, or threads as keys), but you can set strict to false and it will work with some caveats.
Basically, set strict to false if you are okay with collisions due to poor hashing of function objects, userdata, and thread objects and okay with hashes not being repeatable when a table contains those types or tables as keys.
Anyone know of a mod that disables military clothing and zombies that spawn with it? In the future I'd like people to drip differently, not the classic military gear because it's the safest
Where can I find learning resources for doing the following:
ā½ļøNew Moveable (E.G. a Tire Wall)
ā½ļøRecipe type system on an item that's on the ground (E.G. scrap a car door, without picking it up?)
You could iterate over ZombiesZoneDefinition and remove the military outfits so zombies don't spawn in the outfits
I'm guessing for an on-ground system, I'd use some custom context menu option on X(Valid craft item), and an Action that checks that there is a nearby X
And could remove the individual military clothing items from the other loot distribution/definition tables @glacial flicker
So I should make a mod for it, there's no established one yet š© time to put my nose to the grindstone then haha thank you Tyr
Might ask in #mod_support if such a mod already exists. I don't know of one
Is https://pzwiki.net/wiki/Modding up to date to get started with modding?
it's fairly old, but a lot of the resources there are still useful
if you're going to use the javadoc, make sure to use the one linked as 41.65, the official version is hugely outdated
@hearty dew damn, that's quit a bit of code. I'll look over it!
also wtf do you MEAN lua has String.Format 
I've been doing concat this whole time
hm... it's a naive hash, but it might work. I actually saw some Lua hashes that implemented MD5, so I might try to replicate those instead
here's the library I was looking at https://github.com/user-none/lua-hashings
Mm, those are cryptographic hashes. Mine above are more fingerprinting, which seemed to be what you were after
This has probably been asked numerous times, but is there any way to reload vehicle spawns without completely resetting the map or editing the chunks at all? My friends and I keep adding mods and at this point we won't see any of them unless we completely wipe.
https://steamcommunity.com/sharedfiles/filedetails/?id=2871002471 may be to your liking
Thank you!
That's fair. Honestly, I'm just so used to cryptographic that I might be aiming for overkill
I'm very used to the "small changes, big difference" mentality of them
As long as they're suitably unique they do the job
The couple implementations I looked at are simply calling tostring on the object to be hashed (then doing all the cryptographic hashing on that string)
If you call tostring on a table, for example, you get something like table 0xfa120012. So you end up hashing a memory address, which is not going to give a consistent hash value across machines nor across opening/closing pz
Most of my code is iterating over objects and handling different types in a way that avoids those problems
Only like 10 lines are the actual hashing of data š
the djb2 string hash and knuth hash for integers
Ha, fair
and some stuff to avoid precision loss when numbers get too large
That's how hashing goes...
You could drop in md5 (or whichever other hash function) in place of djb2 in my code too, btw
I still need to get the rest of the code running before I even look at implementing that in the end
And noted!
It's not showing up on the server options. I just installed Mod Manager and Mod Manager Server. Both are enabled client side, but only the Server one is enabled on the server. Should I enable both server side?
do you mean the sandbox options aren't showing up when you configure the server? you need to have the mod activated from the main menu for options to show up there
Okay, one second. Sorry, brand new to modding this game
That worked, thank you so much!
i'm glad it's working ^u^
So I have the rv interior mod and all the required mods with it, and I have not found a single rv yet.
One more thing, I promise. The mod is saying that "Player claimed vehicels are not removed (via Valhalla Aegis, a simplistic claim system will be added to this mod in the future)" However I can't find a vehicle claiming system under that name. Am I missing something?
it looks like it was in reference to this https://steamcommunity.com/sharedfiles/filedetails/?id=2694358451
Okay
If your up I can help with the chemistry
usually use destroy for drainables. for example if you want to have a recipe that consumes a propane tank. you need to use destroy to actually consume the tank, rather than simply using up 1 unit of uses/1 items equivalent of uses
Hello there, I wanted to ask if it is possible to integrade a custom made skeletton rig into the game. Does someone know something about this and could point me into the right direction ?
Because of the recent popups of silent hill related mods I wanted to integrate this bad boy here:
hey š Is there a way to adjust the brightness or color/taint of indoor lights, when the room lights are on?
Which is the best way to convert mp3 in ogg for zomboid?
guys need help! how to get a fresh item from recipe. i want to add a recipe to get a apple but when i do that. the apple do not spoiled. there's no fresh in his display name.
There must be, you can get coloured lightbulbs in the vanilla game
Personally I'd use ffmpeg, but that requires comfort with command line tools
Is there any thing I should do or not do to ensure the files are good?
I'm not sure if PZ has any special restrictions. You should be able to do a direct conversion with no issue.
and ffmpeg is smart enough that you should be able to just do ffmpeg input.mp3 output.ogg for all the files
Thank you
Critical Hit sound from TF2!
ha, nice
I keep bringing it up but I jus think about what sets zomboid apart from other games in its genre:
Your character is actually vulnerable from infection
Shows the breakdown of the world and subsequent erosion and overgrowth that takes over (custom sandbox settings)
Thatās why something like dismemberment could be huge for this game- the attention to detail is already there and it would be a personal dream of mine to see it happen. Iād even be down to fund it
Like I said the pitch is relatively simple:
Any time you attack infected with a bladed weapon and successfully land a hit a dice is rolled to determine whether or not dismemberment occurs and at which appendage/or the head.
Certain weapons have a higher chance of dismemberment, would pair really cool with some added gore from the sandbox settings tab.
that sounds doable
The head could have the least likelihood of being dismembered
While the arms and finally the legs would have the highest
personally i'd have the head only able to be dismembered on a blow that would kill anyway
How does one use the Bob_ animations?
Yeah of course there would be things in place to help make it seem ābelievableā and weapons like a kitchen knife would have really small/almost nonexistent chance to completely dismember the head/deal a killing blow in that regard
But it would be cool to be running around with a katana slicing through the hordes and seeing all the body parts
i can't think of a way to have like, flying body parts or anything
but having the dismembered parts disappear from the zombie's model seems quite doable
Do I need to convert the in game coordinates to a different kind of coordinates to make a spawn points mod?
Depends on which type of coordinates you have. The absolute ones that are like 8935x7431 or the relative ones where you have a Cell coordinate and an X,Y coordinate relative to that cell. You need the Cell + Relative for a spawn point.
How can i get this coordinates?
I assume it's one of these right?
Yeah. You need the Cell coords there as worldX and worldY.
posX and posY then are
posX = SquareX - (worldX * 300)
posY = SquareY - (worldY * 300)
Then the spawnpoints.lua would look like this for that position
return {
burgerflipper = {
{ worldX = 41, worldY = 12, posX = 40, posY = 58, posZ = 0 }
},
}
end```
Yes
Okay, so worldX = 41, worldY = 12,
And posX and posY are the square coordinates relative to that cell so need to be calculated from the SQUARE coordinates in the tool since those are relative to the world
Okay, so
- posX 12340 - (41 * 300) ?
Yes
Okay, I hate how zomboid handles coordinates, but I get it now, thank you
Does this look good?
local function getCoords(squareX, squareY, cellX, cellY, z)
return {
worldX = cellX,
worldY = cellY,
posX = squareX - (cellX * 300),
posY = squareY - (cellY * 300),
posZ = z ~= nil and z or 1
}
end
yeah
Alrigh thank you again
that actually sounds kinda feasible. someone (with permission ofc) could possibly use the one true cure models and put them onto zombies to simulate them being dismembered. although making the arm fall off would be probably impossible to do nicely
hi guys is it possible to only enable an on event
if i put the event.On___
inside a function
or do i need to create a boolean that just returns it if the function isnt triggered yet?
Anyone want to help me understand a probably very basic issue? I am trying to get a Hello World mod working, and I can see the mod and description in my list, and I can enable it, but when I go into the game, it doesn't seem to be working as expected. The code is very simple:
local readingReadyBB = false
local function readingConceivableBB()
local player = getPlayer()
player:Say("Hello World! The variable's value is " .. tostring(readingReadyBB))
end
Events.OnEquipPrimary.Add(readingConceivableBB)
Events.OnHitZombie.Add(readingConceivableBB)
Events.OnPlayerAttackFinished.Add(readingConceivableBB)
I only add the function to so many events because OnHitZombie wasn't working...
I am following a tutorial from December 2021... the set-up did not suggest I need anything beyond this lua and the mod.info file in the right places... the above lua is in ...User\Zomboid\mods\MobileReader\media\lua (where User is my username on my PC)
you need to place the lua file in lua\client
I see.
Thanks
Trying now
Worked, thanks so much
I don't know how I missed it, but I went back and vid said that clear as day at 4:23, but it happened so fast I must have been looking away
Can someone assist me? I'd like to make a new type of wall (moveable? I'm not sure) but basically I want it to be added to the build menu, where could I learn where to start?
And am I correct in assuming I build 2d sprites, with rotations, then use tileZed to make a .tiles for my mod?
So, it's not working š
ERROR: General , 1665169521319> ExceptionLogger.logException> Exception thrown java.lang.RuntimeException: can't create player at x,y,z=12458,3668,1 because the square is null at IsoWorld.init line:2779.
ERROR: General , 1665169521319> DebugLogStream.printException> Stack trace:
java.lang.RuntimeException: can't create player at x,y,z=12458,3668,1 because the square is null
at zombie.iso.IsoWorld.init(IsoWorld.java:2779)
at zombie.gameStates.GameLoadingState$1.runInner(GameLoadingState.java:268)
at zombie.gameStates.GameLoadingState$1.run(GameLoadingState.java:225)
at java.base/java.lang.Thread.run(Unknown Source)
Okay, working with spawnpoints is now the thing I hate the most
Alright, I can't be bothered to deal with this
I was trying to make the character spawn in Louisville in the hospital, if someone can do it please let me know, I'm attaching my non functional code hre
I'm seeing a lot of exceptions in the debug menu for files like More Simple Traits, More Traits, and Proximity Inventory, among other things... and the little down arrow button in the F11 menu seems to take me to a lot of break points that involve ISUI files... Do these exceptions indicate issues with those mods? Where is the ISUI stuff coming from? That doesn't sound like a mod I installed. Is it common for highly reviewed mods to throw lots of little exceptions? The exceptions often seem to get thrown from player object loop declarations...
I'm not certain about your problem but ISUI is a folder in the game directory
@gilded hawk The issue is you put "posZ = 1". '0' is the ground floor so you were trying to spawn players in the air and the game didn't like that.
It contains, UI scripts lol
Understood... is it possible a mod is causing exceptions to be thrown from the UI file?
E.g. Proximity Inventory, which seemed broken afaik?
why do you have the role "pee" XD
I think ISUI exceptions are fairly common, especially when you have a lot of mods together
I made the pee mod, and then asked for the role as a joke lol
lmao
I may be wrong but small errors like that might not actually have huge problems associated with them, it depends on which mods conflict with each other but sometimes you'll get an error that doesn't really mean anything
Also since I accidentally brushed over your main question, yes lol
Hmmm okay no problem thanks. Intuitively errors feel sus, but I could see that perhaps there are acceptable ones.
I mean I see them consistently referencing the loop for some reason and I'm wondering if perhaps it fails because the player count drops to 0, and 0 - 1 is -1, so the loop says "Do a for loop from 0 to -1!" and the compiler says "learn math!"
And perhaps nobody cares enough to notice or catch that error because the program doesn't crash over it?
I need to simulate the error in my own mod and play with it I guess
Thanks anyhoo
Anyone who understands the maps well able to tell me how big a "volume" I should use to get zombies attention using DoFootstepSound from maybe 20 feet away?
I think 1 unit corresponds to a "tile" of the map?
Not sure exactly how big that is in practical terms
It actually says "volume" online and doesn't specify if it's a cell or a tile š
Is there a mod that let's you throw bags over fences/out of windows?
But I'm trying to spawn the player on the 2nd floor of the hospital
It was not in the air
The X, Y you gave was just outside the building
But I took the cords from in game on the 2nd floor O.o
This is where I spawn in with the Z set to 0
is this an "off by one" scenario? How big is a cell?
Is there a mod that lets you bail out of moving cars
If there is, can someone link it
If there isn't, can someone make it š
I'm certain I've seen one. I do not remember what it was called though
Anyone know why Paint My Ride is single player only? Is there something in the engine preventing it from working or does the mod dev just not have the time to put MP compat in?
i have no idea why it'd be singleplayer only
i haven't specifically tested colour, but those things usually do work in multiplayer
I'm wondering if it's literally just a servercommand thing they haven't implemented
i think paint my ride has been around for a pretty long time, so my best guess is they just haven't had time to update it since b41 multiplayer came out
thats the one. Its funny I literally searched for "tuck" and didn't see it
It could be issues. What exceptions are you seeing? I haven't seen exceptions with those mods you mentioned
I'm having trouble figuring out what the actual exception is, sorry. Still trying to learn to work that menu and I have been busy for last couple hours, hence dropping the question on here while I'm busy
Figured maybe an answer would show up that made sense while I was afk
I just know it kept pulling up various files in those mods
I'd just check Zomboid/console.txt in your home directory to get the exception. Getting/reading exceptions from that debug UI is a little bit more of a hassle imo
Thanks, I was actually going to have to research or ask for confirmation that the same file is being shown in-game
I actually g2g, but if you're feeling bored and generous with your brilliance, I am going to be hunting through the media folders in search of the LUA file that affects whether I can walk while I read... If you happen to know already and want to share, I'll appreciate it when I have time to look later! Haha.
The exceptions doesn't show up in the debug UI until after you step one line after it breaks
Idk offhand, but there is a walk while reading mod or two that do that. I'd check what they do
Also trying to figure out how to see what they did xD
Will learn more later... g2g
Thanks again
Do one of the anti-cheat measures prevent altering player health outside of a timed action?
I have a function that heals wounds when using a new item and it works fine when that function is called from a Timed Action (person uses item on themself) but doesn't when its called outside of that (server command telling a client to apply the item when one player uses it on another)?
If I rapidly use the item on another player, it'll still heal a wound or two which makes me suspect the anti-cheat isn't fast enough and is nixing it mid-call if it occurs frequently enough.
local og = ISReadABook.new
function ISReadABook.new(...)
local obj = og(...)
obj.stopOnWalk = false;
return obj
end
Something like that
Interesting... Thanks š
Is there a function to get all players in the game, I've been looking for one without luck
local players = getOnlinePlayers();
for i = 0, players:size()-1 do
local player = players:get(i);
--TODO
end
thanks
It looks like that function only returns players while the game is running on a server, I will fallback on getSpecificPlayer when in single player
whats the diffrence between
blahblah = function()
function blahblah()
they both the same. its just syntactic sugar. https://www.lua.org/pil/6.html
i'd say 10 or so
Okay thanks. Is it in pseudo-meters, double-feet*, mystery units, or what? Any guesses
they're tiles
i don't have some specific ratio i've just got like 2000 hours in the game so i have a feel for what 20 feet might be roughly :p
Fair enough, I'll start there and see how it plays š
Glorious advice my friend. Amazing that it's as simple as rewriting the function... they just let their functions get overwritten by modded versions that easy? Crazy...
Attempted index of a non-table... implying player doesn't exist anymore perhaps?
This error only ever seems to trigger after I die
also other errors like it
That code assumes getSpecificPlayer() may not return nil when using an index in the range of 1 to getNumActivePlayers(). Quickly looking through the vanilla lua code, it doesn't make that assumption. It checks that the player object is not nil before using it
Okay that's what I was trying to get at. So just if player ~= nil then stuff end?
yea, or if player and player:isAsleep() then ... end in that code
So if player is the same as if player ~= nil in LUA?
not exactly. nil and false are the only falsy values. Everything else is truthy
but you expect nil or a player object as a return in this case
Can an 18+ mod have "shit" in the name on the Workshop? (The need to ask this makes my brain hurt.)
Thank you for the clarification, makes sense. I assume a player object in this game would never be equivalent to simply false or 0 and have some meaning that differs from nil
Right. Also nil and false are the only falsy values in lua. Everything else is truthy (even 0)
Oh whoa
@ 0 being truthy
Moving forward r.n.... I am inspecting More Traits on homie's GitHub, and I see many cases of local player = getPlayer(); followed by no check to see if player returned something non-nil... think maybe that's why it throws exceptions in -debug after I die?
Also he says he has multiplayer issues... Ogre said I need to use the loop and getSpecificPlayer to avoid multiplayer issues... could that be part of why More Traits has MP issues?
could be. My only interaction with More Traits so far has been investigating the Expert Driver trait, which does things like change the weight of the vehicle and then immediately wipe out those changes by calling an update function that recalculates the car's weight. Also increases the regulator speed, which does exactly nothing. Very curious
Is TraitFactory reliable or does it throw errors too? I kind of want to create 1 trait for a mod I'm running, but I don't want dependencies that throw sloppy exceptions...
I had ideas for mods, don't know if they exist already BUUUUUTTT I'll still voice them here if anybody wants to run with them (just name them after me or something if you use the idea ;P )
First would be a Semi Truck w/ a Car Trailer on it. yknow the big ones that can hold like 6 cars at a time and haul it down the highway. As someone who builds their base in the scrap yard outside of Riverside and collects neat vehicles, it would be a nice addition to have for runs into towns where I KNOW theres multiple vehicles I want to secure rather than running my tow truck into the ground for them.
The other idea was for a snow plow, either attachment or whole vehicle, that could be used in winter months for clearing paths. could also maybe be used for clearing bodies out of roads if the present system allows for that sort of thing
Question for the lua gurus, if I want something like
local v = player:getVehicle():getId() or "none"
but player:getVehicle() could be nil, what is the cleanest way to check for that? Right now I'm doing
local v = player:getVehicle()
if v then
v = v:getId()
else
v = "none"
end
and honestly I don't like it much
Could do something like ```lua
local v = player:getVehicle()
v = v and v:getId() or "none"
But I wouldn't say it is an improvement in readability imo
that is weird, how does and work in this scenario?
It makes use of the fact that the logical and operator is short circuited, so v:getId() is never evaluated if v is falsy
and similarly that or is short circuited, so 'none' isn't evaluated if (v and v:getId()) are truthy
yes, thats what I don't get, if v is "true" (and contains a vehicle object), what the heck happens when you try to and it with its own ID?
both values are not false or nil, so it returns true, surely?
if v is truthy, it still has to evaluate the right side of the and operator (because both operands of and must be true for the result to be true)
well i ran it through a lua console and it does work
in lua (and other languages too btw), the result of the last expression in logical and operators is returned (so it can be used like this)
i had no idea
that is strange, but I suppose it saves you having to do an actual comparison
The comparison is still done
x and y, that will check whether x is truthy. If it is, it will then evaluate y. If it is not, whatever false value x resulted in is returned
ya, thats not a real comparison
next question, lol, anyone know how to tell which vehicle a player just left? OnExitVehicle() doesn't tell you what vehicle it was, lmao
OnUseVehicle also fires when you're getting out of the vehicle, but it doesn't really tell you the player is getting out
if IsoPlayer:getNearVehicle() returns the nearest vehicle (i have never used it, but it seems likely) you could use that
oh, and thanks for the lesson Tyrir, these kinds of shortcuts are always useful
I think getNearVehicle works, but I'd be worried about getting the wrong vehicle in edge cases where they're all mashed together
you could store the vehicle's id in mod data upon entry
in the player's mod data?
that's what i would do
makes sense
I really wish there were just some OnPartDamaged events or DamagePart commands I could use instead of having to try to make an efficient system to scan a particular vehicle at relevant times
š
yeah i've been running into that with my vehicle upgrades mod
i decided to just drop it on the part update, which doesn't seem to run *too* often
I did have a different concept that I haven't investigated yet. Is it possible to make your own parts fit on a vanilla vehicle? Like a different windshield?
i think so
If so, you could make a custom "Reinforce" context choice that would replace the part with a version of it that has more hitpoints. Let the normal damage calculations happen but get an effective "damage reduction" by scaling the total health of the part
not sure how to render bars over the window for example while the new "reinforced windshield" was in, but that seems possible
I think that Tsar's jeep mod might do that
I know it has upgrades that you install to add container space on top
And think it has wheel upgrades
ya, new attachments aren't to hard to do, I just don't know how open to alternative parts the vanilla vehicles would be
i was thinking about that but it seemed like the complex way of doing things
slightly complex mechanism, sure, but as efficient as possible
i'm considering it though just for the 'what if the window breaks' issue
I don't know about you but I get some pretty bad perfomance issues when I have too many vehicle mods with armor slots on them. I think they're all fighting for cpu time to watch your car's parts for damage
hmm come to think of it... this is sort of the hard way of doing it
you could just do the regular method of installing the parts and alter the main part's condition on installation
I assumed its maximum condition would be hardcoded
well i haven't looked into that yet
there is a modifier from the skill level of the person who installs it, but its kept as a separate thing
looks like vehicle part condition is clamped between 0-100
yep, looks like a bust
of course... stopped by a hardcoded value
what partupdate event/command were you referring to?
update on the script's lua
??
that's news to me
i'm not quite sure how often it's called, it's certainly not every frame or anything
how do you do it?
{
update = UpgradeableVehicles.Update.WindowProtection,
}
just like an install/uninstall/test function
I haven't actually touched the scripts themselves
how are you adding new parts?
I'm not
oh yeah i forgot your mod works weird
right now it doesn't do much of anything, lol. I had to abandon plans of creating unique vehicle scripts due to syncing issues. Mx has the same problem with his transmog mod
i'm sort of doing things the simple way, like i'm not really that satisfied with the update function solution, and vehicle scripts have some weird and clearly unintended limitations, but i don't want to rewrite the whole vehicle system quite yet
update seems like the perfect solution tbh, if its called every time the part is looked at by the code, a quick check of its condition at that time shouldn't be too bad
i'll go test when it's actually called
I'm assuming I can use a similar process to itemtweaker in order to insert a update method onto vanilla parts, I'll need to look at that
there's a vehicletweaker
is this lua you posted on the vehicle or the part?
the part
it just seems to be called periodically
only while a player is in the vehicle though
ideal for my uses
just trying to track down a scripting guide now so I can see what's possible
in theory, a zombie attacking an abandoned car could destroy it through the armour, but... i don't care
that's too niche
do zombies even attack empty cars?
sometimes
sometimes right after i've abandoned a vehicle they'll continue attacking it
do you have a particular resource or tutorial or something for script stuff? I'm struggling to find anythingn
no i just worked it all out myself
guys anyone using github?
is it fine to use the actual workshop mod folder as github location? cuz if you do this the .git folder with the files also goes with the mod upload. is it ok for this to happen?
followed the vanilla scripts until i got it
š¤Æ
I don't think you want to be sending randos your git files
ow yeah make sense.. i dont even know whats inside that folder anyways
thnx for the heads up tho
so that's how these functions in Vehicles.lua are called, by the part scripts themselves
looks like there is create, init, update ,use, and some install and uninstall actions that you can assign functions to. No damage, which is a shame, but update handles all the wear and tear parts take over time so that's close
why would chunk ever be nil for an IsoGridSquare
hey guys https://steamcommunity.com/sharedfiles/filedetails/?id=2618213077&searchtext= with this mod can you use the trailers for storage?
yes
then ur either at the wrong spot or its' a trailer that doesnt open like a fuel container
try standing slightly further from the back of the trailer?
it was the camo one that had a folded ramp off the back of it
this one
i was standing by the back of it
couldnt see a way to open it
ive never used one of those, as long as i've played with that mod, lol
ive used like everything else in the mod
xD
oh lol
i would still expect it to be at the back
but walk around the whole thing lookin for green square on the ground 
i can say it DEF has storage
cuz i've seen the stats at some point
but where the access point is idk
how much can the trailers hold?
is it like 1000
the larger ones with the little windows hold like 1300 and the ones with no windows hold 1430
if u have organized
the small one probably holds somewhere between 1000-1250 but i dont know
(the one ur talking about)
I think the access is at the front by the hitch on that one, but I don't quite recall
so far no luck adding an update function to the engine of a vehicle with a script, but I feel like I'm not formating it right
local script = vehicle:getScript()
local _, name = vehicle:getScriptName():match"([^.]*).(.*)"
script:Load(name, "{part Engine{lua{update = Mek.UpdateEngine}}}")
@bronze yoke do you see anything immediately wrong with this? I'm firing it when someone uses a vehicle. but so far no good
i didn't do it this way so i don't know
its essentially the equivalent of doing
TweakVehicle("Base.SportsCar", "part", "Engine {lua{update = Mek.UpdateEngine}}"
it may simply just not work because template = Engine already exists in the script for the vehicle
I did it!
Special thanks to OgreLeg, Tyrir, albion, and anyone else who answers people when they have questions.
Nice! Can you drive and read?
Not sure about that yet. Just walk and read. But that's a tempting expansion
I'll look into that next @magic nymph
For now, it reliably lets you walk and doesn't seem to cause any problems (but I use normal server settings for fast reading, no mods)
(i.e. minutes per page .005 or something; not sure if it's rounding that, but it's fast).
When I made such a mod first time , I wrote exactly the same lines of code. Then I realized that you can't just walk and see everything around. It's not realistic to read and look around. Also it's uncomfortable to use context menu every time you want to read next 2 pages, so I added hot key. So the mod became more complicated but still simple enough.
The mod is 38 kilobytes š
Yeah, I saw your mod. I just... didn't want it.
I don't think my periphery should be jet black.
I could see you had strong personal opinions, and saw no point in posting for requests. š
Agree to disagree about the limits to your vision while reading.
Weird issue when I tried to remove the check that seems to tell the game you cannot read while driving. Gonna try an alternate strategy or two.
True. I don't use mods that makes game easier (except QoL mods). So I try to balance every new mod created by me. If it makes something easier, it should make something harder and/or more realistic.
Fair enough. To many of us, being able to, e.g., read and drive, is simply basically realistic
Not "easy"
Difficulty is easily achieved by crazy strong, fast, and plentiful zombies in tough enough maps without preventing people from reading while they walk imo š
Gonna have to chug away at this more tomorrow. I don't really know where the reading event signal checks to see whether you're driving... I know isValid seems relevant, but I don't know how to make the isValid function behave differently without simply editing that LUA file directly... which I'm guessing is bad practice, if it would even work at all.
Quick question
function ISRenameEverything:onRenameItemClick(button, player, item)
if button.internal == "OK" then
if button.parent.entry:getText() and button.parent.entry:getText() ~= "" then
item:setName(button.parent.entry:getText());
local pdata = getPlayerData(player:getPlayerNum());
pdata.playerInventory:refreshBackpacks();
pdata.lootInventory:refreshBackpacks();
end
end
end```
This is a code (that ofc works with other parts of code), that lets you rename an item in the inventory. It works good so far, but it has a problem where it doesn't work with items that aren't within the item list of debug, but can appear in your inventory, such as a chair, a cardboard box, etc. Everything works fine. No errors, nothing, but it just doesn't change the name. Any idea what may be the issue there?
Gonna repost sorry
Seems like the issue happens with the "Edit Item" option from the vanilla debug mode
it also renames all items except the items you'd pick up from the world and not find in containers
Would it be some kind of a bug/limitation or is there a way around it in the code?
Omg I deleted a mod before unsubscribing and the hassle is enough to make me self-combust
Caused so many problems
Currently reinstalling Zomboid in hopes it helps
Still no driving, but if you want it for walking, it's up and running now... make sure you unsub from old one if it's still up for you.
Hello everyone, I wanted to know how you could change the outfit of an entire zombie group
like "student" group
or military
Woops
lol jesus I have been awake too long
Is there an easy way to invoke a function when your character shouts (MP friendly please)?
Or alternatively easiest way to detect player making any noise?
Or any way to activate an event when zombies get too close to you? Losing it here lol
Anyone else looking for a mod where you can use a car battery as a generator? For all of us playing 10 years later it would really be nice. Figured you could be able to connect a car just like a generator (just like the generator trailers) but instead you would use the cars battery so you would have to sacrifice your cars health to power up let say a building to loot.
Anyone?
probably would have to be a OnTick function
I can catch events... hence this
An event made me invisible to them, and will make me visible again if I stand up
But what I want is for them to eat me when they get this close, even if I am invisible (i.e., I want their proximity to cancel my state of invisibility).
Unfortunately, I have tried 64548 things and failed at all of them
I can shout and make them approach, but I can't figure out how to use that shout as a trigger...
I can use things as triggers, but deriving a way to infer proximity after being triggered is killing me.
Basically you could hook the alternator up to a battery bank. It would be slow but could work, you would need an inverter as well though if you want realism
Are those world items you pickup different types than the usual inventory items? Maybe their names are handled different on the java side e.g. the field that is changed when calling setName isn't used for them in the same way? I'm not sure what's actually happening, that's just a hunch
I accidentally deleted a workshop item, and when trying to correct this / re-upload it am getting the very vague and unhelpful error of 'failed to update workshop item, result=9'; does anyone know how to resolve this? Google has been fruitless.
Deleted your dev version the workshop item that you upload? Or deleted the version that is downloaded when subscribing?
On the workshop page itself hit delete -- I'd uploaded and overwritten a mod with a second one when I accidentally neglected to give it a new workshop ID.
Is it against the rules to ask for commission for custom workshop items?
I had to clear out my relevant mods from the Zomboid install folder, delete my saves (maybe?), and then unsub and resub to broken mod(s) when something similar happened to me... Slightly different error, similar cause. Despite deleting workshop mod, system still wanted it to be there.
I actually unsubbed from everything (after favoriting them) to reset my subs, because I had deleted the file and thus couldn't unsub from it directly.... I tried a lot of other stuff first
It isn't that I'm subscribed to a missing mod, it's just not letting me re-upload the intact work copy I have to the same workshop ID
Including reinstall Zomboid etc.
I got stuck there too... I was not able to reupload my mod because the deleted mod was taking its space and the ids were the same.
So the updates were pushing to an invisible place and doing apparently nothing
i don't think you can reupload to the same workshop id if you delete the item
That's mildly horrifying
I don't want to have accidentally boned somebody's server because it's looking for an absent workshop ID
if you accidentally upload to the same workshop id, you can revert to a previous version from the change notes
I didn't think of that at the time and panic-fumbled the delete
I'm trying to find an explanation in the steam api docs, but not finding a 9 error yet. From a quick google search, someone said that error indicates the item is missing, so it might be that a deleted id can't be found and thus can't be updated?
Ugh
Is there any possible resolution to restore it / replace it there?
I'd contact steam's dev support if I couldn't find anything online
Slim likelihood of a response there, but I appreciate you looking
IsoGridSquare has a method called getZombie. so what you can do, is put a function in Ontick, then get the player coords, and check for zombies in adjacent squares. if there is a zombie, then remove invisibility from the player
I don't think it is feasible to make yourself invisible to some zombies and not to others. although you could try manually setting the target of the zombie to your player
@austere finch Is there no option to revert to a previous (non-deleted) version in the steam UI?
Not that Iāve been able to find, there is no stub for it in my workshop items and I get the same MIA page a regular user does going to it manually
@austere finch Might also try contacting regular steam support and asking them "Hey, I accidentally deleted my workshop item, id=1234. I'm unable to update it now and the page is gone. Can you please undelete it?"
Same numerical id, no, same string id, yes
Did this last night
string id...?
In your workshop or mod info file (i forget) there is a string id for the mod
Literally called id
that isn't related to the workshop
Could be point of confusion
Fair
It shows on Steam
Steam pulls the given (string) id and shares it
Idk what related means in this context
Seemed relevant
But yeah only the numerical id is unique afaik
for the steam workshop only the numerical id matters, the workshop just downloads the folder you uploaded, it doesn't have a concept of mod ids
So it just shares that as plaintext i.e.?
Doesn't even know Zomboid gave it a string called id?
i'm not sure what you mean
I'll share screens when I get home
zomboid just automatically adds the string mod ids to the description for user convenience, the steam workshop doesn't really know about them
in the britas gun thing are all the guns properly 3d modeled to the style of the others in the game or is he/she still working on it?
they're all modelled, although i wouldn't say they're exactly in the vanilla style
oh ok that makes sense I thought it was an issue on myside
no, steam does not differenciate the modid
hey guys, how do I patch a mod with another mod? for example, viperel recycling centre allow us to repair katana and wood axe. I want to patch the recipe to make it harder without remaking the whole mod again. For example, in the original scripts file:
{
imports
{
Base
}
recipe Repair Katana
{
keep WeldingMask,
BlowTorch=2,
WeldingRods=1,
SmallSheetMetal=1,
ScrapMetal=2,
destroy Katana,
Result:Katana,
Time:500.0,
Category:Welding,
Sound:BlowTorch,
SkillRequired:MetalWelding=6;LongBlade=2,
OnGiveXP:Recipe.OnGiveXP.MetalWelding10,
AllowDestroyedItem:true,
}
}
I want to make the skill required to metalwelding=8 and longblade=8
is there a way to make the new mod import the VPR_recycle module? If so, how do I proceed?
you need to grab the recipe from the script manager, so something like the following. you can see all the relevant functions here https://zomboid-javadoc.com/41.65/zombie/scripting/objects/Recipe.html#skillRequired
function modify_recipe()
local recipes = getScriptManager():getAllRecipes()
for i = 0, recipes:size() - 1 do
local recipe = recipes:get(i)
if recipe:getName() == "Repair Katana" then
recipe:addRequiredSkill(Perks.Longblade,2)
end
end
end
Events.OnGameBoot.Add(modify_recipe);
Javadoc Project Zomboid Modding API declaration: package: zombie.scripting.objects, class: Recipe
not sure about the correct perkname though, you would have to find that yourself from the vanilla code
I see, so I just create a client lua and insert correct perk name, edit the value to 8 if desired
yeah, looking at my code I have that function put into the OnGameboot. Im guessing its to ensure the code is executed after all recipes are loaded
alright, will give it a try, thank you so much my good man
found the perk in the class file, its Perks.LongBlade and Perks.MetalWelding
do I need to include the full perk name such as PerkFactory.Perks.LongBlade,2
and is my code correct if I add more perk requirements?
function modify_recipe()
local recipes = getScriptManager():getAllRecipes()
for i = 0, recipes:size() - 1 do
local recipe = recipes:get(i)
if recipe:getName() == "Repair Katana" then
recipe:addRequiredSkill(PerkFactory.Perks.LongBlade,8)
recipe:addRequiredSkill(PerkFactory.Perks.MetalWelding,8)
end
end
end
Events.OnGameBoot.Add(modify_recipe);
or do I need certain syntax to add more addRequiredSkill?
Special zombies that either give panic and unhappiness as long as they're in your LOS (as in : family, friends, loved ones, etc), that carry a memento. Panic would last for 30 minutes in game, the depression would last weeks or months without ADs.
Memento give you 'hope' (as in, slightly decreases unhappiness gain) as long as they're in your main inventory.
Would this be implementable ?
no i think Perks is already a global variable with all the perks, so you dont need the perkfactory
alright thanks
i guess you really can ban a player without an admin. the server by itself doessnt allow this 4 somereason
I suspect yes. You can track daily and monthly changes in response to events... Presumably there's a way to attach those long-term consequences to acquiring a specific item.
is there a mod that wont reduce trunk capacity when i ram zombies?
In pursuit of cross-mod compatibility patching, is there a best-practices / clean way to append additional eligible components to existing recipes? E.g. adding more bladed items for a cooking recipe, or making duplicates of something interchangeable between three sources.
Eggonās better cars
ty, does it work in multiplayer?
Yup
tyty
local function doMyTweaks()
if getActivatedMods():contains("mod1") and getActivatedMods():contains("mod2") then
local recipe = getScriptManager().instance.getRecipe("namespace.recipe")
if recipe then
recipe.doSource("Foo=1")
end
end
end
Events.OnGameBoot.Add(doMyTweaks)
Maybe something like that. No idea if that'll work. Didn't test it. May need to utilize other methods on the Recipe object. Can check the pz api doc
Anyone wanna help my tired brain by pointing me to any function that will let me add a reaction to either the proximity of zombies or the noises I make when My character shouts....?
Thanks!
havent seen the script but try the mod where the zeds are attracted to to corpses
but do the reverse of that
oow theres also this silent hill radio sound nod when a zed is near by
perhaps refer to both or maybe add the toxic fog mods
not really sure abt how they are written but you might get lucky and get a few ideas from there
goodluck dude
Honestly am not sure how do I check that, or if there's a vanilla way somewhere to check that. The debug Edit Item doesn't even work on them when changing names
maybe someone from the devs got an idea how they're handled?
Does anyone knows how to get the png of vanilla items
Anyone have a reference .png for x2 tilesets
Any good mods for letting players rank up and receive rewards every mile stone?
Im looking to commission a mod like that if need be.
I haven't looked at the code about this, but from what i've heard, tiles don't strictly have a name in the same way that normal items do as they don't have scripts. the name that is show in inventory is generated on the spot for the tile for the inventoryitem, so they probably arent using the same namefield that normal items do. you should probably just take a look at the java to try to figure out how it is done
Moveables have a movables file in translate folder, which is based on group name or smth.
losing my mind over two problems
- when i do getOrCreateGridSquare sometimes the square has null chunk, causing errors when u try to do something with it that checks that.
- when i try to override ISDismantleBurntVehicle.start the code just never runs when i dismantle a car.
just to make sure, you mean ISRemoveBurntVehicle, right?
i do yes
it is correct in the code
just derped
i've modified perform in the same way in another mod without issue
but i can't get this mod to modify start, new, perform or update
the lua file loads and in the correct order
local original = ISRemoveBurntVehicle.perform
function ISRemoveBurntVehicle:perform()
print("UDDTST: TEST")
if not Aegis_IsOwned(self.vehicle) then
original(self)
else
Valhalla:say(getText("IGUI_VVC_CantDismantleClaimedVehicles"))
end
end```
it isn't complex code
print statement never shows in log
ah
i have two vehicle recycling mods and i mixed up which one uses the vanilla action or not :|
@weak sierra yo i donāt mean to make it look like iām ātracking you downā but i just remembered something i was going to ask if thatās alright.
hm?
do you have any plans on adding support for noirs attachments and the ātwo weapons on backā mod for your backpack mod?
oh i mustāve had it mixed up my bad
am unfamiliar with the latter, thus i don't have any plans xD
gotcha, thanks for the response
If you look at the functions available on the objects (you can print them out as a table and/or print out their metatables to see their functions), there is something like getClass() or getName() or getSimpleName(), I forget which
hmm lemme try that out
@hollow current using this, try this in the console:```lua
printR(object, 3)
printR(getmetatable(object), 3)
Do clients handle zombie loot? I'm trying to spawn unique zombies that have specific, configurable items and "addItemToSpawnAtDeath" works in SP but doesn't in MP. The server says its adding the item, but its not appearing when the clients loot the zombie.
Is there a simple way to have the server add an item to a zombie that will appear when clients kill the zombie?
throws an error at printR(getmetatable(item), 3)
ERROR: General , 1665272931167> ExceptionLogger.logException> Exception thrown java.lang.RuntimeException: Object tried to call nil in onRenameItemClick at KahluaUtil.fail line:82.
ERROR: General , 1665272931167> DebugLogStream.printException> Stack trace:
java.lang.RuntimeException: Object tried to call nil in onRenameItemClick
at se.krka.kahlua.vm.KahluaUtil.fail(KahluaUtil.java:82)
at se.krka.kahlua.vm.KahluaThread.luaMainloop(KahluaThread.java:973)
at se.krka.kahlua.vm.KahluaThread.call(KahluaThread.java:163)
at se.krka.kahlua.vm.KahluaThread.pcall(KahluaThread.java:1980)
at se.krka.kahlua.vm.KahluaThread.pcallBoolean(KahluaThread.java:1924)
at se.krka.kahlua.integration.LuaCaller.protectedCallBoolean(LuaCaller.java:104)
at zombie.ui.UIElement.onMouseUp(UIElement.java:1228)
at zombie.ui.UIElement.onMouseUp(UIElement.java:1183)
at zombie.ui.UIManager.update(UIManager.java: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)
LOG : General , 1665272931167> -----------------------------------------
STACK TRACE
-----------------------------------------
function: onRenameItemClick -- file: ISRenameEverything.lua line # 39 | MOD: Everything Has a Name
function: onClick -- file: ISTextBox.lua line # 142 | Vanilla
function: onMouseUp -- file: ISButton.lua line # 56 | Vanilla
LOG : General , 1665272931167>
function ISRenameEverything:onRenameItemClick(button, player, item)
if button.internal == "OK" then
--print("GET CLASS:")
--print(item:getClass())
--print("----------------------------------")
--print("NAME")
--print(item:getName())
--print("----------------------------------")
--print("GET SIMPLE NAME")
--print(item:getSimpleName())
--print("----------------------------------")
printR(item, 3)
printR(getmetatable(item), 3)
if button.parent.entry:getText() and button.parent.entry:getText() ~= "" then
item:setName(button.parent.entry:getText());
local pdata = getPlayerData(player:getPlayerNum());
pdata.playerInventory:refreshBackpacks();
pdata.lootInventory:refreshBackpacks();
end
end
end```
Did you add the definition for printR?
I am not sure, but I was faced with a problem before where the code worked perfectly fine in SP but didn't in MP. Maybe you need to change it to work with a client command?
Object tried to call nil in onRenameItemClick```
