#mod_development
1 messages · Page 236 of 1
1, 101
Guys, explain to me what a clothing GUID is, do I have to create new xml files for clothes, can I just refer to an already created file in the items parameters? What is the threat to me?
Free Online GUID / UUID Generator
I would do ZombRand(99)+1 if you want a result between 1 to 100.
I understand, maybe syntax is not the right word. What I meant was I'm unsure if my for loops are written correctly and do what it's meant to do. I'm also unsure if my inventory checks.
is that realy any diferent than doing 0,101?
dunno, I usually do as I said, but I'm a dabbler 😄
i'd argue doing an addition probably makes it ever so slightly slower
that's pretty cool
It's not inclusive. It would be (100)
(1,101) identical in outcome to (100) + 1 (oops, misread what you wrote... you changed your goal from 1,101 to 0,100... but the prior statement has been corrected to reflect something true)
yeah sorry i meant 1,101
no, (0, 101) returns 0-100, (100) + 1 returns 1-100
Ohhhh I misread entirely lol.
I was thinking he wanted 1-101
Wait he did
lol I got confused reading how he changed it.
Originally we were discussing 1, 101
1 - 100 => (1, 101) => (100) + 1...
(0, 101) something else entirely.
Ok I have to check back ALL my mods then 😄 Lol !
Fortunately the mistake you made would probably not cause errors in most cases, because it means you're missing the last available element, rather than accessing nonexistent ones.
Actually you do mean syntax and testing your program should reveal this kind of error. You do have syntax errors in that file (or at least one I immediately noticed). Have you tried running this file at all?
I was so unsure of my code that I was asking if the for loops and the inventory checks were theorically ok. And then the server I'm running started so I had to switch to admin mod 🙂 I'll run it later tonight and paste the stack trace 🙂
Well it's one thing to ask what a for loop should look like or how to decorate a specific function, but generally speaking if you just want to know whether an entire file has errors, that is the purpose of compiling them (i.e., this is something we all learn by launching the game with them loaded).
If you're stumped by an error message, definitely ask for clarification, but if you just want to know whether a file will throw a syntax error somewhere, you should just try running it and follow the error messages to fixing it. Asking humans to syntax test for you by reading is honestly inefficient... Computers read faster than people do.
Also, learning to follow the error to the solution is a vital skill in this process, so I'm reluctant to tell you where an error is before you've even seen the message it's going to produce.
Ok, I am grateful, you're right, to improve myself I must see the issues and confront, and then solve them 🙂 (eventually with some help 😉 )
Besides that, there are syntax highlighting extensions you can get to identify errors before you run your code.
In VS Code or any other worthwhile editor
Once you get stuck or get the errors sorted, I'll do my best to help with stuff the computer can't show you very easily.
I use Notepad++
I don't know it well but I'm sure it has something for Lua
Does anyone have any idea what Bob_Reload_Rifle_Rack.X is in the anims_X folder?
I noticed that every other type of rack animation is assigned. Bolt action for pretty much every long gun, dbshotgun_rack for double barrel shotguns etc.
I was wondering could it be the unassigned lever action rack animation? Since the game does have a lever action rifle in it, but it simply isn't in the script or lua files yet.
I also don't have the software to view .x animations so I can't just open it up and see what it is
Has anyone ever looked into SQL Support for zomboid servers?
Thanks a lot for the diagram, it brings more clarity to all of this. But I'm also interested in the technical part. Why, in principle, is there a unique GUID and xml file for each piece of clothing? Let's say that the model I need already exists in the game. In this case, can I create, for example, three different items whose clothingItems refer to the same file? Or will it just break the game?
GUID is a unique identifier.
Roughly speaking - a link to an object that refers to parameters.
In this case, a list of clothes per file of individual clothes.
if u want full model from game into zombie like item, without any changes, just copy it from vanilla fileGuidTable.xml
without xml into clothes
like i do for vanillas items (i use it on my zombies)
or if you want create new item, model full based on vanila, just doit for item, like:
ClothingItem = Shoes_ArmyBoots, for example into scripts
Oh, I think I got more clarity on how it works. And thanks a lot for the advice that I can copy the file from vanilla. Just one small question: if I do this, will I need to replace the GUID there if I plan to keep the original item in the game and add another one?
change name of xml file of this copied clothes and change guid, another param stay same
Thank you very much, you really helped me a lot! 🙏Good luck developing your mods
ClothingItem = Shoes_ArmyBootsMYMOD. into scripts param
for example
Shoes_ArmyBootsMYMOD.xml be same as vanillas Shoes_ArmyBoots.xml, but another GUIDs
Can I ask one more question. should the GUID be the same in the fileGuidTable file and in the clothingItems file for the same piece of clothing? It's just that when I read the steam guide, they used different ones, but I had doubts that I should use the same one
Briefly:
- If you want to use a vanilla item of clothing on a zombie, just copy it into the fileGuidTable.xml from vanilla (without xml from clothes)
- If you want new clothes with same model in vanilla - copy it into fileGuidTable.xml with xml from clothes, change name and new GUID.
2.1) GUID in two places (in fileGuidTable and in xml clothes) should be same.
Thank you
❤️
Hello all,
i have a strange issue : i created a very simple recipe, the most simple as possible, but i cannot see this recipe in my game.
Nothing in the log.
the recipe is :
module Base
{
recipe create simple object
{
RippedSheets,
Result:Bowl,
Time:150.0,
Category:Cooking,
NeedToBeLearn:false,
Override:true
}
}
I put this simple recipe as usual in the correct path of the mod :
WorkshopMod/Contents/mods/IsaRepair/media/scripts/IsaRepair_recipes.txt
and i know that the mod was loaded, because i have some lua code correctly loaded.
But i cannot see the recipe in the game, really strange 
ok i understood : despite the fact that my "in dev mod" was in my personal "Workshop" folder, the game persist in using the global mod directory 🤦♂️
Common issue. Good habit to always keep your Workshop items in Zomboid/Workshop and unsub if you're working on an update.
If you wanna play live version of a mod while mid-update, gotta move item out of Workshop folder.
I feel like that happened to every modder here atleast once
is it possible to put a mod requirement for a script file? like "If X mod is activated then load the scritpts file"
yes
nice, ill look for a mod that does that then to learn how. thanks
local modInfoTK = getModInfoByID("TheyKnew")
if not modInfoTK or not isModActive(modInfoTK) then
return--handle : compat not required
end
--condition at start of a file to handle compatibility with "TheyKnew" mod
wait i can do that in a scripts file?, like recipe/item scripts?
no it is for lua scripts 🙂
oh, im trying to put a condition in my recipe script file. basically made my own version of a packing mod, and wanted to add in modded items without having to do a seperate module. so was trying to put a check in the recipe scripts somehow to check if a mod is active
I do not know for config files
if not getActivatedMods():contains("Authentic Z - Current") then
local BlockRecipes = {}
BlockRecipes["RecipeNameHere"] = true
local recipes = getScriptManager():getAllRecipes()
for i = 1, recipes:size() do
local recipe = recipes:get(i - 1)
local name = recipe:getName()
if BlockRecipes[name] then
recipe:setNeedToBeLearn(true)
recipe:setIsHidden(true)
end
end
end
variation to work with mod
But you will have to create more recipes... most likely... In order to give out some, hide some
I made a new weapon and I want to make it function as a wrench. How should I modify the Lua file?
ooh yeah didnt think of doign it that way, thats a great idea
@thick karma Thanks mate ! I managed to debug my file, but I still have issues I can't fix.
Here is the first one :
yes my mistake
I do not understand: ```lua
item = itemInBag:getDeviceData():setIsTwoWay(false)
what is itemInBag ?
it is not set in its current context. so it is nil which is your error
my first issue is that my testIfWalkieTalkie () function is getting me an error (first stack trace in my previous message)
yes because you call it on itemInBag that is not initialized
second loop, not first
ok so I should add a local itemInBag = nil ?
no you should set it or not use it in the second loop
after a copy paste re-read your code.
check after the comment ```lua
-- check bags equipped in hands
function InjectionsRequests.fixInventory(player, items)
local itemToRemove = items:get(0)
-- check backpacks/fanny packs
local locationList = {"Back", "FannyPackFront", "FannyPackBack"}
for _,location in pairs(locationList) do
local bag = player:getWornItem(location)
if bag and instanceof(bag, "InventoryContainer") then
local container = bag:getInventory()
container:DoRemoveItem(itemToRemove)
-- code for removing the items (example: container:Remove(item))
end
end
-- check bags equipped in hands
local itemA = player:getPrimaryHandItem()
local itemB = player:getSecondaryHandItem()
local itemList = {itemA, itemB}
for _,item in pairs(itemList) do
if item and instanceof(item, "InventoryContainer") then
local container = item:getInventory()
container:DoRemoveItem(itemToRemove)
-- code for removing items
end
end
player:getInventory():DoRemoveItem(itemToRemove)
end
This code is working (from another of my mods)
(btw fixed the "end" problem 😉 )
Damn, I have to use "item" of the first for loop in the second one too ? Insteand of itemInBag for the second one.
I'm still getting an error with my first function.
I don't understand. Events.OnEquipPrimary.Add(myfunction) can pass to myfunction (player,item) right ? according to https://pzwiki.net/wiki/Lua_Events/OnEquipPrimary
Hey hi, is there a way to reliably profile mod impact?
I was wondering what the ordinal numbers correspond with. I understand it is specifying a resource but what resource is it calling? Is there a chart I am missing
recipe ReBaseballBat
{
Log=1, -- << Source=1,
keep [Recipe.GetItemTypes.SharpKnife], -- << Source=2,
keep [Recipe.GetItemTypes.Saw], -- << Source=3,
Time:400.0,
Result:BaseballBat=1,
CanBeDoneFromFloor:true,
Sound:Sawing,
AnimNode:SawLog,
Prop1:Source=3, -- << main hand
Prop2:Source=1, -- << not main lol
SkillRequired:Woodwork=4,
Category:Survivalist,
} ```
THANK YOU! Holy shit this is exactly the visual I needed to make it click. Also very concise 🤘
Going to have to redo all my recipes but such is life 🤣
Would anyone happen to know where I can find the file that contains function Recipe.OnGive.Cooking
Ours have borked 😅
recipecode.lua in server
Haha of course it is! Thank you!
I'm thinking about resuming work on my ZedScript support extension in vscode again..
I was at a point where the logic parser for errors and warnings were being implemented.
AFAIK, I'm the only one who has built syntax-highlighting and some documentation / Intellisense support for ZedScript.
is there a limit of how many times update is called per second (for OnPlayerUpdate or OnTick etc if there is any)
is it the direct fps or limited to 60 for stability ?
for example wanted to increase sickness value per tick, is there a way to calculate it to be called 60 times per second for all to balance it for all players? or is it not needed?
I think you would be better off using EveryOneMinute for that.
Then it'll be not only the same rate across players on a server, but same rate across game speeds.
I need to use OnPlayerUpdate since it will be called under conditions so it wont be heavy to have effect much I believe
I mean it needs to be called on tick
just dont want it to create problems because someone is playing with 120 fps since it would double the amount for example endurance recovery
it's tied directly to framerate
Idk what you mean. Something is being lost in translation
use a delta to modify it by the framerate
oh can you give me what we use for delta in lua?
its pretty hard to explain tbh it can be my bad sorry, It was the thing I needed deltatime would solve it
But again, even if you modify to work on frame rate, you'll at least need a sandbox option for rate of sickness change to make it work right for different game speeds
there's provided by the GameTime object (getGameTime()), there's a few different ones for different needs
Im not mainly working on lua but work on C# so kinda had no clue on lua kek
getMultipliedSecondsSinceLastUpdate() is probably the most general use one
just wanted to make sure there wouldnt be difference for players since Im increasing values within update method that number of calls changes within fps
@❓: I'm saying OnTick behavior modified to happen the same number of times per second may still happen too fast or too slow if people are playing 15 minute days as opposed to realtime.
will check this out thanks, would be nice if there was a direct event that is called fixed 60 times per second for all tho 😄
If we're talking about how fast someone gets sick it seems that you would want to adjust the rate such that playing on 15 minute days doesn't make you sick 96 times faster than playing in realtime.
Im still not following kek
it'd make you sick at exactly the same rate in real time
Right but in game time it would not make sense
whether or not you want it to scale with day length is a per-mechanic choice and deltas are provided for both needs
I dont really care about the gametime tbh just want it to be equal amount of calls for all players
Fair I was just saying based on his simple goal of adjusting illness level 60 times per second for everyone
but what albion sent should end up in the same road so
It would feel strange getting sick at the same rate if your days should be moving much much faster
sickness was just an example
I was responding to context of this example so maybe what I am saying will not come up
But it's something to consider
I mean I think I got what you are saying but Im not planning to add it on sickness value but currently on endurance value
you wouldn't need a sandbox option either way, you can just multiply by ('base' day length / current day length)
So player gains endurance 60 times per second?
if his fps is 60 yes
issue was that different fps amounts would give different results
Yeah hence at least an option... I meant if he doesn't manually handle the conversion via math he would need to let people adjust the rate to fit their game speed.
since there is no FixedUpdate() so equal to pz terms no event that is called 60 times per second for all
yeah, pz doesn't really seem to get the idea of a tick rate 😅
I just meant to ask you to clarify your goal, not what would happen using OnTick on different framerates. I get that issue.
Anyhoo I think it's clear now lol
@thick karma Thanks mate for your advice yesterday. I ran the mod and debugged it a lot. But I have some issues I don't understand. If you have some time to check the stack trace, I will be grateful 🙂 I responded to original post
local last_event = 0;
local function OnTick()
local now = getTimeInMillis();
if now - last_event > N*1000 then -- where N - realtime sec
-- DO STUFF HERE
last_event = now
end
end
Events.OnTick.Add(OnTick)
the problem with this approach is it doesn't account for long frame times
if i use this to do something 60 times a second, and my game lags and i only have 30 frames that second, it will only happen 30 times
this approach only stops it from going too fast, it doesn't prevent going too slow
Im not really sure what would be the difference if I dont match everyones call amount tbh but at least I have solutions now if it becomes an issue kek
thanks for responding
Good afternoon.
good night :3
if you wanted a framerate safe interval i'd do it more like this```lua
local intervalMs = 1000 / 60 -- 60 times a second
local last_event
local function OnTick()
last_event = last_event or getTimeInMillis() -- regrettably cannot be initialised outside of the loop because the first tick could be a very long time after lua load
local numTicks = (getTimeInMillis() - last_event) % intervalMs
-- either this:
for i = 1, numTicks do
-- do stuff here
last_event = last_event + intervalMs
end
-- or, if your code can just have its effects multiplied safely, this is more performant:
if numTicks < 1 then return end
-- do stuff here, multiply whatever it does by numTicks
last_event = last_event + intervalMs * numTicks
end
Events.OnTick.Add(OnTick)
damn Im not really used to see multiple people trying to help this quick love yall ❤️
Any idea why player:getInventory() doesn't work on OnClientCommand? It basically empty.
player inventories aren't synchronised, you can only access them on the client they belong to
Didn't knew that
That's actually fairly important to know
So like if you want to access the inventory of another player you got to do some weird stuff?
attempted index: getName of non-table: null is the primary descriptive text needed to understand why your error is happening on line # 10 of Asilar_RadioOneWayOnBelt_bis.lua. It is trying to call getName on a variable that is not a table, and is in fact not even initialized to have a value. In this case, the variable is item. When you say item:getName(), this is an attempt to access getName of item (meaning in this case a function available to the item), but item is nonexistent and not even a table that could be used this way, so the compiler says you're trying to access getName of non-table: null.
I'm gonna take a shot in the dark and guess that this happens when you unequip a primary hand item, because I suspect this would trigger OnEquipPrimary with nil as the provided inventoryItem. If this is the problem, you simply need to check that item exists before you try using it:
local function onEquipRadioToggle(player, item)
print("Entering onEquipRadioToggle")
if not item then return end -- Bingo Bongo.
-- Check if radio is being equipped
if testIfWalkieTalkie(item) == true then
-- etc. etc. etc.
end
@violet shell Make sense?
@violet shell Here's a bonus thought:
local RadioOneWay = {}
RadioOneWay.walkieTalkies = {
["Base.WalkieTalkie1"] = true,
["Base.WalkieTalkie2"] = true,
["Base.WalkieTalkie3"] = true,
["Base.WalkieTalkie4"] = true,
["Base.WalkieTalkie5"] = true
}
local function testIfWalkieTalkie(item)
print("Entering testIfWalkieTalkie")
if RadioOneWay.walkieTalkies[item:getName()] then
print("Item is a WalkieTalkie")
return true
else
print ("Item isnot a WalkieTalkie")
return false
end
end
(I would honestly move all of your functions into a module, and then return it by doing return RadioOneWay at the end of your entire file.)
The code above reduces the amount of work your conditional needs to do, and also has the added benefit of letting modders add their own walkie talkies if they ever want to easily implement compatibility with your mod.
And the check will take the same amount of time for 100 walkie variants as it does for 5.
steal
any vehicle modders able to tell me if a higher steeringClamp value means better or worse steering angle?
did you ever find the answer to this?
no?
tried to make a mower turn in a very tight circle. it didn;'t work
im guessing you stuck with the existing 0.3 or 0.4 values?
It looks like Poltergeist answered a few messages after the one you replied to
Yerrp
A wild Skizot appears.
/me runs away.
It makes a lot of sense, and thank you to explain me the way you did to understand better the traces. I was on that understanding, but didn't know why I got that error. Because it's said that Events.OnPrimaryEquip has (character, item) as arguments. So I don't understand the error. But if I understand what you say, it's because the the function is called 2 times : one time for the unequipped item and then item is nil, and then for the equipped item in which case I will get my item, right ?
When you switch weapons there may be a moment where the event fires with nil. I'm not sure. But regardless you must check to ensure item exists.
Guys, am I blind or there is no "On Cell loaded" event?
the game doesn't load in cells
Uh, so if I want to run event only when a cell is loaded, I have to use LoadGridsquare take note of the cell, and then wait for the a new LoadGridsquare in a different cell?
I'm yet again, trying to implement my destroyed/bombed cities mod, and I want it to happen automatically by having the mod check the count of buildings and zombies in a cell and if the Number of both is high enough, then the mod will assume it's a city, and generate a lot of explosions on it.
you won't really be able to do that, there isn't usually even one entire cell loaded
Well, the zombie population map, shows the buildings and the zombie count, so I assume that by accessing the IsoMetaGrid Buildings variable, I could make it work
oh yes, that might work
local RadioOneWay.walkieTalkies = {
["Base.WalkieTalkie1"] = true,
["Base.WalkieTalkie2"] = true,
["Base.WalkieTalkie3"] = true,
["Base.WalkieTalkie4"] = true,
["Base.WalkieTalkie5"] = true
} [...]
if RadioOneWay.walkieTalkies[item:getName()] then
print("Item is a WalkieTalkie")
return true
Can you explain me how this works ? when you call RadioOneWay.walkieTalkies[item:getName()], you asks to compare item:getName() with each entry of RadioOneWay.walkieTalkies {} ?
Ugh, apparently, I can't access this variable 😦
getWorld():getMetaGrid().Buildings -- retuns `nil`
// from: IsoMetaGrid
public final ArrayList<BuildingDef> Buildings = new ArrayList();
If I'm not mistaken, there should be a way to manually expose fields, right?
i have a library mod that exposes fields https://steamcommunity.com/sharedfiles/filedetails/?id=3001901955
No, you just access the entry corresponding to that item name -- it doesn't get compared against all wrong entries. And the value it returns when it tries that item name will be true if you added it to the table, or nil otherwise.
i don't remember how you do it manually, it's usually done with some weird string manipulation
not nil is truthy. So when I said if not result then return end, it ends the function is the function result is nil.
Also you don't use the word local in front of subfunctions of a local module. Functions of a local module are inherently local.
I realize now you got that from a typo in my code... Fixed that... My bad.
@verbal yew fixed a typo in this
Remove local from the first table and do not forget to declare local RadioOneWay = {} somewhere above that.
Sorry for my limitless ability to typo; it cannot be contained.
What's [...] ?
I'm in the process of completely rewriting the distribution method for Brita's Weapons Pack for use on my own private server. Which will have a separate table to determine firearm's spawning rate. Feel free to let me know what your opinions are on this! If it goes well, I may get in touch with Brita to try to integrate it into the main mod...
id = "FN_57", -- base id of the firearm
type_category = "pistol", -- general categories of the firearm
type_action = "semi", -- type of action of the firearm
type_region = "EUR", -- The region where the weapon originated - and usually the area where it was primarily used.
rarity = 2, -- Adjustment factors affecting their rarity after being affected by sandbox options.
-- 1 = Firearms that are commonly used by individuals, LEO, or MIL. These are usually popular sellers in gun stores, or standard issue weapons for military/police forces.
-- 2 = These types of firearms are more niche for individual gun owners, or are special purpose weapons for LEO/MIL, not generally issued.
-- 3 = Exotic firearms, rarely seen by the public. Such firearms are either expensive customized items or having very particularly unique uses.
-- 4 = At this point, the weapons are either ancient antiques or some prototypes, which developer decided that supposed to be extremly hard to find.
isMIL = true, -- If firearm is used by military forces
isLEO = true, -- If firearm is used by law enforcement agencies
isCIV = true, -- If firearm can be obtained by general public, which is not an NFA item (a machinegun, short-barreled rifle, short-barreled shotgun, or destructive device).
}```
Sorry in what context? @bright fog
... in a function means all the variables that get passed after named ones...
Oh this remembered me of my old util for this, I just need to find it on my github
Whoever you were, thank you for the tags.
Oh yeah I found my old baby code, not the most polished code, but damn it works 😄
-- Remember, this only work with "public" fields, not "private" or "protected"
local function getClassFieldValueByName(classInstance, fieldName)
local cacheKey = tostring(classInstance) .. fieldName
if fieldCache[cacheKey] then
return getClassFieldVal(classInstance, fieldCache[cacheKey])
end
local fieldsCount = getNumClassFields(classInstance)
for i = 0, fieldsCount - 1 do
local field = getClassField(classInstance, i)
if tostring(field):sub(-#fieldName) == fieldName then
fieldCache[cacheKey] = field
return getClassFieldVal(classInstance, field)
end
end
end
local metaGrid = getWorld():getMetaGrid()
local buildings = getClassFieldValueByName(metaGrid, 'Buildings')
MxDebug:print('LoadGridsquare - metaGrid.Buildings', buildings)
-- Prints correct value: [zombie.iso.BuildingDef@5e011ce2, zombie.iso.BuildingDef@1fa51c80, zombie.iso.BuildingDef@74153c4b, zombie.iso.BuildingDef@655ec585, zombie.iso...
Uh, that's interesting, the game already has loaded "6653" buildings 🤔
Can I do :
local RadioOneWay = {}
RadioOneWay.walkieTalkies = {
["Base.WalkieTalkie1"] = true,
["Base.WalkieTalkie2"] = true,
["Base.WalkieTalkie3"] = true,
["Base.WalkieTalkie4"] = true,
["Base.WalkieTalkie5"] = true
}
function RadioOneWay.testIfWalkieTalkie (item)
-stuff here
end
return RadioOneWay
What I mean is can I have in the same module different kind of stuff ?
nice 🙂
You can also write functions in basic variable format (or assignment format or whatever you want to call it):
Module.functionName = function(item)
end```
With this method, do I still need to add a check in the main function :
if not item then return end -- Bingo Bongo.?
Yeah but it's harder for me to read code written like that 🙂
You need that before you ever do anything with item in an OnEquipPrimary event.
You only need that check in the main function because if you guarantee item exists right away then every function you call from there should have an item to handle
ok
how can i update a mod to new game version if i lost the mod files
subscribe to the mod, get the files in your steam folder, copy/paste them ?
i dont need access to the original ones?
Did you ever uploaded the mod on steam workshop ?
At the end of my file is it :
return RadioOneWay
Events.OnEquipPrimary.Add(RadioOneWay.onEquipRadioToggle)
Events.OnEquipSecondary.Add(RadioOneWay.onEquipRadioToggle)
Or the Events before the return ?
returning the module has to be the absolute last thing that happens in the file
ok
And just personal taste that deviates from most vanilla files, I like to add functions to their events right below the definition of the associated function.
So I have to create another file with only the calls ?
(Unless the function needs to be added after file load for some reason)
What I don't get, is when the code is ran by the server if the Call (Events.OnEquipPrimary.Add) is inside the module
Does anyone know where the value of currentPopulation and desiredPopulation are coming from when looking into java\popman\MPDebugInfo.java? I can't seem to find reference to this anywhere else 😦
Eh?
Still when it always happens - adding function to event means call that function when the event happens
Nothing changes
Just need to change the Add call to reflect new full function name
Add(Module.functionName)
It'll work exactly the same way
ok thanks 🙂 I'm a little lost about those modules and how it works exactly, but I trust you. Made the changes, gonna try this now, I'll come back with Stack Traces 😄
I have a side question about walkies & VOIP. What is the 16000 range unit ? tiles ? Because on my server, we got some weird bugs with walkies, when we can't hear each other even if we are inside the range (at least we thought we were). Is there some known issues about that or have I a mod interfere ?
Not an expert on walkies so I can't answer that one easily.
A module is just a Lua table for a related set of data and functionality, which can work as either an indexed or dictionary-style collection of key-value pairs, or both.
Thanks for the explaination 🙂 the second part of your sentence is martian to me, but at least I get the idea 😄
is there no way to hide hair and beard without using the 0 mask?
@thick karma Ok, I got an error. here stack trace and lua file
The error is in this loop. itemInBag is buggy.
-- check in bags
local locationList = {"Back", "FannyPackFront", "FannyPackBack"}
for _,location in pairs(locationList) do
local bag = player:getWornItem(location)
if bag and instanceof(bag, "InventoryContainer") then
local container = bag:getInventory()
for _,itemInBag in pairs(container) do
if RadioOneWay.testIfWalkieTalkie(itemInBag) == true then
print("Radio in backpacks, IsTwoWay = "..item:getDeviceData():getIsTwoWay())
print("Toggle TwoWay to False")
-- Toggle code
item = itemInBag:getDeviceData():setIsTwoWay(false)
print("Result IsTwoWay = "..item:getDeviceData():getIsTwoWay())
end
end
end
end
it's the for loop that doesn't work
is it just :
local itemInBag = bag:getInventory()
for _, itemInBag do
-- the stuff to do
end
``` ?
I don't understand how to cicle through all the items in "bag" to check if it's a walkietalkie.
Does anyone have the api for gun events?
Ala. magazine attachment, attachment attachment
I made a mod item, but what should I do if I want to make it function like a wrench?
Base.Wrench is hardcoded for use on vehicle mechanics. Looking over the ISVehicleMechanics.lua, you need to hook to these functions, or override them completely to add your new item. They could've use a tag and it was simpler.
How i can run my custom mods? I used to put the mods in the mod carpet but It doesnt work anymore
In the code snipet you gave
This ? Nvm you didn't write it in your original
I added a weapon to the file but it doesn't work. if part:getId() == "Engine" and not VehicleUtils.RequiredKeyNotFound(part, self.chr) then
if part:getCondition() > 10 and self.chr:getPerkLevel(Perks.Mechanics) >= part:getVehicle():getScript():getEngineRepairLevel() and (self.chr:getInventory():contains("Wrench") or self.chr:getInventory():contains("KW_MagicWand")) then
option = self.context:addOption(getText("IGUI_TakeEngineParts"), playerObj, ISVehicleMechanics.onTakeEngineParts, part);
self:doMenuTooltip(part, option, "takeengineparts");
else
option = self.context:addOption(getText("IGUI_TakeEngineParts"), nil, nil);
self:doMenuTooltip(part, option, "takeengineparts");
option.notAvailable = true;
end
if part:getCondition() < 100 and self.chr:getInventory():getNumberOfItem("EngineParts", false, true) > 0 and self.chr:getPerkLevel(Perks.Mechanics) >= part:getVehicle():getScript():getEngineRepairLevel() and (self.chr:getInventory():contains("Wrench") or self.chr:getInventory():contains("KW_MagicWand")) then
local option = self.context:addOption(getText("IGUI_RepairEngine"), playerObj, ISVehicleMechanics.onRepairEngine, part);
self:doMenuTooltip(part, option, "repairengine");
else
local option = self.context:addOption(getText("IGUI_RepairEngine"), playerObj, ISVehicleMechanics.onRepairEngine, part);
self:doMenuTooltip(part, option, "repairengine");
option.notAvailable = true;
end
end
Have you changed all the functions that check for Wrench ?
Also you can put the code in a code block like this, using ```:
local test = "";
I just added it to the script settings and ISVehicleMechanics.lua file.
Where can I find and change the wrench check function?
Oh wow, looking further, it's not that easy, you also have to modify the script of each car to accept your wrench as a fixer. And that's not even considering modded cars.
<@&671452400221159444>
❤️

I see now; I think Asilar was just trimming their message in that context. I can see how it looked like it might be code but to my knowledge that is not a thing.
You use pairs with tables; for a Java-based item container, there are other ways to search for what you need. There are many recursive search functions for grabbing stuff from an item container built into the game, so you don't need to write the recursion from scratch, just visit Zomboid Javadoc and figure out which one works.
I think this might return what you're looking for, given the type of the item:
getAllTypeRecurse(String string, ArrayList arrayList)
However there might be a better option that lets you use a search function instead of matching type, which would require fewer loops through inventory to check for the right item.
@violet shell you might want
public ArrayList getAllEvalRecurse(LuaClosure luaClosure)... The lua closure may be referring to a Lua function that can be used to pick items. That would be useful here.
I think whenever you have an eval you need to give a function that outputs true or false
Or some shit like that
That's what I was thinkin
@violet shell What we're saying is the function (the "Lua closure") probably needs to be of the form
function isDesired(item)
(-- pseudocode)
if item:getType() contains "WalkieTalkie" then
return true
end
return false
end
yeah
That's probably something like that
You most likely find examples of it in the base game code
you cannot hear players you haven't been close to in your current session
it's a bug caused by an admittedly pretty vital last minute security change
OK thanks a lot 🙂
@coarse sinew Yeah, wrench checks are still fixed to exact checks throughout the vehicle UI - it doesn't use tags like the other actions. Probably something addressable in B42. There's only two spots that would need to be changed.
Not only in the UI, but also in vehicle parts templates only Base.Wrench is specified
Actually that could be added to the Install and Uninstall tests
@thick karma @bright fog Thanks for your help, I gonna dig with that 🙂
Np
I found this in vanilla code :
containers = ISInventoryPaneContextMenu.getContainers(playerObj)
-- Test with each source as selectedItem
for i=1,containers:size() do
local container = containers:get(i-1)
for j=1,container:getItems():size() do
local item = container:getItems():get(j-1)
if item ~= bag then
local valid = RecipeManager.IsRecipeValid(recipe, playerObj, item, containers)
if not valid then
print(' valid='..tostring(valid)..' with selectedItem='..item:getFullType())
for k=1,#itemText do
print(itemText[k])
end
end
end
end
end
Maybe it can help ?
I don't know what you're trying to do exactly so uh idk
That bug in my code is really driving me mad
I'm trying to check for specific item in all the inventory of the player (inventory, worn bags, equipped bags in hand)
what are you trying to do thats not working? i doubt ill be able to help but who knows
oh uh. isnt that uuuh, shit ive seen that before
I have the same code working in 1 mod and don't in another
-- This one is from my Biocoded injection mod and is working
-- check backpacks/fanny packs
local locationList = {"Back", "FannyPackFront", "FannyPackBack"}
for _,location in pairs(locationList) do
local bag = player:getWornItem(location)
if bag and instanceof(bag, "InventoryContainer") then
local container = bag:getInventory()
container:DoRemoveItem(itemToRemove)
-- code for removing the items (example: container:Remove(item))
end
end
-- this one is from RadioOneWay mod and is not working
-- check backpacks/fanny packs
local locationList = {"Back", "FannyPackFront", "FannyPackBack"}
for _,location in pairs(locationList) do
local bag = player:getWornItem(location)
if bag and instanceof(bag, "InventoryContainer") then
local container = bag:getInventory()
for _,itemInBag in pairs(container) do
if RadioOneWay.testIfWalkieTalkie(itemInBag) == true then
print("Radio in backpacks, IsTwoWay = "..item:getDeviceData():getIsTwoWay())
print("Toggle TwoWay to False")
-- Toggle code
item = itemInBag:getDeviceData():setIsTwoWay(false)
print("Result IsTwoWay = "..item:getDeviceData():getIsTwoWay())
end
end
end
end
in the first code, bag is ok, in the second code, bag is bugged and I get an error
I tried with bag:getInventory() it's buggy, now I'm trying with bag:getItems():get(x) but it's buggy too
here is the last trace :
LOG : General , 1714657462416> 0> [Asilar_RadioOneWayOnBelt] Entering testIfWalkieTalkie
LOG : General , 1714657462416> 0> [Asilar_RadioOneWayOnBelt] Item is not a WalkieTalkie
LOG : General , 1714657462416> 0> [Asilar_RadioOneWayOnBelt] Entering Back loop
LOG : General , 1714657462420> 0> -----------------------------------------
STACK TRACE
-----------------------------------------
function: onEquipRadioToggle -- file: Asilar_RadioOneWayOnBelt_bis.lua line # 52 | MOD: Asilar's OneWay Radio on Belt
Callframe at: setPrimaryHandItem
function: perform -- file: ISEquipWeaponAction.lua line # 146 | Vanilla
ERROR: General , 1714657462422> 0> ExceptionLogger.logException> Exception thrown java.lang.RuntimeException: Object tried to call nil in onEquipRadioToggle at KahluaUtil.fail line:82.```
yaeh so i think if you want to check the players inventory/worn items/bags or wtv, you can use getFirstTypeRecurse, itl find the first item of that ID by checking everything the player has i think
ive never used it before, but i think someone suggested it to me once, and i found by searching it that it checks everything
but it will grab the first type it sees regardless of where it is on you i think
so i think if im not wrong, you dont need to do the check for the specific bags, just use getFirstTypeRecurse
yeah here, thats where ive seen it before
i gotta step out for a bit, good luck!
But with this I only get the first one. I want to check all the items because if there are multiple identical items I want to apply my code on each of it
Did you check the java doc
There's other get in inventory methods
getAllRecurse
ok, but Type of item is it's type=xxx in the item script right ?
item myitem {
type = typeofitem --example = radio
}
Uuhh give me a sec I can find the answer
what I want to check is "myitem"
I don't want to check the type =
so I guess it's name
type usually refers to the internal name of the item script, not the Type field in the script
This is how I find recharges in Susceptible Overhaul
It's the same thing for getAllRecurse
But it outputs an array of item
so in ```item WalkieTalkie1
{
DisplayCategory = Communications,
Type = Radio,
Icon = WalkieTalkieBudget,
Weight = 1.0,
DisplayName = Toys-R-Mine Walkie Talkie,
UseDelta = 0.007,
UseWhileEquipped = FALSE,
DisappearOnUse = FALSE,
TwoWay = TRUE,
TransmitRange = 750,
MicRange = 5,
BaseVolumeRange = 8,
IsPortable = TRUE,
IsTelevision = FALSE,
MinChannel = 75000,
MaxChannel = 150000,
UsesBattery = TRUE,
IsHighTier = FALSE,
WorldObjectSprite = appliances_com_01_16,
Tooltip = Tooltip_item_Radio,
StaticModel = WalkieTalkieToy,
AttachmentType = Walkie,
}```
type is "WalkieTalkie1" ?
Can you show me how you define "inv" ?
Sure
the only exception to this that i know of is on the Item object (not InventoryItem) that is called name and Type = Radio is the type, everywhere else type is WalkieTalkie1
Just get the inventory of the player
ok thanks
so, I can replace the whole @small topaz code with loops and so by player:getInventory():getAllTypeRecurse(typeofwalkie) in a loop where typeofwalkie is cycled throught a table with all the walkies names ?
Yeah
ok thank you very much. Gonna try it now

Can I have just a table with item types in a module ?
Like RadioOneWay.listOfWalkies = {string1, string2, string3} ?
sure
Like that :
RadioOneWay.listOfWalkies = {
"Base.WalkieTalkie1",
"Base.WalkieTalkie2",
"Base.WalkieTalkie3",
"Base.WalkieTalkie4",
"Base.WalkieTalkie5",
"Base.WalkieTalkieMakeShift"
}
also, I know I cannot declare functions local inside a local module, but do I need to declare variable local in a function in a local module ?
yeah
I'm not sure Base. should be used
ok.
this should do the job ?
for _,typeOfWalkie in pairs(RadioOneWay.listOfWalkies) do
print("Entering for loop to test each WalkieTalkie Type")
local walkiesInInventory = player:getInventory():getAllTypeRecurse(typeOfWalkie)
for i=0,walkiesInInventory():getSize() do
walkiesInInventory:get(i) = walkiesInInventory:get(i):getDeviceData():setIsTwoWay(false)
end
If you use the original form I shared, you can just loop through your keys with
for key in pairs(RadioOneWay.walkieTalkies) do, rather than for _, value
But if you use the new way, looping by counting index up from 1 to #RadioOneWay.listOfWalkies would be faster.
but you're array has "= true" so I was not sure it would work
Yes exactly, in the original array the keys are the value you need in the loop you're doing
The loop format for key-value pairs is for key, value in pairs(table)
in my last for loop, for i=0, ... how I ask for the loop to go until all items of the getAllTypeRecurse has?
You're throwing away the key and calling it _ in your new one
getSize() is not the right one
But you could've just used the key
P sure it returns a Java ArrayList so you need :size()
0, result:size() - 1
Would be the required for bounds
Given the result of calling that
the assignment in there is meaningless btw
why "-1" ?
walkiesInInventory:get(i) = walkiesInInventory:get(i):getDeviceData():setIsTwoWay(false) doesn't assign anything
just do walkiesInInventory:get(i):getDeviceData():setIsTwoWay(false)
Because loop proceeds until index is greater than the second value, and the last available value in an array that begins at 0 and has size elements is size - 1.
E.g., 0, 1, 2, 3, 4 would be 5 elements
ok thanks 🙂
for typeOfWalkie in pairs(RadioOneWay.walkieTalkies) do
print("Entering for loop to test each WalkieTalkie Type")
local walkiesInInventory = player:getInventory():getAllTypeRecurse(typeOfWalkie)
for i=0,walkiesInInventory():size()-1 do
walkiesInInventory:get(i):getDeviceData():setIsTwoWay(false)
end
end
``` ?
In normal Lua tables the indexing goes from 1 to size instead of 0 to size - 1, btw. Just so you know.
assuming RadioOneWay.walkieTalkies is the array you gave me yesterday
Yes
Exactly
Did you try getAllEvalRecurse? I feel like that would be a lot faster if your goal is to perform an action on every walkie in your inventory
Your current method would require you to recursively search inv 5+ times instead of once
(not faster to understand and write but faster when the code fires)
I didn't understand what you told me with getAllEvalRecurse, so I tried my own way, with the help of Sir Doggy, MCSlappy & albion. But if you can explain me a little more, I'll change the code without any problem 🙂
I mean whatever works, works. I would have to be on PC to write out an example, and I haven't actually used it so I could be wrong about how it works. Was just curious how far you got in trying it.
Only one of all of these shows up ingame, which could be indicative of the issue i guess (?)
Line 56 is : for i=0,walkiesInInventory():size()-1 do
and line 55 : local walkiesInInventory = player:getInventory():getAllTypeRecurse(typeOfWalkie)
it'd just be something like```lua
-- assuming walkieTalkies is a lookup table like burryaga has suggested:
RadioOneWay.predicateWalkie = function(item)
return RadioOneWay.walkieTalkies[item:getFullType()]
end
local walkiesInInventory = player:getInventory():getAllEvalRecurse(RadioOneWay.predicateWalkie)
for i=0,walkiesInInventory**()**:size()-1 do
the extra ()s there attempts to call walkiesInInventory as a function
so it should be for i=0,walkiesInInventory:size()-1 do ?
for typeOfWalkie in pairs(RadioOneWay.walkieTalkies) do --looks incorrect
for key,value in pairs(RadioOneWay.walkieTalkies) do --looks better
Ehhhh agree to disagree here. First one is correct and therefore also looks correct to me.
They're both objectively correct
how use item in recipe like its should be pot with full water?
personally i'd prefer typeOfWalkie, _ to make the discarding of the value explicit
my bad then 🙂
Fair. Again comes down to writing unnecessary things for me. I would not write , _ for the same reason I never write (unnecessary line-closing) semicolons
i don't think end of line semicolons are justifiable but using them to break up multiple statements on a single line is good practice
though it's often better practice to not try to minimise lines at the expense of readability in the first place
Same reason I wouldn't put placeholder empty variables for find and gsub calls...
well you've got me there
i wouldn't either but pairs feels like a special case to me
Sometimes functions return stuff you don't need and I just don't catch it
If I want to optimize with this, what would be the first argument function "function" and the second argument function "function" ?
i wonder if there's a performance difference
The getAllEvalRecurse only takes one param...
The name of the function in albion's example would go there
See here @violet shell
The "predicate" function
@violet shell https://dcl-prog.stanford.edu/function-predicate.html
This book is a practical introduction to functional programming using the tidyverse.
Just for the definition, link probably has nothing to do with Lua
I mean I have to imagine with endless walkie types there would be, but in this case with only 6 walkie types I'm not 100% sure. It may depend on # items in inventory. misunderstood
oh i meant with using _ to discard
to my knowledge _ is just a convention and does actually assign the value to a variable _
so potentially there is some kind of overhead induced by that assignment
but it's almost definitely next to nothing
Yeah I would expect it to do so, but I have no clue whether overhead of assignment is more time consuming than overhead of throwing away if any such overhead exists
Oh
Ok, so now the code isn't buggy anymore (thanks to you all), but I still ave issues
I tried to equip walkie, but seems it never finds a walkie
should I delete the Base. before the WalkieTalkie in your array ?
as McSlappy suggested ?
RadioOneWay.walkieTalkies = {
["Base.WalkieTalkie1"] = true,
["Base.WalkieTalkie2"] = true,
["Base.WalkieTalkie3"] = true,
["Base.WalkieTalkie4"] = true,
["Base.WalkieTalkie5"] = true,
["Base.WalkieTalkieMakeShift"] = true
}
it looks like it should be Radio.WalkieTalkie...
they're one of the few vanilla things not in the base module
ok 🙂
you're right, radio stuff is in its own module Radio {}
new issues : first trace is equipping a machete, second trace is equipping a walkietalkie5 (military)
line 58 is : print("Selected Item is a WalkieTalkie, IsTwoWay = "..item:getDeviceData():getIsTwoWay())
in the second case, code doesn't recognize the walkietalkie as being one 😦
(Printing stack trace snippet as raw text helps people on phones help you.)
LOG : General , 1714664007158> 228?594?500> [Asilar_RadioOneWayOnBelt] Entering onEquipRadioToggle
LOG : General , 1714664007159> 228?594?500> [Asilar_RadioOneWayOnBelt] Entering testIfWalkieTalkie
LOG : General , 1714664007160> 228?594?501> [Asilar_RadioOneWayOnBelt] Item is not a WalkieTalkie
LOG : General , 1714664007160> 228?594?502> [Asilar_RadioOneWayOnBelt] Equipped Item is not a WalkieTalkie
LOG : General , 1714664007160> 228?594?502> [Asilar_RadioOneWayOnBelt] Entering for loop to test each WalkieTalkie Type
LOG : General , 1714664007167> 228?594?509> [Asilar_RadioOneWayOnBelt] Entering for loop to test each WalkieTalkie Type
LOG : General , 1714664007168> 228?594?510> [Asilar_RadioOneWayOnBelt] Entering for loop to test each WalkieTalkie Type
LOG : General , 1714664007169> 228?594?511> [Asilar_RadioOneWayOnBelt] Entering for loop to test each WalkieTalkie Type
LOG : General , 1714664007170> 228?594?511> [Asilar_RadioOneWayOnBelt] Entering for loop to test each WalkieTalkie Type
LOG : General , 1714664007170> 228?594?512> [Asilar_RadioOneWayOnBelt] Entering the for loop to check every WalkieTalkie found
LOG : General , 1714664007174> 228?594?516> -----------------------------------------
STACK TRACE
function: onEquipRadioToggle -- file: Asilar_RadioOneWayOnBelt_bis.lua line # 58 | MOD: Asilar's OneWay Radio on Belt
Callframe at: setPrimaryHandItem
function: perform -- file: ISEquipWeaponAction.lua line # 146 | Vanilla
ERROR: General , 1714664007176> 228?594?518> ExceptionLogger.logException> Exception thrown java.lang.RuntimeException: Object tried to call nil in onEquipRadioToggle at KahluaUtil.fail line:82.
ERROR: General , 1714664007177> 228?594?518> DebugLogStream.printException> Stack trace:
java.lang.RuntimeException: Object tried to call nil in onEquipRadioToggle
first trace
it seems that local walkiesInInventory = player:getInventory():getAllTypeRecurse(typeOfWalkie) doesn't return only the walkies ?
I thought you switched to eval
maybe we're in the corner case @bronze yoke mentionned earlier about Type for Radio objects
no not yet sorry
this
current "state" ? Should I print more stuff ?
I set this thing's range to 7
but is still targeting from miles away
This is range 7 on the js2000 for comparison
I mean what the function currently looks like
With your latest edits
What else can affect weapon range?
function RadioOneWay.onEquipRadioToggle(player, item)
if not item then return end
print("Entering onEquipRadioToggle")
-- Check if radio is being equipped
if RadioOneWay.testIfWalkieTalkie(item) == true then
-- Toggle code
print("Equipped Item is a WalkieTalkie, IsTwoWay = "..item:getDeviceData():getIsTwoWay())
print("Toggle TwoWay to True")
item:getDeviceData():setIsTwoWay(true)
print("Result IsTwoWay = "..item:getDeviceData():getIsTwoWay())
-- if it's not a radio then we set radios in inventory to OneWay only
else
print("Equipped Item is not a WalkieTalkie")
for typeOfWalkie in pairs(RadioOneWay.walkieTalkies) do
print("Entering for loop to test each WalkieTalkie Type")
local walkiesInInventory = player:getInventory():getAllTypeRecurse(typeOfWalkie)
for i=0,walkiesInInventory:size()-1 do
print("Entering the for loop to check every WalkieTalkie found")
print("Selected Item is a WalkieTalkie, IsTwoWay = "..item:getDeviceData():getIsTwoWay())
print("Toggle TwoWay to False")
walkiesInInventory:get(i):getDeviceData():setIsTwoWay(false)
print("Result IsTwoWay = "..item:getDeviceData():getIsTwoWay())
end
end
end
end
RadioOneWay.walkieTalkies = {
["Radio.WalkieTalkie1"] = true,
["Radio.WalkieTalkie2"] = true,
["Radio.WalkieTalkie3"] = true,
["Radio.WalkieTalkie4"] = true,
["Radio.WalkieTalkie5"] = true,
["Radio.WalkieTalkieMakeShift"] = true
}
function RadioOneWay.testIfWalkieTalkie(item)
print("Entering testIfWalkieTalkie")
if RadioOneWay.walkieTalkies[item:getName()] then
print("Item is a WalkieTalkie")
return true
else
print ("Item is not a WalkieTalkie")
return false
end
end
maybe I should write :
function RadioOneWay.testIfWalkieTalkie(item)
if RadioOneWay.walkieTalkies[item:getType()] then...
``` ?
seems that it enters the for loop even if there's no walkietalkie :
for typeOfWalkie in pairs(RadioOneWay.walkieTalkies) do
print("Entering for loop to test each WalkieTalkie Type")
local walkiesInInventory = player:getInventory():getAllTypeRecurse(typeOfWalkie)
for i=0,walkiesInInventory:size()-1 do
print("Entering the for loop to check every WalkieTalkie found")
print("Selected Item is a WalkieTalkie, IsTwoWay = "..item:getDeviceData():getIsTwoWay())
print("Toggle TwoWay to False")
walkiesInInventory:get(i):getDeviceData():setIsTwoWay(false)
print("Result IsTwoWay = "..item:getDeviceData():getIsTwoWay())
end
end
for some reason no matter what value I change this shotgun's fire-rate is always the same and the range too
here it the new stack trace :
LOG : General , 1714665024415> 229?611?381> [Asilar_RadioOneWayOnBelt] Entering testIfWalkieTalkie
LOG : General , 1714665024415> 229?611?382> [Asilar_RadioOneWayOnBelt] Item is not a WalkieTalkie
LOG : General , 1714665024416> 229?611?382> [Asilar_RadioOneWayOnBelt] Equipped Item is not a WalkieTalkie
LOG : General , 1714665024416> 229?611?382> [Asilar_RadioOneWayOnBelt] Entering for loop to test each WalkieTalkie Type
LOG : General , 1714665024416> 229?611?383> [Asilar_RadioOneWayOnBelt] Entering for loop to test each WalkieTalkie Type
LOG : General , 1714665024417> 229?611?383> [Asilar_RadioOneWayOnBelt] Entering for loop to test each WalkieTalkie Type
LOG : General , 1714665024417> 229?611?383> [Asilar_RadioOneWayOnBelt] Entering for loop to test each WalkieTalkie Type
LOG : General , 1714665024417> 229?611?383> [Asilar_RadioOneWayOnBelt] Entering for loop to test each WalkieTalkie Type
LOG : General , 1714665024418> 229?611?384> [Asilar_RadioOneWayOnBelt] Entering the for loop to check every WalkieTalkie found
ERROR: General , 1714665024418> 229?611?385> ExceptionLogger.logException> Exception thrown java.lang.RuntimeException: __concat not defined for operands: Selected Item is a WalkieTalkie, IsTwoWay = and true at KahluaUtil.fail line:82.
ERROR: General , 1714665024419> 229?611?385> DebugLogStream.printException> Stack trace:
java.lang.RuntimeException: __concat not defined for operands: Selected Item is a WalkieTalkie, IsTwoWay = and true```
Stack trace:
java.lang.RuntimeException: __concat not defined for operands: Selected Item is a WalkieTalkie, IsTwoWay = and true
ok, so I added a new variable twoWayState and assign "True" or "False" with a if/else check. And I call it in my print prompts instead of item:...
Why does SetMaxDamage or SetMinDamage etc not work for melee weapons on MP? It simply reset back to default.
do you have simple weapons overhaul? (cant remember its exact name)
that mod reverts weapons back to default onswing or something
I will check that out. Thanks.
this one
if you have it installed thats probably why its happening. took me a bit to figure that one out XD. giving it a tag stops that from happening though
@thick karma Ok, fixed last errors. Now I have a functionnal module. Last problem : the function you wrote to test if the item equipped is a walkietalkie doesn't work as intended.
function RadioOneWay.testIfWalkieTalkie(item)
print("Entering testIfWalkieTalkie")
if RadioOneWay.walkieTalkies[item:getType()] then
print("Item is a WalkieTalkie")
return true
else
print ("Item is not a WalkieTalkie")
return false
end
end
``` always return false.
and ```lua
RadioOneWay.walkieTalkies = {
["Radio.WalkieTalkie1"] = true,
["Radio.WalkieTalkie2"] = true,
["Radio.WalkieTalkie3"] = true,
["Radio.WalkieTalkie4"] = true,
["Radio.WalkieTalkie5"] = true,
["Radio.WalkieTalkieMakeShift"] = true
}
it should be getFullType()
ok thanks 🙂 trying that !
getType() would return e.g. WalkieTalkie1, getFullType is Radio.WalkieTalkie1
damn, I just think about something ! If I have a mod installed that override walkietalkies, then the FullType would change right ?
or it's still Radio.blabla ?
it'd still be Radio
ok (I have visible talkies installed and running)
<@&671452400221159444> did I made a mistake in my last message ? It got erased or i'm going mad ?
If you DM me what you said I can guess whether it would have been deleted according to the rules here. Sometimes it's just lag, or an overzealous bot.
Is there anywhere I can reference the titles of loot tables?
or, more accurately, distribution tables?
ProceduralDistribution[s].lua
I can't remember if there is an s, but I think not.
Search ProjectZomboid/media/lua for it
Thanks!
I just said that the mod was working, and thanked you and the other people here who helped me a lot to have it done. And also mentionned that I added a line in my lua file to say that too. Is it against the rules ?
also, I cannot have the permission image from TIS in the mod workshop page... any idea ?
https://steamcommunity.com/sharedfiles/filedetails/?id=3235454143
Yes never thank us, ever
Nah just kidding it sounds like maybe a bot flagged your code
uh
Hard to say
I tagged the 4 of you (albion, burryaga, Sir Doggy & McSlappy), so maybe it was too much ?
perhaps
What's your bbcode ?
[url=https://theindiestone.com/forums/index.php/topic/2530-mod-permissions/?p=36478][img] https://i.imgur.com/l9ciVMC.png[/img][/url]
I have had code flagged and been auto-timed out before when trying to post my ini and tell Discord using ```ini
Probably the image is the issue
The link to the image
Use the one I sent
Thanks, I don't understand why TIS image link is not working 🙂
I have no idea how Steam retrieves the image ngl so hard to say
also, to clarify why I'm on Ask for Permittion : I have no issue about people using my code, but I would like to be aware of. Thanks a lot.
Join the modding Discord if you haven't yet, we have a bunch of link ressources like these
Fair
I didn't want to seem harsh as this mod would not has been working without you all, but I just prefer to know if it's used elswhere.
link in PM ?
give me a sec
We have a reupload tracker too
here
Also since we are not getting any major updates on all the new stuff coming to B42 it seems like they are in the polishing phase
What ?
anyone know why the class
// Compiled from "VehiclesDB2.java"
class zombie.vehicles.VehiclesDB2$SQLStore {
/* redacted */
private java.lang.String searchPathForSqliteLib(java.lang.String);
/* redacted */
}
Defines the searchPathForSqliteLib function?
The relevant decompiled file would be
zombie/vehicles/VehiclesDB2.java
And the relevant class file is
zombie/vehicles/VehiclesDB2$SQLStore.class
It seems like a complete embed/reuse of the same code from:
// Compiled from "PZSQLUtils.java"
class zombie.utils.PZSQLUtils {
/* [redacted] */
private static java.lang.String searchPathForSqliteLib(java.lang.String);
/* [redacted] */
}
Except the vehiclesDB2 version lacks the static qualifier. Decompiled code appears to be exactly the same.
Is it like a bytecode optimization by the java compiler used with Zomboid, to mixin the static method from the PZSQLUtils code?
Vehicles version not being used in the decompiled code I have at hand, I have no better guess than yours.
Is there a mod that allows you to count the distance between two points on the map?
Me slowly learning Lua so I can try my hand at mod making every time I encounter some weird quirk that I've never seen in any other programming or scripting language I've worked with
p sure you can do this in debug if it's just for testing or mapmaking purposes. Not aware of any mod that just puts it into normal gameplay tho
I haven't found a way to do this in debug 😦
Next time I'm in there if I think of it I'll look, p sure I found it before.
It's not like, literally just "Click tile, it's this far away" but it does let you ultimately get the distance between two points
Anyone have a recommended IDE for Lua?
very new to it
(stg if one of you says Vim)

Yeah saw a few recs for that on reddit too. Sounds like for most people that's all that's worth looking at
Visual Studio Code
Hello, I am creating a mod for servers, since some mods do not work correctly and I am getting to work today. I already have my first tests. But I would like to show a message to a player when he connects to the server. I've used getPlayer():say(), but I've been searching all afternoon to see if there is a method, or another function, to display a notice to the player above their head, for informational purposes. I hope you can help me. Thank you
This is so true 😭😭
From my conversation with my ex-dev bestie
Ya keywords in Lua like python more than C
It definitely messes with you coming from any other lang
That would explain the popularity.
I never learned Python but if Lua is like Python I get why Lua is popular
It's decently lightweight and easy to integrate with most lang
Does anyone know how to get the type of building from java\iso\BuildingDef.java or java\iso\areas\IsoBuilding.java I can't seem to figure out how to differentiate between, industrial, residential, and police/firestation buildings.
I know that IsoBuilding -> isResidential uses this.containsRoom("bedroom") to check if a building is residential, but it's not enough
I'm doing lua mod, but I still need to look into the Java for it
It's a module of my destroyed building and cities mod. And for now it can read the complete list of building in PZ, and using some math stuff that I barelly understand myself it makes clusters, and with these clusters I can make an educated guess checking if it's a city or not. And for now it's quite good.
But I noticed how this code tends to confuse the "mobile home parks" for actual cities/town, which is kinda annoying but I can figure something out
Hey @gilded hawk
Hey Jab
That sounds interesting, I should give it a look once i'm done with this project
ooooh yeah I fixed it
It now detects towns correctly 😄
I see this as a great success, it's bed time then
Nice. Have a good evening.
I am SO FUCKING GLAD that you posed screenshots
You just showed me klogg and it saves my brain trying to read log files 😄
Hi, I'm making mod tools for the first time with the help of Chatgpt because I didn't learn how to code, and I set up the items with scrap. I want to make it a mod tool that can function as all the tools used for car maintenance. Can you tell me which files to modify and which files to add?
Hello guys, i wanna create custom faction flags.
Home Canned-Meat in process
web engine when ❓
not surprised hah
when I got unban btw?
It's possible but how much impact would it have in a period of time when compared to a tool that scans the lua codebase and discovers types & allows me to human-document code?
you*
ah, fine then
I came back after my brain surgery and am recovering.
brain surgery? what a shit
Having a very good recovery so far.
I blame it on Lua.
PZ modding put a rock in my brain lol
happy to hear
xddd
any advice on why my modded distributions file isn't working? The mod ID and item name are correct, but the item is not showing up in the containers it should be. It looks like the spawning rolls are happening correctly, but whenever it's the Silly Drink's turn to be spawned nothing gets added to the container.
Is that a modded container ? If not you are replacing the entire vendingpop container
You need to insert in the table your values with table.insert()
isn't that only for proceduraldistributions? this is the curated distributions file
but I will try that and report back 👍
Same thing, it's a table
yeah makes perfect sense
I'm completely new to Lua lol so figuring out as I go
thanks for the advice :)
ah yeah I should have done that lol
Thanks.
I'm working on a reference dictionary and reference <-> assignment mapping for spreading types around the code.
coooool
It digs through all code, not just surface.
oh, even better then
re: this, my code looks like this now
but I'm still getting the same issue where the item is not actually appearing in the containers whenever it rolls.
The chance is set to 100%, so ideally it should be showing up in just about every pop vending machine, but they're all coming up empty, like the silly drink is being rolled but just not appearing.
Kind of at a loss, I feel like the issue is likely with the item naming scheme but everything seems right to me
worth noting the item itself works fine when I spawn it in with debug, it's just not appearing in containers
here's the item code
and here's mod.info
Module is SillyDrink, not TSN, so in distro table would be SillyDrink.SillyDrink
oh ok so it's the module not the mod ID
Yup
thanks a bunch gonna try that now
it worked perfectly 👍 gonna fix everything else tomorrow since I need to go to bed it's 5am here
thanks again for the help
The 100 doesn't mean 100%
you're missing a comma at the end of the PoisonPower line
jab's plugin might
Depends what kind of SFX we're talking about

If it's FMOD handled SFX, requires manual installation from players
I want to change the hit sound of the frying pan
oh
Check in the script file with the frying pan melee weapon
and how do I make it a mod? so I can upload it on workshop
perhaps the link is not too stupid
https://pzwiki.net/wiki/Mod_structure
almost all sounds are in the bank files, what matters is if it's triggered through a sound script
But first thing I would suggest is find a mod that modifies an item stats/information and look how they do it

I'm trying to make it so that the newly created mod item can be used in place of all the tools for vehicle maintenance, but I don't know what's wrong, but it keeps saying that a wrench is needed to remove the engine. Please help. The code is like this.
Might wanna share the icon files and the item defs.
Looks like you're trying to run code that is intended to happen within a function independent of any function, and outside of that context part will be nil so none of your code will happen
@thick karmaSo how can we make the newly created item function as a full vehicle maintenance tool?
Also I would drop personally drop IS from the custom module name because I don't work for Indie Stone. I am guessing you don't, either. I would rewrite top line as
local VehicleMechanicsOverride = {}
and refactor appropriately.
Honestly, MagicMechanicsWand or just MagicWand might be even better options, depending on the purpose of the mod.
Assuming it's possible (which I haven't confirmed), there will be a function somewhere in vanilla that determines whether you have the necessary tools for the job, and you need to decorate that function.
I will try my best to search first. Thank you.
If you can find the function that checks whether you have the right tools I can tell you how to decorate it
It'll presumably check whether you have a wrench somehow
If you want your tool to work as a wrench in EVERY situation, I think you might need to decorate functions that check what items a player has in those various situations
And whenever you detect those functions are checking whether player has a wrench, you return true if they have a wrench or your tool
Alternatively perhaps there's a way I don't know about to flag an item as a version of another
I see part of your issue... You're trying to decorate a vanilla function called isToolAvailable right?
Can you share that function
I haven't learned coding, so I'm just making questions in chat gpt, so I can't figure out what the problem is.
For what it's worth, learning to program a bit will help you learn to use ChatGPT more effectively to fill in the gaps
My friend who was in charge of coding didn't work hard, so I'm trying to make it myself, but it's difficult.
I would recommend studying some fundamentals the old fashioned way - studying something a human wrote to help another human
I think I should take this opportunity to learn.
The first thing you probably need to do is find the function named isToolAvailable if that exists
The original from vanilla files
They're in the ProjectZomboid game directory
I'm looking into it now, but it seems difficult because I don't have any knowledge. I think it's right to study more and then come back and ask questions.
In ProjectZomboid/media you can search for the function using Windows file explorer if you just index that folder to allow searching text of Lua files.
That's how we find functions or other data in Lua and script files to begin reading and understanding them
For Java stuff, you need to decompile the game, but hopefully that won't be required here
I searched for isToolAvailable using the explorer, but nothing came up.
Did you index the media folder to allow searching file text?
That is an important first step or this won't work
Google or ask ChatGPT how to index a folder to allow searching the file text of selected filetypes
If you don't know how
It's a common need
@winged stirrup I'm guessing you are working on indexing. If you index ProjectZomboid/media and it still doesn't work, let me know. Should be somewhere in your Steam apps
When I searched on chatgpt, it said to do it with Python, so I installed it, but it was too difficult... Can I study more later and post the question again?
lol ChatGPT is not giving smart suggestions
Google "indexing a folder on Windows" and you'll get much better advice.
Python is not required here at all.
Here's a simple one.
This covers Windows 11 with screenshots. Almost the same process: https://www.elevenforum.com/t/add-or-remove-search-index-locations-in-windows-11.2966/
This tutorial will show you how to add or remove locations to be excluded or included in the search index in Windows 11.
Indexing the content of your PC helps you get faster results when your searching it for files, emails, or other local content.
The search index only includes your selected...
just want to ask if theres a mod that makes a buildable ramp that has a switch to put it up and down hehe
Okay I looked for you on my PC, and just to save you trouble, isToolAvailable does not exist. Maybe your friend was working on creating such a function. Determining whether you have the tool in ISVehicleMechanics is done by calling self.chr:getInventory():contains("Wrench")
@winged stirrup Which means as I said earlier you might want to decorate contains itself.
Will it work if I edit all the places containing self.chr:getInventory():contains("Wrench")?
Alternatively, you could decorate every single function that checks for whether you have a wrench to fire alternative behavior based on presence of your tool
That'll be a bit more complex, but it'll have the benefit of correctly showing your tool name.
Is there a chance that it will work if I edit everything where self.chr:getInventory():contains is so that it can work in all tools?
If you decorate contains you could lie to the game so that whenever Lua checks whether you have a wrench, it says yes if you at least have your magic wand.
However, decorating contains would not report the correct item being used because the menu creates an item of type Wrench used to get the wrench's display name.
You would need to decorate all the actual functions that reference a wrench to do handle display names properly.
It's a harder task than I thought. I guess I'll have to get my friend to do the work half-heartedly.
I recommend patience if you have someone who is willing to try to solve it. The job is a bit of a headache, and, as you may have learned today, there are often extremely time-consuming periods of analysis, study, and planning before any code is written to begin solving a complex problem. I can say at a glance that optimally handling this situation in every imaginable context might be a headache. I just browsed around the file to find references to "Wrench" and found many.
Most of not all of them may have to be explicitly modded to make the mod's item tell players when it's being used in any relevant menu.
As well as to make the item usable on the first place, of course.
Also, just in case you're actively trying to get him to solve this faster, I would caution that hurrying or expressing impatience with people will often only slow them down. Patience, gratitude, and encouragement are going to be much better bets if your goal is to see the job done as quickly as possible.
I'll try to solve it slowly. Thank you for letting me know a lot
I have a question about 1 server option :
RedistributeHours = 12.0, -- The number of hours that must pass before zombies migrate to empty parts of the same cell. Minimum = 0.0 Maximum = 8760.0 Default = 12.0
Does anyone can explain me how it works ? On our server we would like that zombies migrate less because with our server options the countryside/wilderness seems a little to much populated, we would like to reduce the migration of the Zeds to have a bigger difference between urban & wilderness zones. (And yes, I am already in Urban settting).
Maybe there's a mod that allows to tweak the migration system ?
This wouldn't help control where you find zeds, but to make them stay longer where they are, you increase that number.
ok, is there a way to have better control on how they migrate ? Like a mod that has been made already ? Or some other options I should investigate/consider ?
Aside from determining whether they're spread out or concentrated in urban areas, not too my knowledge
I tried to find a mod just now and couldn't
yeah same 🙂
I'm so used to using visual studio's error highlights as a crutch this stuff is so easy for me to miss lol
dont suppose i could get some help, im developing a mod with a friend and we keep having the same issue with our weapons that they are invisable
i made each weapon myself in blender (two of them are literally just reskins but also increasing the metalness value to make them shiny)
i cant figure out for the life of me whats wrong
oop posted in the wrong channel, my bad
No, this is actually the right channel.
It's just that no one who has the ability to help and the time to do so has seen your question yet.
Mod support is for getting other people's existing mods to work
This is where questions about making your own mod belong
I can't tell you about properly exporting new weapons but I would recommend you share your script files for the items.
So people can review them for mistakes
give me a moment
Maybe post a model that is showing as invisible in #modeling and ask there if everyone thinks the model seems ready for PZ
if your talking about tri count and all of that ive made sure thats not an issue
everything is well below the limit
and all on one UV map too
i posted some screenshots, the two golden ones are just reskins that have also have had their "metalness" value increased so they are shiny
I'm not talking about anything specific because I don't make weapons. I'm just speaking from a perspective of strategic problem solving. If other guns from other mods and vanilla itself are perfectly visible and only yours are not, that suggests you have a mistake in your scripts or a mistake in your model or other relevant mod files.
im sure that its not a coding error and is intead a blender issue as the person im making the mod with is very adept at modding while im fairly fresh in terms of blender
ahh ok
got it
And posting them will give people a chance to review what you made to confirm end result is exactly as it should be.
I have no way of knowing exactly where you went wrong
got it! thank you very much
Just helping you get help faster
im trying to find those mod files for you but finding them on mac is a pain lol
Is there any dev tool that helps with finding the correct values for rotation and offset for static items?
I want to make a sheath and attach it to the thigh bone. Do I really have to simply put in random numbers into the model script and hope they're close, then adjust them by trial and error, having to reload the game each time?
Is there a debug option/menu to set how much erosion does a building have?
I need to replicate how PZ applies the "overlay_grime_X_X" and "d_wallcracks_X_X" to building walls 👀
6 month later mod + chunk debugger ?
6 month later mod?
Do you mean an actual mod, or the preset?
I mixed: 10 years later mod
I am looking at the old version, and and it does not seem to help, all the sprites are hard coded 😦 So, I does not help me understrand how the game places it's sprites
I will look at the new version too 🤷♂️
Ah yes. Sublime, my beloved.
Sorry no, I was busy with GF, and I'm now focusing again on this destroyed building mode
It's vscode with sublime theme 😄
All in good time.
Only a real programmer knows..
xD
I'm making progress btw on my lua wizard code.
NIIIIIIIICE!
I'm already discovering basic relationships between calls and assignments and spreading types.
I'm applying logical relational stuff with how Lua executes code to discover and provide types for variables.
If I do properly implement this the way I'm doing right now, I can even apply types to inner-function variables, including if clauses and even evaluations for those code blocks.
I'm also compiling type information for the Java API.
That's how PipeWrench works.
(And how Umbrella's Java API, "Candle" works)
I can take that code and apply it to this project as well.
=)
Very very nice!
In the meantime, I'm here trying to figure out what kind of black magic is happening here
public void init() {
for(int var1 = 0; var1 < 100; ++var1) {
this.spawnChance[var1] = var1 <= 50 ? 100 : 0;
}
String var7 = "d_wallcracks_1_";
int[] var2 = new int[]{2, 2, 2, 1, 1, 1, 0, 0, 0};
int var3;
for(var3 = 0; var3 < 3; ++var3) {
this.objsRef.add(new ArrayList());
this.topRef.add(new ArrayList());
this.botRef.add(new ArrayList());
}
for(var3 = 0; var3 < var2.length; ++var3) {
for(int var4 = 0; var4 <= 7; ++var4) {
int var5 = var4 * 9 + var3;
ErosionObjOverlaySprites var6 = new ErosionObjOverlaySprites(1, "WallCracks");
var6.setSprite(0, var7 + var5, 0);
this.objs.add(new ErosionObjOverlay(var6, 60, true));
((ArrayList)this.objsRef.get(var2[var3])).add(this.objs.size() - 1);
if (var4 == 0) {
((ArrayList)this.botRef.get(var2[var3])).add(this.objs.size() - 1);
} else if (var4 == 1) {
((ArrayList)this.topRef.get(var2[var3])).add(this.objs.size() - 1);
}
}
}
}
Like, i'm just trying to understand how the game picks a d_wallcracks_1_X depending on the direction of the sprite 🤷♂️
Classic decompiled code from fernflower.
int-arrays being put into arraylists.
lol
It looks like sprite IDs are being mapped to strings as arraylists?
Clean up this code. The generics are making it look crazier than it is.
That will help.
i'll be honest, when i saw your question i took a quick look at the erosion code to see if i could help and went NOPE
Absolutely reletable
@gilded hawk class and method pls
java\erosion\categories\WallCracks.java init
Used in java\erosion\ErosionRegions.java
@bronze yoke We good now. I renamed all the vars in 4 classes for em.
Also reversed / reapplied generics.
Sprites works in int spriteID, int season, and int evolution?
We are still in the dark, but a bit more readable
Im suspecting the game has a funny way of setting wall vines, and wall cracks
Looks like, each sprite is not just a single direction, but multiple?
insert big question mark here
I used ClearAllDistributionItems on SuburbsDistributions, Distributions, ProceduralDistributions and VehicleDistrbutions, but now I would like loot to generate. I set day length to 15 minutes and loot respawn to 1 hour to try and generate loot in unvisited chunks but it doesn't appear to be generating loot. Is there a way to re-populate the distributions I cleared with the default vanilla distribution information?
Hello all. I was wondering if anyone knew how to get the total size X/Y of a property, possibly using getBuilding or something similiar?
For reference, I am trying to make the Claim Safehouse context popup check for the size of the property before giving the option to claim. If that helps anyone decipher my issue
local buildingDef = clickedSquare:getBuilding():getDef();
if buildingDef then
local h, w = buildingDef:getH(), buildingDef:getW();
end
Thank you very much!
@coarse sinew Thanks again for your help! I thought I'd share a simple function to help people figure out the first floor square footage of a building. Need to figure out how to determine how many levels a home has now.
function CheckSafehouseSize(worldobjects, square, player)
-- Check if player is in a building
if not getPlayer():getSquare():getBuilding()
then
return
end
-- Get building definition
local buildingDef = getPlayer():getSquare():getBuilding():getDef();
if buildingDef == nil
then
return
end
if buildingDef
then
local buildingHeight = buildingDef:getH();
local buildingWidth = buildingDef:getW();
print ("Safehouse Coordinates: ", buildingDef:getX(), " ", buildingDef:getY())
print ("Running Safehouse Size Check...")
print ("Safehouse Size is: ", buildingWidth, " Wide -- ", buildingHeight, " Tall")
print ("Safehouse Sq Footage: ", (buildingHeight * buildingWidth * 9))
end
end
I made a new weapon, a knife to be exact, and it works in all ways intended - just it doesn't render when placed on the ground.
It renders in hand, but not on the ground.
Is that a common mistake among programmers? I have double checked everything from the code, cross-referenced with other mods and it still doesn't work.
model SWCM_Wolf_Knife
{
mesh = weapons/1handed/SWCM_Wolf_Knife,
attachment world
{
offset: x y z
rotation: x y z
}
}```
For my tools & blades mod I didn't even give them that attachment world stat at all, and they render in just nicely.
For example my Bush Machete is just
model MacheteBush
{
mesh = weapons/1handed/MacheteBush,
}
Then again, I made sure that my melee weapons had the exact same "starting point" as the vanilla PZ weapons do
Good morning guys! 🍻
Is there a way to spawn a specific VHS tape via code without using admin perms ingame?
I can spawn generic 'VHS_Retail' or 'VHS_Home' but they aren't actual usable tapes. And I can't find a naming convention for specific tapes as it were before 41.66.
anyone know which version of Kahlua PZ uses?
https://github.com/krka/kahlua2 as implied by se.krka.kahlua2 hasn't been updated in 11 years.
https://github.com/yanmingsohu/kahlua2 has been updated as of 7 months ago and uses the same directory structure as the above (as it's a fork, so you can use git to manage both)
https://github.com/ProjectSky/PZ-kahlua seems to try to archive a version of kahlua used in PZ but completely messes with the structure of everything and was last updated 7 years ago.
Anyway I'm having a wonderful time of it trying to get any of the three to build.
The versioning substitution rule as set forth in line 90 of kahlua's build.xml appears to not have been respected:
<?xml version="1.0" encoding="UTF-8"?>
<project name="Kahlua" basedir="." default="all">
<!-- stuff -->
<target name="compile-core" depends="setup">
<!-- stuff -->
<replace dir="${build.dir}/core-src-replaced" replacefilterfile="version.properties">
<!-- stuff -->
</target>
<!-- stuff -->
</project>
where version.properties is:
lua.version=5.1
kahlua.major=2
kahlua.minor=1
kahlua.fix=0
(see https://ant.apache.org/manual/Tasks/replace.html)
should have replaced the version information in se.krka.kahlua.Version but that contains:
Kahlua kahlua.major.kahlua.minor.kahlua.fix for Lua lua.version as its VERSION
Which implies it never was replaced, either due to mistakes in the build configuration or in the things done to incorporate kahlua into pz's code since.
I guess I could decompile pz's library code and compare it with the different publicly available versions of kahlua that are available. If there were to be any major differences.
The whole impetus to this was to be able to run a repl for the underlying lua implementation without running the game.
Honestly though I could just save myself a headache and load the exact version of kahlua shipped with zomboid by compiling something to load the same compiled .class es for it from the zomboid game folder zomboid does. Or bite the bullet and test everything from inside the game. But the lua global namespace is extremely populated in-game so I was trying to avoid it.
I see. That is confusing.. I'm unsure if my weapon doesn't have the same starting point - I had to at least rotate it to ensure it was in the right direction.
I'll look into it, thank you
Hi all, i was wondering if anyone could take a quick look at my scripts for some custom weapons ive added?
they show up in the crafting menu but when equiped the model is invisable
meaning im killing zombies with nothing
it's not a pure copy, it has been modified for pz, but it is forked from the first repo you posted
these are all the scripts im using
i don't know the full extent of the changes but some frustrating consequences are that pcall and the entire coroutine library don't work, despite still being provided
or would it be easier to send you the link to the mod instead?
Do you have the textures in the right folders for your new stuff?
thank you so much for your replies!!
That makes sense. If anything I was trying to build the last published version of Kahlua to see if they ever had things like that working
I believe so. I’m still extremely new to modding
Most of the work went into making the models
WeaponSprite=SawBat
So your texture has to be named SawBat too.
At least that's how I got my tools & blades to render in properly
Yep. It’s named SawBat
I’ve double checked the names and they are all correct
Let me grab the link for the mod. That will be easier
Weird. That's how I got my stuff to work.
But for my firearms mod I had to have the texture line for the new stuff too.
Like so:
model Glock17
{
mesh = weapons/firearm/Glock17,
texture = weapons/firearm/Glock17,
attachment muzzle
{
offset = 0.0000 0.1386 00.264,
rotate = -90.0000 0.000 -180.0000,
}
}
unfortunatly that didnt work, is it possible someone can take a look at the entire mod and see where im going wrong?
Hey I'm new to making mods, but I got this idea to make a tinnitus trait joke mod where a tinnitus sound loops all the time. If someone could help me, or link a good video I'd be thankful
You could combine the info in my trait mod tutorial with the info in True Music Jukebox for playing a sound when another one ends.
doesnt isLooped = true play the sound indefinitely?
a good aproach would be to make a new trait that gives like +5 points and then check with OnCreatePlayer Event if player has that trait
i think it gets fired everytime a player loads in right?
could you link the tutorial?
Pinged into a thread
thanks!
Yeah this is the way the tutorial will tell you to init relevant trait variables
cant give 0 points or else it will be hidden
maybe in b42 they'll allow it to have stuff cost 0 points
That would be cool, but, for now, you can always make the trait unselectable and grant it for free by different means.
Honestly, upon further reflection, I'm surprised nobody has ever made a free traits mod for the character selection screen
it's just the work needed to utility gap
Fair
Out of curiosity what happens when you try creating a trait with 0 cost? Does the game store it as existing, or throw an error?
Or refuse to add it?
Oh I missed "or it will be hidden"
Guessing that
My bad
By hidden, you mean it can't be selected at creation, right?
i don't think i recall it being hidden but i don't remember clearly
i feel like it just showed up in positive traits or something
Hey
for some reason im playing with some mods and i cant seem to open close doors or interact with some stuff
Hmmm I'll try it later for giggles
example when i try to open a door its red
and i cant equip weapons and such
but some friends that joined the server CAN play properly
what do i do?
I think you seem to be looking for #mod_support - but if I had to guess, the door is locked and someone else has the key? Idk.
happens with all doors also sorry wrong channel
I think it should act like the hotwiring trait
Are you sure that's not hidden because it's profession-locked?
Because that definitely hides traits if you don't have the right profession.
@neon bronze
Am i stupid?
But i seemed to recall thats how it worked
Trying to reconcile what you're saying with what albion is saying
I remember someone saying that if you set a trait to 0 it would act as hidden but it could also be profession bound
If they saw a trait from vanilla that was both profession locked and free, it would be a reasonable mistake to think it was because it was free, if indeed that is a mistake (albion has a pretty solid track record when it comes to being right about these things)
Lisan Al Ghaib that she is, she probably is in the right on this one
i only have a vague recollection of this messing with it once a long time ago
do the GUID for clothing have to be hexadecimal? or does that not matter?
There is guid generator online for that
technically no but it is conventional
yeah i know, i was just naming my stuff by replacing the first part of the GUID. like Helm-Full01-4071-ad87-9abaa761dca9. but then read someone that it had to be hexadecimal, but i thought i say mods that used similar naming to what i was doing but couldnt find it again. so was just making sure
conventional to avoid conflicts or is there another reason? cuz ive named all my stuff like i mentioned above. so wana know if i should go back and redo them as a standard GUID or not
it's just to avoid conflicts
there are technically no limitations whatsoever on what you put in the guid field, it doesn't have to be a guid or anything
it just needs to be unique and guids are very good at that
ah ok, so ill stick to my method then, thanks!
I'm having a hard time understanding this games item distribution. I'm just looking to add a new item to some existing containers, no custom roomdefs or custom containers. Would that be handled by Distributions.lua or ProceduralDistributions.lua, or both?
Would I have to create my own ProcDist entry to overwrite one of the vanilla ones, or can I insert items directly to vanilla ProcDist entries?
I made a pair of pants and I want to add them to vanilla dressers and inventorymale, but I just cannot wrap my head around the item distribution system.
I tried seeing how AuthenticZ handles it, because I have it installed, and the mod is far too dense for me to make heads or tails of whats going on lol
math.ceil from 5.25 its 6?
math.ceil always rounds up to nearest int, that seems right.
thanks
Guys is there any way to modify IsoPlayer in Lua? Or any other way to save some player state. I am trying to make a mp mod and I need to track some state of players and save it permanently
if you need to store data persistently you can add to the player's moddata table, which you can retrieve with player:getModData()
I saw that before here just now but I wasn't sure it is saved persistently or temporarily, thank you. I will try that.
If you just want your new item to have a chance to spawn in then it's a table.insert line in ProceduralDistributions.lua
Wouldn't that be linked to IsoPlayer and do like zombies ?
isoplayers aren't recycled
👌
to my knowledge isozombie and isogridsquare are the only classes with that property (and grid squares are saved, loaded, and reset properly)
I think that's what confused me at first, since in Distributions.lua the inventorymale entry doesn't use a procLIst, but every other container I wanted to use did. Inserting into inventorymale doesn't seem to make them wear the pants, however. The last thing I'm stumped on 😆
Can't seem to find where the game handles zed clothing
I ran into this same issue when I made my wearable ammo packs.
I got a new type of zombie to spawn wearing them but they were naked otherwise 😂 Even when I gave them all the clothing codes that I thought would work
Still trying to dissect how AuthenticZ handles it, completely lost in the sauce right now but I'm apparently making slow progress lol
Getting new clothing items to 100% is a lot more complex than any other item, I found out the hard way.
But it's doable. I'm considering making another mod just so I could fit some special forces zombies with all the new stuff I've made / am making
One mod to study for it is Brita's Armor pack. They got zombies in full custom outfits working, and it's just clothing items, not guns
I will definitely check that out
At the risk of derailing the conversation with ill-advised abstraction-shattering rabbit holes-- When one peels back the hood on player:getModData()'s persistence, that's saved along with everything else in global_mod_data.bin, right? (via zombie.world.moddata.GlobalModData)
no, it's saved as part of the player object in players.db
global mod data is an entirely separate system from object mod data, they just share a name and the general purpose of 'table that saves'
I see how Brita's Armor handles it, and it is definitely very involved, but also very doable. Thanks for the advice 💪
an object's mod data is saved with the object, which is usually the save data, but players are saved to the database instead (and zombies don't usually save their moddata at all)
Everything by the Arsenal/Brita's devs is absolute magic.
so it's associated with the data blob?
yeah, that's just the raw save binary for the character object afaik
yeah in zombie.savefile.PlayerDB's update and add methods seem to insert the binary data for the character object in that column. Neat!
correction: zombie.savefile.PlayerDB 's private SQLPlayerStore subclasses methods, to be specific
it's a neat use of setBinaryStream (https://docs.oracle.com/javase/8/docs/api/java/sql/Blob.html#setBinaryStream-long-)
What is the smallest decimal you can put in sandbox double?
So what should I use to save some data/state on player specific (using Lua), I am newbie in pz modding not programming
I would defer to @bronze yoke's expertise here, so her stated player:getModData() use. Unless you're asking how to use that, mechanically
Okey, I got it thanks, I managed to use that but if there is better option, I am willing to use that
global mod data is ideal for data that is not tied to a specific object, for things that are tied to objects (such as players) their object moddata from getModData() is preferable
Hey, I'm very new to modding and I'm attempting to create my very first mod, I cannot find any information online on how to create a mod which adds a new meta event which would function exactly like the ones already included and randomly trigger with the other events. Can anyone give me any advice and/or direct me to a website/tutorial which explains how to accomplish this?
hey, are there any modders that take commissions? i was planning on buying 2 custom mods.
I could try creating your ideas, it depends on what they are though
oh cool, can i dm you?
Yeah, ill see if Ill be able to make any of them
do the developers still use the forums? or if I had a specific bug report that related to the code would I want to use a different avenue
forums are the way to go
What did you find out of curiosity?
I'll post first :3 it's not game breaking
I'll ping you once I post it
Righto
this is so weird
when I put my poncho on everything was fine but when I clicked on the hood down the item deletes itself from my inventory
impossible to say what's causing this here
Most likely an incompatibility with another mod
@thick karma it's pending moderator approval
may I dm?
not for approval just to discuss it
Say me pls if anyone knows how to get all car's and the capacity of their seats? (does this need to be written separately for each car or is there a general meaning for the character?)
In lua you mean ? How to get those info ?
Yep, I know that you can get a car part if the player is in the car (player:getVehicle()), but is it possible to get the value of a certain part of all cars for the player when he is not in the car?
Did you check the doc ?
https://projectzomboid.com/modding/zombie/vehicles/BaseVehicle.html
declaration: package: zombie.vehicles, class: BaseVehicle
Looking at it I see a few methods that could be useful to you
getMaxPassengers()
hmm thanks, I'll check it out
That one is interesting
getPartForSeatContainer(int seat)
idk what it outputs tho
you'll have to test that
is it possible to override a sandbox option of another mod? I tried doing the same name but it just shows both names
declaration: package: zombie.vehicles, class: VehiclePart
If you mean creating a file with the same sandbox options and change the settings of those, no you can't
But perhaps there are other means of chansing a mod's sandbox options
Haven't looked into it tho
Oh I see thanks for the reply. Yea im using a local mod to update another
directly changing the values the sandbox setting changes achieves this, unless that isn't the route you wished to take. i mean by editing the values with a separate mod
You mean to change it directly to the original mod's sandbox.txt?
i mean you can change the sandbox option values outside of the sandbox.txt . the sandbox options are just variables set to a specific container type, i've only done a mod that checks the value but i would think just setting it equal to what you want would do it and then make sure you load the mod after the one you're modifying so it overwrites it. if that fails you can always find what the variable affects in the mod and just directly change that
Oh yeah thats my problem currently. The sandbox option does not save the values that im putting, I don't know if its a mod conflict. So, I figured I'll just put a default value to it
can't be sure of what is causing that but if it is another mod changing the values then a change in load order could potentially fix it
Althought W.I.P, it's simply interesting. 🙂
I want to say Thank You again for everyone's help and guidance. I was able to complete a mod for my server that lets me check the rough square footage of a building and also account for how many stories the building is tall. Hours and hours of coding, and finally got it pretty dang solid. So, thank you again!
Fun Fact: The Louisville Grand Ohio Mall is ~207495 Square Feet in size!
Not to be a stickler but are you saying that one square is one square foot? 😁
As far as I calculated, one tile = 1m Squared. I then converted that to square feet in the calculation
Just checking! 😄
I checked a whole bunch of buildings, and its pretty accurate, in a rough sense to get basic square footage. Doesn't account for crazy shaped buildings, but will give a minimum for those. Using the function to enable various levels of residential safehouse claims based on the size of the building. Working awesome so far.
Does anyone know how to make a silencer that changes the firing sound of a gun?
I'm also having a problem with making this separate backpack as an equippable item and it's been unusually persistent, no matter what we tried
At least two bag items have worked fine before, but this one just doesn't want to show up in-game, only a bunch of floating polygons are visible instead; the ground model works perfectly, however
damn, did you release that publicly? ive been trying to brainstorm a way to prevent players from claiming buildings over 2500 tiles. seems like your mod would be a good start for something like that
Is there a method that would allow me to disable certain vanilla recipes?
I just realized the Blender screenshot is old and fake as hell, so here's how it looks in an actual Zomboid model, something that I couldn't achieve in-game
I am using a mod to disable traits from another mod for a multiplayer server.
It works when the character is made for the first time.
When that character dies and they make a new character, the disabled traits show back up.
Is there a better Event to trigger the trait disabling than Events.OnGameBoot?
Have also tried Events.OnCreatePlayer but the disabled traits still show up.
We legit tried making the backpack model ten times bigger to see what would happen, but yeah
I have no idea how I or he screwed it up
How do you remove the trait exactly ?
check how this other mod adds its trait
ongameboot would be sufficient to disable a vanilla trait because that's the only time vanilla creates them
if that's not working for a modded trait that mod is doing something weird that we can only guess about
for k, v in pairs(traitsToDisable) do
local traitToDisable = TraitFactory.getTrait(v)
if (traitToDisable) then
traitToDisable:setRemoveInMP(true)
end
end
will take a look at more traits to see how they do it. ty
You want to remove it from the character creation menu right ?
yes, after the character dies and they click "new game"
it triggers fine the first time, it only doesnt trigger after they die and click new game
Remove it for everyone ? Then that's not how you do it
Hey guys, i am new to modding and i wanted to try to mod this great game. I have watched some guides and think i can do it. but i am looking for the function that returns an empty bowl after eating from it... my plan is to return it as a "Dirty bowl". can someone point me in the right direction?
i'm not following you. it works if they don't die. so what should i be looking for to trigger it when they die?
KnoxTraits = KnoxTraits or {}
function KnoxTraits.initTraitTweaks()
local traitsToDisable = {}
table.insert(traitsToDisable, "leadfoot")
table.insert(traitsToDisable, "bouncer")
table.insert(traitsToDisable, "scrounger")
table.insert(traitsToDisable, "antique")
table.insert(traitsToDisable, "restfulsleeper")
table.insert(traitsToDisable, "batteringram")
table.insert(traitsToDisable, "graverobber")
table.insert(traitsToDisable, "actionhero")
table.insert(traitsToDisable, "secondwind")
table.insert(traitsToDisable, "gunspecialist")
table.insert(traitsToDisable, "Cowardly")
table.insert(traitsToDisable, "Conspicuous")
table.insert(traitsToDisable, "Pacifist")
table.insert(traitsToDisable, "fearful")
table.insert(traitsToDisable, "mundane")
table.insert(traitsToDisable, "incomprehensive")
table.insert(traitsToDisable, "indefatigable")
table.insert(traitsToDisable, "ingenuitive")
table.insert(traitsToDisable, "glassbody")
table.insert(traitsToDisable, "Hunter")
table.insert(traitsToDisable, "progun")
table.insert(traitsToDisable, "noxpshooter")
table.insert(traitsToDisable, "terminator")
for k, v in pairs(traitsToDisable) do
local traitToDisable = TraitFactory.getTrait(v)
if (traitToDisable) then
traitToDisable:setRemoveInMP(true)
end
end
TraitFactory.setMutualExclusive("terminator", "gunspecialist");
end
Events.OnGameBoot.Add(KnoxTraits.initTraitTweaks)
is how the mod is currently handling it
For example, in Susceptible (and in the base game) they add a trait with
And in my addon for it, I remove it with
TraitFactory.addTrait("Susceptible", getText("UI_trait_Susceptible"), -11, getText("UI_trait_SusceptibleDesc"), true, false);
setRemoveInMP is a valid way to do it for a server-specific mod though
changing to that other method won't fix the issue
How so ?
the problem is that the changes are being undone, which likely means the mod is recreating the traits at some point other than ongameboot
Which is... problematic lol
I’m trying to fix my weapons mod by looking at other mods. What does “attachment world” mean in a models .txt file?
Is there any way to extract the data out of newtiledefinitions.tiles or does anyone know how i can view the file without errors or if its possible? Without using tilezed manually
you can find them in D:\Steam\steamapps\common\Project Zomboid Modding Tools\Tiles\2x
also this is a question for #mapping
I dont want the tiles i want the tdef
the only file in more traits that i can find that references traitfactory is \lua\shared\NPCs\MoreTraitsMainCreationMethods.lua and it's also using Events.OnGameBoot.Add
i did a discord search and read this about loard order: "on the server, client is skipped vanilla shared -> modded shared -> vanilla server -> modded server"
i moved the trait remover.lua from client to /shared/ and then later /shared/npcs/ but it still looks like either more trait's ongameboot is happening after my removal or removal isnt happening at all
is there a way to name the file or something to make sure the traitremover.lua is processed after more traits? (its already after more traits in the load order)
add require "NPCs/MoreTraitsMainCreationMethods.lua" to the start of your file
ty let me try that
they seem like pretty much raw text, it would probably be pretty easy to extract them with a python script or something - but i wouldn't know of any existing tools to do that
I need motivation to finish this mod. I burned out a few weeks ago.
someone can tell me what is the expected minimum level of B42 please ?
event OnCreate Living Character or just Character
ill try that one next ty. the require didn't work unfortunately
You mean how far underground will they let us go?
yes. I used -100. I just need to have a value below the min.
well the lowest value guaranteed to be available in any given cell is still zero
I'm guessing -31 based on this:
Now then, survivors. Let’s do the thing. NEXT This week we released version 41.77 into our Unstable beta. This is primarily aimed at fixing the Linux crashes that have been plaguing server hosts, and so far seems to be a mission success in that regard. It also improves client to server connections by preferring a […]
I imagine 0 to -31 would be the lowest possible range of floors based on this
yeah
