#mod_development
1 messages · Page 68 of 1
Gonna test both your version and the aforementioned while loop queue also
Alright Monsieur Duck let's see what this while loop's got. Can it do what the recursives have crashed me 20 times doing? We shall soon see.
oh i left off ""
k lemme try edited
My best guess would be something with getText is failing for both instances
yeah about that, mine's broke
lmfao
are any traits not all lowercase and not capitalised?
Faaaair enough
Obviously this problem is less trivial than it seemed at first glance
yes, that's the whole issue man, I've been trying to tell you it
lmfao

I mean on the UI side
Yes
this should catch both those cases
look
When I decided to do this 2 hours ago I was like, "Oh I'll just finish expanding this little function right here..."
I'll see if I can fix it, it doesn't work in the right order
Now I'm dying of old age.
the name argument has to match the trait factory name
but the UI should be fine with what I wrote
btw why is "Marked" as thing? They have custom descs/names?
explain to me how does your function converts
local Graceful = createTrait("Graceful", 4);
into
TraitFactory.addTrait("Graceful", getText("UI_trait_graceful"), 4, getText("UI_trait_gracefuldesc"), false); by lowercasing UI_traitgraceful (not G)
but if you pass it same thing
local Gardener = createTrait("Gardener", 4);
it now suddenly magically doesnt?
TraitFactory.addTrait("Gardener", getText("UI_trait_Gardener"), 4, getText("UI_trait_GardenerDesc"), false);
desc and Desc are also afflicted?
oh fuck apparently it is
god damn
why cant they make their game consistent
but
even if desc is always upper case
explain why when u pass Graceful it makes it UI_trait_graceful and if u pass Gardener it makes it into UI_trait_Gardener
Haha tested and it crashed. Jumper is unstringable unless I stop after 7 levels of depth.
the world if we could just change a trait's name normally
@ This
unless it doesn't do it, then it loses whole point
why not grab the original trait and getDescription()?
elaborate pls
you're recreating the traits because you can't change their names right
Nah I'm overwriting the base game trait
Im creating same trait with all the same values as base game except display name
So that way of some other mod uses those traits
it still works
player:HasTrait stuff
so the vanilla traits are never created at all?
i mean when your mod is running
they are, im just overwriting their name
foraging buffs, descriptions, everything is taken from base game files
well except skill buff, that one i have to add manually
local function createTrait(name, cost, isProfExclusive, isDisabled)
isProfExclusive = isProfExclusive or false;
isDisabled = isDisabled or false;
--overwrites the variable with the last 'true' case - if dynamic traits==true, continue to find "Marked", otherwise ""
local marked = (getActivatedMods():contains("DynamicTraitsWorldMarkDynamicTraits") and "Marked") or ""
--lowercase name argument ("Graceful"=="graceful") -- getTextOrNull("UI_trait_".."graceful"..marked) - if not translated then return null
-- --same principle as above with dynamic traits and or "", if nil pass to the next returned variable
-- -- --name:gsub("^%l", string.upper) == capitalise the first letter only ("Graceful"=="Graceful", "graceful"=="Graceful")
local fetchedName = getTextOrNull("UI_trait_"..string.lower(name)..marked) or getTextOrNull("UI_trait_"..name:gsub("^%l", string.upper)..marked)
local fetchedDesc = getTextOrNull("UI_trait_"..string.lower(name).."Desc") or getTextOrNull("UI_trait_"..name:gsub("^%l", string.upper).."Desc")
return TraitFactory.addTrait(name, fetchedName, cost, fetchedDesc, isProfExclusive, isDisabled);
end
Is your creation overwriting old traits?
i mean does the vanilla code to create the traits still run? because then you can just grab all the info you need from them
it'd likely be update safe too (not that we're getting any)
yes require('NPCs/MainCreationMethods');
TraitFactory.addTrait("Mechanics2", getText("UI_trait_Mechanics"), 0, getText("UI_trait_Mechanics2Desc"), true);
🤔
@ chuck I think you were the one to post them before- But do you know the lookup shortcuts in intellij?
local fetchedDesc = TraitFactory.getTrait(name):getDescription()
yes welcome to base game files 
You can overwrite the vanilla function as well - but what are you trying to correct for again?
Updating the old more traits and stuff
If submod is enabled - update base game trait display name. Nothing else
and the dynamic traits mod gives vanilla traits new names?
why not fork it before reaching this stage then? you don't need to recreate them for any other reason right?
You should also be able to grab and edit the trait
---@public
---@param arg0 String
---@return TraitFactory.Trait
function TraitFactory:getTrait(arg0) end
there's no method to change the name
yeah just saw that
you can still decorate the vanilla function to check for those marked traits
yeah that sounds like the easiest way
then you have all the mixmatched arguments already
it literally wont load the game 
oh, but can we run the decorator before vanilla? isn't the file that initialises the traits in shared?
yes it is
you can decorate it in shared probably
I like how I had a working solution and then we spent 1h trying to make it better and still didnt manage to

i dont need mechanics 2
unless you're supplying the same information
dafuq is even mechanics2
intermediate
-2 traits are the profession specific variants, right?
from the mechanic job
local altNames = {}
altNames.Gardener = 'Different Name'
local old_addTrait = TraitFactory.addTrait
function TraitFactory.addTrait(type, name, ...)
name = altNames[type] or name
old_addTrait(type, name, ...)
end
```something like this
testing it out
For editing player mod data, it is as easy as ?
player:getModData().Example.Something = 7
Online Lua Compiler -
throws error on line 11
only thing i changed is replaced mod condition to true
although normal rules apply, make sure Example has been initialised as a table
By descending deeper still into madness, I have discovered the root of the problem! @sour island
oh?
Oh indeed!
Check it
--------children
----------3524
------------x
------------y
------------width
------------children
--------------3524
What is interesting about these you may wonder
What is interesting is that I accessed them by calling my function 6-layers deep on an arbitrary 4-layer deep table
yeah it doesn't like this lol
So I AM able to go deeper than 7 layers with my function, but I am in an infinite loop and it does make Project Zomboid very sad
the one you like doesn't work 
Furthermore, that infinite loop is generated by Mod Options' references to presumably vanilla data objects that appear to be circular a.f.
hmm, might be because addtrait has a variable number of arguments? no idea if that's handled on this end
how do you handle that? i've never had to mess with a method like that
doesn't seem to play nice
local addTrait = TraitFactory.addTrait
---@overload fun(arg0:String, arg1:String, arg2:int, arg3:String, arg4:boolean, arg5:boolean)
function TraitFactory.addTrait(name, UIname, cost, isProfExclusive, isDisabled, removeInMP)
name = name.."TESTING"
addTrait(name, UIname, cost, isProfExclusive, isDisabled, removeInMP or false)
end
Doesn't work on line 120:
TraitFactory.addTrait("Axeman", getText("UI_trait_axeman"), 0, getText("UI_trait_axemandesc"), true);
I'm guessing it's throwing a fit over kahlua stuff
I still don't get how does your function magaically knows if name inside UI_trait_name should be lowercase or upperace
Ok so it changes teh string
local a = (1==0 and 5) or 3 -- return 3
local a = (1==1 and 5) or 3 -- return 5
oh i made a silly mistake
getTextOrNull(is this texthere, no?> then nil)
How come does it change Gardener to Gardener but Graceful is changed to graceful
local old_addTrait = TraitFactory.addTrait
function TraitFactory.addTrait(type, name, ...)
name = name .. 'TESTING'
return old_addTrait(type, name, ...)
end
```with this code
i got an error on a different line for some reason, one that made the missing return far more obvious
there's always text????
if it can't find either lowercase OR capitalized it will return nil
that's an edgecase that shouldn't occur
so, if I were to set mod data on an item with the script, say I have a line that reads
Bar = "foo"
How would I use the getModData() to get that? trying to understand the interpretation
You complete called it, kudos. Hidden circular references in data referenced within the options_data of Mod Options.
me smrt
print(item:getModData().Bar)
@thick karma I'm almost there, only problem now is that pairs() is unstable so it sometimes is out of order
Word, well, I fear your technique without depth limits would run into the same infinite loop I'm seeing
Either way, I'd go with what Albion posted
much easier to maintain for you
@sour island can u make an example on online lua? i tried your function and it throws error
And unfortunately attempts to store found objects are not stopping jt
Nope that's why there's the visited array
That sort of array is not working in our functions duck
you can't compile this, it's calling on stuff from PZ
getTextorNull is pz func?
yes
I understand the technique you're describing but it's failing us when we try to use the found objects as indexes (in an all-true table)
Maaaybe tostring could save the day, I'm out of time for trying stuff but I'll be back later
eitherway, you're better off going with the new method
let the game do the work for you
local altNames = {}
altNames.Gardener = getTextOrNull('UI_trait_GardenerMarked')
local old_addTrait = TraitFactory.addTrait
function TraitFactory.addTrait(type, name, ...)
name = altNames[type] or name
return old_addTrait(type, name, ...)
end
```this is the general concept
ye, gonna try, thanks
smort 
oh, damn you'd have to still do that shit cause getText is called as the argument
atleast its less of a headache
yeah, linking the internal name to the new translation is much less work
I'd be curious if there's a way to pull out the argument from within that argument...
you could also keep a table of affected traits, check if it's in that table, and use getText('NewString', name) where newstring is '%1 (D)' since that seems to be the pattern you're using
i don't get it 
basically, we hijack when the vanilla game adds the traits and change the names
but where do I add if submod is enabled
you don't need to really, getTextOrNull() will return nil if the string doesn't exist (which it won't if the mod isn't enabled), so the code won't activate
are all vanilla traits given a Marked version?
oh, what does the submod do then?
you could put the entire block into an if mod enabled though
i dont know any other way than submods to affect non-in-game stuff
like how do you make a toggle
that affects tratfactory
where do you put it
yep
if getActivatedMods():contains('DynamicTraitsWorldMarkDynamicTraits') then
local altNames = {}
altNames.Gardener = getTextOrNull('UI_trait_GardenerMarked')
local old_addTrait = TraitFactory.addTrait
function TraitFactory.addTrait(type, name, ...)
name = altNames[type] or name
return old_addTrait(type, name, ...)
end
end

andthen I jsut add vanilla traits that i want to have marked there?
do i need to addXPBoosts or recipes or anything?
nope, all this does is hijack the original function and change the name
well we wouldn't've got here without chuck
If the marked stuff is still giving you trouble let us know
I'm confused why they added new names but w.e.
😄
function TraitFactory.addTrait(type, name, ...)
local marked = (getActivatedMods():contains("DynamicTraitsWorldMarkDynamicTraits") and "Marked") or ""
local fetchedName = getTextOrNull("UI_trait_"..string.lower(name)..marked)
or getTextOrNull("UI_trait_"..name:gsub("^%l", string.upper)..marked)
or getTextOrNull("UI_trait_"..string.lower(name))
or getTextOrNull("UI_trait_"..name:gsub("^%l", string.upper))
or name
return old_addTrait(type, fetchedName, ...)
end
this would try to grab a number of shit
before defaulting the vanilla
first attempting to find Marked
Do I have to initialize all variables beforehand for mod data, or can I assign them on the fly as long as they arent tables?
you can assign them as you wish as long as they aren't tables
moddata is literally just a lua table attached to an item, it follows all the same rules
let's gooo
Nice!!!
Do I even need to have this Events.OnGameBoot.Add(AddDTWTraits); inside my traitfactory lua?
I dont right
since its gonna run it anyway on game boot
i couldn't say for sure without knowing what that function is
traitfactory stuff
creating traits
setting mutually exclusive traits
and thats it
cuz I pput your code outside function just in the body of lua
and it worked xd
yeah it's not supposed to be in a function
but yeah, unless you're doing it for another reason that code completely removes the need to mess with traits elsewhere
ye i get it, uses same principle as overwritihg ISfix action
saves default function
and then edits it
@thick karma tested and working ```reveal = function(inputTable, verbose, indentation, visited, printValues)
-- visited tracks tables that have been seen before to avoid loops.
local found = false
for _,t2 in pairs(visited) do
if inputTable == t2 then
return ""
end
end
table.insert(visited, inputTable)
local s = ""
for k,v in pairs(inputTable) do
if printValues then
s = s .. indentation .. k .. " = " .. tostring (v) .. "\n"
else
s = s .. indentation .. k .. "\n"
end
if verbose and type(v) == "table" then
s = s .. reveal(v, verbose, indentation .. " ", visited, printValues)
end
end
return s
end
local t = {
a = 1,
b = {c=1,d=2},
e = {f={g=1},h=1},
}
print(reveal(t, true, "", {}, true))```
I was being stubborn with the while loop but it was making the memory complexity bad, turns out this is actually a case for recursion.
I can finally go to bed
and then runs default with updated params
if you want to do this on java objects usually the method is a bit uglier, but since traitfactory is a static we don't have to worry about it
thanks god
how do you make a custom/modded trait in project Zomboid
so, with the mod data- If I set a variable like local x = player:getModData() . That way I could do something like example = table.1 so that way I could pull the string from the table name like
local x.example = 10
Would that be the best way to have a custom variable for the mod data input? Because otherwise when I am writing out the getModData() function it is reading whatever I put as the thing to get, so I cant plug variables into it
you shouldn't be having that problem, but you should pull it into the local space anyway since you don't want to call the java method repeatedly just for performance reasons and it's prettier
i'd recommend checking code of mods that add traits, preferably not giga-complex ones
getModData() just returns a table, getModData().index is exactly the same as
local x = getModData()
x.index
Ok
pretty? 
Because my functions first step is to check which table it is pulling from, from a list of different tables. A variable on the table will define which moddata variable to tweak, but it seems to not like me trying to put the variable where ive defined the table
Why is modding a simple shirt in so unintuitive 😔
you can do ```lua
player:getModData().Killcount = player:getModData().Killcount or {
WeaponCategory = {
Axe = {count = 0, WeaponType = {}},
Blunt = {count = 0, WeaponType = {}},
}
}
it's an or statement
it'll only override if it doesn't
there is a situation where this doesn't work though - if you change the format the new stuff won't be added to old tables
you shouldn't really worry about that until after the mod has been released though
there'll be no additions to killcount, its finished mod
Im grabbing its data
well, grabbing/initializing if it's not there
cuz in other lua I got this
and i don't want any nils there
ohh, then this might not work, yeah
you could make a table of weapon categories and loop through that, it'd be a tiny bit prettier
this is a niche case really, and it's fine as it is
Do your saying I should look at the code of the mod?
Yes. What kind of trait u were thinking about? Anything complex or entry level stuff like +2 to skill?
This is the issue I am juggling right now
@bronze yoke if that makes more sense
I did some arrays with keys, lemme yeet u example, maybe it'll help
https://github.com/MusicManiac/ExplorerTrait/blob/master/Contents/mods/ExplorerTrait/media/lua/client/ExplorerTraitDynamic.lua
check
function addNewCellToList(cellKey)
@winter thunder ^
So the simple one are like +1
This is my builder for it
Basically keyValue is how the table is defined, effectively it is the table ID
So i dont need to make a constructor module, but I can effectively make a dictionary of tables
I could suggest go check More Traits. To see how simle stuff is added check /lua/shared/npc/creationmethod.lua or something
GymRat:addXPBoost(Perks.Fitness, 1);
GymRat:addXPBoost(Perks.Strength, 1);```
for example, perk that adds +1 fitness and +1 str
That is a variable going to be set in the item defs, the name of which matches the keyValue that the item should pull its information from
that way I can make a single function to reference all my drugs, instead of new ones for each drug
so what is x.base supposed to do? x is going to be a string or a number or something right?
I missed some of the convo - but you can easily make pseudo-classes in lua
base is a string, x was just meant to be a way to combine the getModData() func with the name I pull from the table
Ok I think I’m starting to understand
so in the item script, DrugID = NameOfADrug, right?
I know, I originally did. But a keyvalue system is a lot cleaner for the stuff I am building
and yeah, basically
item:getModData().DrugID will return 'NameOfADrug' as a string then, you need to use something to get from the id to the actual drug stats
---@class wallet Pseudo-Object
local wallet = {}
wallet.steamID = false
wallet.playerUUID = false
wallet.playerUsername = false
wallet.amount = 25
function WALLET_HANDLER.new(playerID,steamID,playerUsername)
if not playerID then print("ERROR: wallet:new - No playerID provided.") return end
if not steamID then print("ERROR: wallet:new - No steamID provided.") return end
local newWallet = copyTable(wallet)
newWallet.playerUUID = playerID
newWallet.steamID = steamID
newWallet.playerUsername = playerUsername
newWallet.amount = SandboxVars.ShopsAndTraders.StartingWallet or newWallet.amount
end
copyTable can be used to copy k/v
without worrying about references
idk if that helps
I also use other objects as profiles/presets to pull info from
But how do you make like nyctophobia or alcoholic
AKA custom traits
yea that's a bit more complex, you have to write logic for them
All I can recommend is checking existing traits
im off to sleep xd
Good night
but ye check logic on complex traits in bigger mods
thats how i picked stuff up
and asking here
So, line 8 will get the DrugID string from the item. That string is the same as the keyValue of a table where I define the qualities of the different drugs. the keyValue is basically a variable in a table that acts as the ID of that table instance. So, in my case, the name of the drugs act as my keyvalue. So, I get the name of the drug from the item in line 8. Then use that to figure out the table to reference in line 9.
The two following variables on lines 10 and 11 pull two definitions out of the table.
your mistake is that x is still just a string 'Meth', string.base doesn't mean anything
where does info come from? is info also a string?
info is just the name of the input, it is a whatever I want it to be. though, it is an array for my purposes afaik
An actual instance would look like this
I dont need to predefine it
i think what you're trying to do is keyValue[x].base
Nah, so- The issue is that no matter what I put after player:getModData(). it doesnt let me enter anything, it just assumes that anything typed after that point is a definition for the mod data table
copyTable?
getModData() returns a standard lua table, when you put a . after it it's expecting a string key
Hey if u add a bunch of different drugs I'd love to use that mod
When it's done
Xd
Right- That was why I was asking for some way to slam the string I get onto that function instead
like player:getModData()[var]?
Word haha! Trying to get the lua into a testable form so we can start implementing the various effects we have in mind. We plan on adding a ton of different effects haha
Do I need to put the . somewhere?
no, it's just a table
ok cool
you don't need to do anything special to it
I mostly just want some meds that are not "Vitamins" so i can have traits that are illnesses so i can cure them over time with correct meds
Word- Right now the focus is the recreational/abusable side of drugs, but we wanna implement more medications and stuff too in the future
Also you really should put all your mod data behind your mod name
So it doesn't get overlapped
for sure, I am just making a testing branch rn for the sake of making sure everything works as I expect it to
If I do it that way, do I need to predefine the variables?
Since I would be calling a table
probably best to do that sorta stuff on character spawn, right?
Dis mine
you are working on your own branch of dynamic traits?
gotcha- meant to play along side, or on its own?
Own
Word
Not gonna be compatible with DT
Thing is
I want 2 words to be in the name 100%
Which are "traits" and "dynamic"
I also thought Dynamic Fiesta
But it missing one of two words
It's a bit rough coming up with a name for something so specific
When DT is already out there
me too
anyone know the variable to get the players weight?
I see that i have to use Nutrition:getWeight(), but I dont know if I need to define the player in there, or if it defaults to the client?
I did that but don't remember from top of my head
Um
Check more traits workshop, go link to github, go dynamic submod, go client, check Lua there and ctrl+f for weight
That's the only way I can help from bed
xD
Anyway, done browsing memes before sleep, now i go sleep
getPlayer():getNutrition():getWeight()
any idea where the game calcs the effects of injury on the players ability to fight? I know pain messes with it, but I think specific injuries do as well?
So... For some weird reason, my game stopped registering my function, and I am not sure why. I have been working on debugging, and the function is loaded in my mods\lua\client folder. But now when the game tries to call it, it claims that the function doesnt exist
Do you have it in the require?
anyone up for a challenge?
i need a way to attaach a vehicle to ANOTHER vehicle, and not like towing, like put it in other other cars roof.
it can be completely for looks.
but i'd want to look like it was PART of that car.
no jankl
Not up for the challenge, but it sounds like this could be achieved by making a model for whatever you want on the roof (like a bike or whatever), and then simply adding that as an installable part to every other car - without letting you actually install it in the Mechanic menu.
i have this.i want to attach cars to it for a player to haul
Ahh, yeah all right that's gonna be harder.
To get started, I'd suggest trying to just put some dummy car models on it? Then later you can work on making those cars match what the player actually put on it.
https://steamcommunity.com/sharedfiles/filedetails/?id=2906005833 One more area to tweak, then I can finally play!
Woop woop. It's a Christmas miracle!
I feel like I've made a mistake. My character is, uh, gone.
I'd be very curious about this. I have some ideas for trains that I wanted to play around with - one of them being attaching items/vehicles to a train.
Might look into it closer to the new year if I have time - was thinking of looking at adding vehicle attachments like how towing does it.
There are "ModelAttachment"s: https://zomboid-javadoc.com/41.78/zombie/scripting/objects/ModelAttachment.html
Thinking about it, towing used to be a mod back in the day, so perhaps it is still all in lua to this day? Definitely could be worth looking at that.
U might hit f5 or one of em buttons?
Damnnnnn
Yeah that's probably it. Didn't take it too seriously 😄
I think I've asked this before, but is anybody using a global api for ItemPickerJava.Parse() so that we don't all call it mutiple times?
Morning, modders.
I would like to ask you all, specifically those who make traits the following:
Is there a mod that allows adrenaline junkie, agoropohic and cowardly?
Devs removed that combination, and how difficult would it be to bring it back?
I've searched with no avail
Anyone knows how exactly the transmitModData call works? Im trying to call it for my object but it doesn’t transmit it?
Threw this together, it probably won't work, but if you have time you can play around with it.
local attachments = {
car1 = {0, 1, 2}, -- x, y, z
car2 = {1, 2, 3}, -- x, y, z
}
--- Create car attachments for trailer
local function createTrailerAttachments()
local vehicle_script = getScriptManager():getVehicleScript("myvehicle")
for id, location in pairs(attachments) do
local attachment = vehicle_script:getAttachmentById(id)
if attachment == nil then
local attach = ModelAttachment:new(id)
attach:getOffset():set(table.unpack(location))
script:addAttachment(attach)
end
end
end
Events.OnGameBoot.Add(createTrailerAttachments)
-- in your context action or something
function attachVehicleToTrailer(playerObj, trailer, vehicle)
-- do some checks on the objects (==nil)
-- check if the trailer has attach points
-- loop through attach points and find the first empty one
local trailer_attachment = nil
for id, _ in pairs(attachments) do
-- get trailer attachment
-- check if something is attached there?
-- if not, break this loop, we have our id
if attachment_open then
trailer_attachment = id
break
end
end
if trailer_attachment == nil then
-- uh oh!
return
end
local vehicle_attachment = vehicle_origin_attachment?!?
-- attach vehicles
local vehicleA = getVehicleById(trailer)
local vehicleB = getVehicleById(vehicle)
vehicleA:addPointConstraint(playerObj, vehicle, trailer_attachment, vehicle_attachment)
end
any ideas if my ground mesh works ingame but my skinned mesh doesn't? i'm assuming my export and scale is ok if the ground mesh works
no path errors in debug either
nvm my export was sus, all good
i can't think of any mods that replace traits but looking into more traits files might help
Good morning.
I meant to ask yesterday but are you trying to store the drug info in the player? Wouldn't it be more advantageous to only store an ID with quantity?
Codddinnggg on Christmas Evvvvveee
Is there a function to get every item definition? I want to create a table of every food item in the game, I've seen getAllItems() being used elsewhere but it seems to be nil for me?
I'd look at the debug / staff menu for item lookup.
Calls to that should be somewhere.
getScriptManager():getAllItems() returns an array of item script objects
IDs are 1:1 on that right?
yes, unlike recipes, items can't share IDs
\o/
ahh getAllItems() returns a java array I was trying to use it in pairs()
Excuse me while I Lua in Java.
Honestly? A wrapper for all List instances that accepts pairs() would be nice.
I remember seeing something called PZArrayList somewhere..
I'm also having an itch to make a content mod for the first time in a while..
Anyone know of any attempt to make a mod that adds UI for PZ for advanced circuit / electrician repairs?
If they moved to LuaJ, __pairs and __ipairs metamethods could be attached to the java types
I'm sure that the roundtable of devs in TIS had this discussion at least once in the past. I wonder what holds them back from going to another Lua interpretor / interface.. Maybe the control over Kahlua is needed in ways that prevents migration.
it's currently a mess and switching to it would be non-trivial
They could make their own implementation of those methods though. It'd involve using the kahlua.vm.* objects.
since they don't have any pressing Lua performance concerns, I doubt anyone wants to tackle it
It sounds like fun.. and I'd benchmark it if I got the time to do this.
LuaJ have their own benchmarks, they outperform Kahlua
If you want a performance boost in the game, modify the engine to use bitwise powers of two operations for chunk to world coordinates.
they also outperform the reference Lua implementation in many cases, when JIT'ed code is enabled
Sooo many calls to transformations of coordinates when looking up IsoGridSquare stuff in each tick. 🙂
isn't that calling into Java?
Regardless, doing decimal math vs bit-shifting is suchhh a performance difference.
hey anyone want hear my mod idea?
that depends on how smart the optimizer is
Do it in Java of course.
diassemble the JIT code the JVM generates before getting carried away 🙂
I have a few optimization pitches for the game but that one is one of the biggest ones.
have you run the game in a java profiler?
things that are worth optimising are whatever pops out at you on a flame graph
I've worked mainly on the Java side of the game for clients in the past. One of the many things I did were performance adjustments to things like the database (Migrating to MySQL and also MongoDB), and fixing memory leaks. More recently, I've patched the game to fix exploits.
Profiling in the past yeah.
from SQLite to MySQL/MongoDB?
Yeah. Was nice. 🙂
MySQL? sure
Someone else also did SQL server recently.
MongoDB? christ no
Hahah.. to each their own. 🙂
storing user accounts in a JSON-like document store sounds like hipster nonsense to me
and there I was thinking the NoSQL nonsense died off
I just work on what I'm asked to do. 😛
strikes me as a bit pointless though, the game will choke to death on many other things before SQLite becomes your problem
It's good to know it when work is available.
I just don't do work where I'm not part of architecting the solution 🙂
(Car keys have to be on your keyring to work? Programmatically, makes sense, realistically boooooooooooooooooooooooo)
?
they can be used from the inventory itself and dont remember exactly but maybe also from a cars inside storage
when you drive key is not in inventory, is it? never checked
nope its moved to the ignition
I don't think it works from other inventories iirc
Only the main and keyring (?)
Forgive me if I'm wrong tho
Anyone know how you can call up items from a world container?
I've always had this idea for a mod since I started playing and haven't seen it. But I feel like random a random or picked allergy to any sort of food item would be cool, and then effects ranging from a rash moodlet to almost instantly killing you
Getlootinventory or something
Anyone happen to know which functions animate the speedometer and the engine light and battery light when you turn on a car?
In vanilla, the car gauges and such stop working when you hide UI
Its all in a lua file related to dashboard. The one we took the speed before
If u remember
I know ISVehicleDashboard.lua but I do not see where that file makes a decision to animate or not animate the speedometer, for example. Do you have the details or do you just believe it's in that file? I know the files but I do not see the details
It will also work if its on your inventory not gona worm if its on your bag
I see
🤔might be java
if you continue down this path you'll find the forbidden knowledge 😟
lol I want the forbidden knowledge
It's so confusing... I cannot even figure out what aspect of hiding the UI causes this
I tried manually showing EVERY UI element (and the gd array was 80+ long at the time)
And I tried UIManager.setVisibleAllUI(true), which historically seems to hit more than one UI thing
I think I saw a VehicleGauge the other day
But neither one of those seems to be responsible for making sure the dashboard animates
like the gauges?
ISVehicleGauge.lua is a file but I do not see how it would determine to animate on the basis of UI visibility
that's a java object controlled by ISVehicleGauge
java, has a render call
Try setting the javaobj to visible
The gauge is rendered in java using a line.
Because SOMETHING about hiding every UI element OR something about calling UIManager.setVisibleAllUI OR something about the visibility of the UI more generally -- i.e., something I CAN do from Lua -- is disabling and enabling that animation
I like this idea but the javaObject of what?
the gauge
Odd, when you hide the UI doesn't it hide the vehicle ui?
ISVehicleGauge has javaObject which is VehicleGauge
I see hold on it's called fuelGauge
That's how ISVehicleGauge gets operationalized in ISVehicleDashboard
Gonna try to access fuelGauge via dashboard brb
there's ~3 of them
I see
fuelGauge, engineGauge, speedGauge
Those are the ones that are not animating
Hmmm
Lmao well I can hide and show the fuel gauge and such independently
For a truly borktastic Zomboid experience!
Publishing this TODAY!
lol
lol but unfortunately setting visible true does NOT resume the updates
In fact even if I hide and show the gauge is stays in its old incorrect state:
(I am not moving r.n.)
So showing the gauge doesn't even trigger whatever updates it
(even once)
I tagged u on a tech support thread
I see it, idk if I have their answer but I'll look later
you're trying to activate it after hiding everything, right?
Yeah
i mean I can show the dashboard while UI is hidden but the animations stop while the UI is hidden
I am thinkin about manually adding prerender to UI drawing somewhere
Im not at home atm.. i would have posted your controller mod if i could
Hmmm no it hated that (I think self didn't come through right)
I am not sure if my mod has any insight regarding their issue, I would have to read what's wrong for them in detail, but I am a but tied up
Trying to solve one thing at a time
Sure just wanted to advertise for u
dashboard:setVehicle(vehicle)
seems to setVisible to the fuelGauge, maybe that's important
I manually setVisible on fuelGauge a few minutes ago, that's not it
I can turn the entire fuelGauge on and off but it doesn't affect its animation state
There is something else for that somewhere sneaky.
okay... setValue is used to update the way things look
I can change fuelGauge from empty to full via setValue
yeah in prerender
I just manually triggered it and it DOES update the way things look even while the animations are off if I trigger it manually
Which means this is not necessarily not animating it's just not getting any updates that would tell it to look different in the first place.
Are you getting the dashboard from the playerdata?
Yeah
function getPlayerVehicleDashboard(id)
local data = getPlayerData(id)
return data and data.vehicleDashboard
end
@fast galleon
I guess edit the pretender to see what happens there
in ISPlayerData.lua
Calling :prerender() on the dashboard actually does nothing during this non-animating situation
afiak
Eh I'll add a print to it
Oh wow interesting
The prerender is still running but not drawing any of its updates.
Just spammed a print statement by adding one to the top of that function
So it's trying to run the function that seems to update values, but it decides to drop out and not do that because UI is off for some unknown more specific reason...
AHA
I FIGURED IT OUT
Ugh how did I miss that shit
So obvious in retrospect
if not self.vehicle or not ISUIHandler.allUIVisible then return end
Thanks for the moral support @fast galleon @ancient grail @bronze yoke
Sorry to waste people's time with that lol
Ugh what an annoying line of code... lmao I really don't want to have to lie about ISUIHandler.allUIVisible state NOR do I want to edit the vanilla prerender in a non-decorative way... gonna have to make an alternate prerender function that is almost identical to the original and swap them when I am in hidden-UI mode
Mega oof
wrap it and change var around it
Mmmmmmmm that's a great idea.
I love it
Thanks
That did it @fast galleon
Yaaaaay another vanilla bug eliminated
Die bugs die
I am just using this with no conditions and no apparent errors... it's almost like the ISUIHandler visibility check is completely pointless and in fact wrong... can anyone think of any reasons WHY the dev believed they needed to check ISUIHandler visibility in that prerender?
Could it be strictly because they had no plans to let you see the dashboard with HUD off?
Is there a better reason I'm not seeing?
"this":
DOTZ.oldDashboardPrerender = ISVehicleDashboard.prerender
function ISVehicleDashboard:prerender()
ISUIHandler.allUIVisible = true
DOTZ.oldDashboardPrerender(self)
ISUIHandler.allUIVisible = false
end
I am using it with HUD visible, HUD invisible, getting out of my car and back in, 0 issues. So now I'm confused why they even check allUIVisible at all
Found a cool website with a bunch of useful functions for common tasks for data handling of things like color data types. (yay)
Am currently translating these color functions for my PipeWrench UI library. 🙂
you might want to save a local bool of what it was before
and set it to what it was in end
Oh of course doh
DOTZ.oldDashboardPrerender = ISVehicleDashboard.prerender
function ISVehicleDashboard:prerender()
local oldVisibility = ISUIHandler.allUIVisible
ISUIHandler.allUIVisible = true
DOTZ.oldDashboardPrerender(self)
ISUIHandler.allUIVisible = oldVisibility
end
There that's better.
Thanks again @fast galleon
Do you know exactly how it works? Im using getItemContainer():getItems() but it gives me an arraylist. Is there a way “decode” it into a table with normal types?
local items = -- put however you're getting the items here
for i = 0, items:size()-1 do
local item = items:get(i)
-- you can operate on them here, like looping through a table
end
Does that work for ItemContainers? I get i through IsoThumpable:getContainer but during the items:size call it fails
the only reason i can see that failing is if the thumpable doesn't have a container
an ArrayList is a Java type
it's just marshalled into Lua
you can call all the same functions it has in Java from Lua
Yeah but its a vending machine which does have a container as i can access it through getContainingItem
Well not trough but i can call getContainingItem on it
hi guys im new to zomboid modding could anyone explain to me how i should mod order
you seem to miss a :getItems()
So getItems():size then?
items should be (however you're getting the container):getItems()
So I've got a user reporting an error that I am lost with
Apparently id = style:getName(), is the problem line with the error Object tried to call nil
You can see a bit further up if beardStyle:getLevel() < currentBeardStyle:getLevel() and beardStyle:getName() ~= "" then where getName() is used but it doesn't cause any problems there?
I can't actually reproduce this error either. does anyone have any idea what is causing this?
This is the code that generates a list of beard styles for the user to select from.
-- if we have a beard long enough to trim it
if currentBeardStyle and currentBeardStyle:getLevel() > 0 then
local beardMenu = context
if isDebugEnabled() then
beardMenu:addOption("[DEBUG] Grow Long", player, ISCharacterScreen.onTrimBeard, "Long");
end
local all_stlyes = {}
local options = {}
-- add all "under level" we can find, any level 2 beard/hair can be trim into a level 1
local allBeard = getBeardStylesInstance():getAllStyles();
for i=0, allBeard:size()-1 do
local beardStyle = allBeard:get(i);
if beardStyle:getLevel() < currentBeardStyle:getLevel() and beardStyle:getName() ~= "" then
table.insert(all_stlyes, beardStyle)
end
end
-- add other special trim (a goatee can become a moustache, etc.)
for i=0, currentBeardStyle:getTrimChoices():size()-1 do
table.insert(all_stlyes, currentBeardStyle:getTrimChoices():get(i))
end
table.insert(options, {
id = "",
display = getText("IGUI_Beard_None"),
selected = false,
getterName = "getBeardModel",
setterName = "setBeardModel",
requirements = {
razor = player:getInventory():containsEvalRecurse(predicateRazor),
scissors = player:getInventory():containsEvalRecurse(predicateScissors),
},
})
for k,style in pairs(all_stlyes) do
table.insert(options, {
id = style:getName(),
display = getText("IGUI_Beard_" .. style:getName()),
getterName = "getBeardModel",
setterName = "setBeardModel",
selected = false,
requirements = {
razor = player:getInventory():containsEvalRecurse(predicateRazor),
scissors = player:getInventory():containsEvalRecurse(predicateScissors),
},
})
end
end```
anyone knows if bIsAimedFirearm in HandWeapon return true if you can generally aim the weapon or of it's aimed right now? Looking for ways to check if weapon category is firearm
isRanged()?
missed that one, thx
I'd say he has trim choices or the error is in another place
you can use ipairs in this place
Im only on mobile atm. Will help u later when i get back home
I think it's because you start your array at 0 instead of 1 when looping through allBeards: for i=0, allBeard:size()-1 do
so the first call to local beardStyle = allBeard:get(0); returns nil.
edit: disregard, shoulda saw it wasn't a lua table by the :size call. Poltergeist seems right, the getName probably fails on a trim
java arrays start at 0
Thinking about it I've never actually checked what the trim choices do
I think It's also the only thing that happens in-game that doesn't happen on the main menu which would explain why it isn't crashing there. I'll try it out soon. thanks!
how do i reopen lua log in-game
hello does anyone know whats the type for floats so that sandbox ui apears
integers work but floats wont
double
thx
You mean the command line? I think its ^
ah ty
so I was told I can't make StaticModel's use collision and I should use tiles
so I'm trying to associate a tile as an item like a chest or generator or fridge or anything so I can spawn it and make it addressable in-game with collision.
So is this possible and if so how would I go about accomplishing this as all I'm seeing/being told is I have to add things by hand in a tile editor?
You were correct
what exactly are you doing
what purpose you need to get the containers
Accessing the inventory of a container through the context menu
Well atleast for now printing the results to the command line but i got the hang of it how to call them
Now i just need to figure out the ISPanel stuff out to create a window
printItemsOnContainers = function(player)
local containers = ISInventoryPaneContextMenu.getContainers(player)
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);
print(item)
end
end
end
here you go
just got home
goodluck
ah you want to use that on context menu? you can just convert it
printItemsOnContainers = function(player)
local containers = ISInventoryPaneContextMenu.getContainers(player)
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);
print(item)
context:addOption(item, nil, nil);
end
end
end
try this not sure if it will work
Oh no i got that part i just need the window popup
Nono i mean an actual window that pops up after you click the option its of the samt type as the player stats window in debug
A whole new panel
:<
Getting weird errors after hitting confirm and the number I entered in input sets to 0.01 or -0.01
Is it a number issue?
Also, I can't seem to enter . in inputs?
Figured out the float issue
managed to get a float in my wallet while testing
threw off all the numbers going forward
The min/max of the slider is still 0.01 off hmmm
Does anyone know how to create categories for this area?
https://media.discordapp.net/attachments/1049172004634366023/1056312362862399539/image.png
You just need "Category:[whatever]," in your recipe and it'll appear under the [whatever] category in the crafting menu in the game.
And you can make it translate by adding ' IGUI_CraftCategory_[whatever] = "[whatever in another language]", ' to an IGUI translation txt file.
it seems to be there in the image
I mean, dont appear in the game and appears an error
Any people familiar with more nuanced math stuff know why 'math.floor(n*100)/100' is producing really tiny floats?
It's a floating-point calculation, so nothing is wrong.
You'll need to format your string.
it's meant to be a number though
Sure. When you print it, it transforms into a string. Floating points often have trailing errors in several decimals. You'll need to format the string before printing it.
This is normal behavior.
So the numbers are correct it's just displaying incorrectly?
math.round(myVal * 1000) / 1000 will give you 3 decimal places.
If you don't want those decimal values showing, then it wouldn't be for your case, however the result is perfectly normal.
They don't show in the display only in debug stuff
but it's creating issues for the UI
Again, all floating points "float". It appears that this value that you've calculated met the threshold of floating points that when printed will show more of the value.
Most languages check floating point values when printed or turned into a string.
I understand, just not sure how to address it
Try using this. You'll get to 3 decimal places.
tostring(math.round(myVal * 1000) / 1000)
What do you mean?
math.round seems to not be a thing in pz?
Isn't there a round?
Math.round might work
The drug info is stored in its own lua file, the stuff I’m storing in player mod data is in regards to the accumulated effects for the sake of tracking the degree of use, addiction, overdose, that sorta stuff
I wasn't sure as you had screeneffects listed
Just trying to get a better picture of what you were trying to get
Oh ye, so this is in a lua file. I have a constructor module, and each drug will have its own table. All that is stored in the lua.
Goal is that I can get the name of the table to reference from item mod data, which will tell me everything I need. Screen effects is a Boolean I am going to check in the future- for now I’m not touching the effects until I can get the rest of the framework built
Seems to be working well - swapped floor with round - left it at *100
The files you see up there tho have been changed, the keyValue system doesn’t play well with the lua interpreter for PZ
So I swapped back to a constructor module
Ah, I misunderstood and thought you were adding screen effects as a list to each player
I was thinking of ways to improve the medical system using medications and such - so I was curious about your approach
lol
If you have ideas, our goal is to put out this mod in a few phases. Basically first is usable drugs that spawn out in the world. Once that is done we want to add additional medication and a crafting system for the drugs/meds and anything else we can have make sense for effectively an ingame chemistry system
So we are all ears on any medication stuff 😂 always down to work with others on mods too
Glad to hear
I was going to focus more on in world items - more uses for them - more injuries/illnesses
one specific feature I had in mind was not knowing what each medication does unless you have enough medical skill
but as a philosophy/foundation I would want it to scale easily
so I was thinking tables that can cross check for drug interactions
For the current state of my mod, the goal is through the use of drug categories like “stimulants” and “depressants”. If you take amphetamines or coke player mod data will track the increase in stimulants. But, something like if the player has both stims and depressants active, that can lead to harsh negative effects
I think keeping it simplified/gamified is the best approach
Guys can u help me with math
Convert the weight into~~ 8$~~ 6cash based on every .1 weight
So that math would be math.floor(weight/6)
Or is it *
you want every .1 weight to be worth 8$? just do value = weight * 80
Ye changed to 6
Maybe I should release my money as a separate mod lol
Forgot to change the problem only the solution ill fix that
Noticed a lot of people making money related mods lately. Feel like it’d benefit from a single “framework” style mod lol
I think it has a few benefits
Hey y'all. Anyone know of a way to set the replacePrimaryHand on an item's definition at runtime? Source: https://projectzomboid.com/modding/zombie/scripting/objects/Item.html#replacePrimaryHand
Seems this is something that can only be set in the ".txt" file that defines the item, and the game keeps it internal to Java. Looks like an "ItemReplacment" JavaObject is required to be set, but there is no "new()" function for it in Lua so can't make one. Hopefully I'm missing something, or maybe there's another way to do it?
declaration: package: zombie.scripting.objects, class: Item
i'd honestly rather work with your money if it came out separately, but it's not my decision to make unfortunately
for k, v in pairs(getScriptManager():getAllItems()) do
local goldItem = v:getFullType():contains("Gold")
print(v..": "..goldItem)
end
@bronze yoke will this work
You're trying to value jewelry based on weight?
if you're trying to print all the items with the word 'gold' in their name then yes
Yes
I made it so you can disable wallets and you could not put up shops - so technically you could just have the money from shops and traders
What is your current money mod, btw?
If i get the full type then thats the thing i need to put on a table
Shops and Traders (if you're asking me)
The money isn't alone - but yes it's out
going to be pushing an update and a sub-mod for it soon
Yeah, meant to paste it sooner
what am I missing here?
player:getModData().DynamicTraitsWorld = player:getModData().DynamicTraitsWorld or {};
local modData = player:getModData().DynamicTraitsWorld
if modData.Bloodlust.BloodlustProgress and player:HasTrait("Bloodlust") then
modData.Bloodlust.BloodlustProgress = SandboxVars.DynamicTraitsWorld.BloodlustProgress;
else
modData.Bloodlust.BloodlustProgress = modData.Bloodlust.BloodlustProgress or 0;
end
print("BLP:"..modData.Bloodlust.BloodlustProgress);```
if moddata value doesn't exits and player has trait it should set it to sandbox value. otherwise it should use existing value if it exists or 0 if it doesn't. This is called on OnCreatePlayer. It sets it to 0 when player has the trait. What am I missing here?
is the sandboxvar zero?
oh this is happening because
if modData.Bloodlust.BloodlustProgress and player:HasTrait("Bloodlust") then
this says 'if the moddata DOES exist and they have the trait'
Yeah haha, I thought that was the issue. Gotta love the way modding has its way of making you feel like an idiot sometimes 😂
Spent like 3 hours yesterday trying to figure out why a function was failing to pull the mod data from an item.
I had it typed as item.getModData().DrugId
It took me so damn long to realize I put item. Instead of item:
been there done that
spent earlier 5 min trying to figure out why character:IsZombie() not working
cuz it's isZombie()

you two need intellij bad
ye

fuck it
im doing it
what's better time to migrate to other IDE than midnight on xmas eve

good news that I already have itelliji
I have it 😥
With full Java decomp…
I’m just dumb lol
did it not complain about number of arguments?
I don’t remember, it was honestly like 2am… so I was just coding on full monkey brain
actually mine doesn't 😥
Damn… guess IntelliJ is bad, I’ll just have to go back to coding in notepad 🥸
Anyone has a snippet of a function like this
Remove the entries of a table if its an entry of this table
Like a black list thing
for k,v in pairs(t) do
if blacklist[v] then t[k] = nil end
end
if your table uses numerical keys you can use
for i = 1, #t do
if blacklist[t[i]] then t[i] =nil end
end
```which is a little faster
Ah for loops are faster?
pairs is a function so it's always going to be a bit slower
ah i see thnx alot albion
because it's a chinese project
pog it works
let's goo
idk why it wants to highlight true, gonna go dig in code appearance settigns
yeah emmylua has some ugly and unnecessary formatting by default
i don't recall
color scheme
honestly i see why it would highlight that
if boolean == true is some of the most cursed code possible
it just highlights true and false no matter what
I was promised auto-fill and I was let down 
yeah, events are created at runtime so you still need to remember those
you can probably just drop a table into your lua docs honestly
like new events? or new functions to the existing events?
the answer to both is yes
cool
then instead of initializing events on game start i'll do it on create player and add events only for perks that they have
or capable of gaining

micro-optimizing go brrrrrr
anyone knows how to make inteliji fold {} blocks in .txt files?
cuz not being able to fold 600 lines sandbox options is gonna make me unalive myslef 
in PZ thunderstorm can ONYL be present if its raining right?
Is it possible to automatically add something to the auto - clear list?
is there a limit to the amount of types an item can have?
if it's a table i don't see why there would be one cuz i'd guess it's safe to assume that anything that checks for item types goes through array
i thought that but then i remembered that the most variants i've seen on a single item is 20, so i was wondering if that was a coincidence or some kinda cap from the game

i have 30ish technically so imma just try doing all of them since its just one line each lol
i'm like 99% sure they are not capped
disclaimer: havent done any items so idk

but it's just be plain dumb if it's table but for some reason it's allowed to have only 20 entries
ya im sure its uncapped if its a table
this is my first time doing a clothing mod so i'm just doing a ton of textures, make the item work for as many outfits as possible i guess haha
plus tintables but that has to be its own items each so its nbd
ok whoever told me to use inteliji
you better tell me how to make text fold to next line'
i dont want to scroll
left and right
in 2022
How plausible is it to make a mod that immediately pauses the game world when you first log in to the game? I need to do just that for divine intervention with the debug console to save a dying character that otherwise dies immediately.
Should be easy enough. Would just need:
UIManager.getSpeedControls():ButtonClicked("Pause")
end)```
fuck this inteliji bullshit
cant even softwrap lines
and now it fucking hardwraps my translation files
and breaks them
great IDE
how have you got it to do that??
i dont fucking know, i was trying to dind option to softwrap
this is actually malding
k i jsut reset settings to default, at least it doesnt break my translation files anymore
Thank you, fantastic - gives me an excuse to look into the modding tools.
softwrap? pretty sure it's got that feature and more
im not scrolling left and right
in my IDE
I'd rather stay in VSCode than scroll left and right
god this shit was hidden
Yeah, there's alot of features - almost too many
hard ot find stuff
it has it's own search bar
spend 20 min trying to find fucking softwrap
it's right there
mfw
Also today I learned to use this syntax/wrap/whatever its called
local rainGain = 5 * rainIntensity * (player:HasTrait("Pluviophile") and 1.2 or 1) * (isThunderstorm and 3 or 1);

yeah and statements are evil
in a good or bad way

like it doesn't really make any sense to look at but oh my god am i glad it exists

agree
well that's enough modding for today, time to sleep, tomorrow big mod update in Imperator Rome 
Literally a Christmas present 

Does changing the hitrate from like 25 to 80 increases the accuracy of the weapon? Like ill be able to hit better? Also how does aiming skill affect hitrate?
Im not exactly a modder nor do i know codes, but i could understand the scripts on mods that i downloaded, well kinda since im abit familiar without those kinds of scripts
seems like the type thing has no limit*, that's all the textures i added
hello: trying to get an answer to what I hope is an easy question.
I can make a 3d model, name it, spawn it in game and interact with it.
I wish to do the same with a simple tile. I can create the tilepack, definitions, place and confirm that the tiles are in-game. What I can't seem to find an answer to:
Like a generator or mini fridge, etc. How can I address the item in Lua to place/spawn it or any interaction really, or associate it as an item?
Like surely I gotta be missing a step to just say something like
local my_customitem = getItemOrTileOrAnythingAtAll()
? Any help would be appreciated
(Borrowing Let Me Think's poster.png)
I did some reading on making mods, found the folder I think it goes in, managed to get it to show up in the game, activated it; but when I actually run it, it doesn't seem to work; is this the kind of thing I'd have to worry about mod load order, or is it something more basic/obvious that I'm missing?
it could just be too early to pause the game
are you trying to revive a dead player with some database trickery?
Your code should go in:
media/lua/client/InstantPause.lua
Yup, exactly that; I can modify the character's deathstate to him being alive, but as he's being pretty annihilated by zombies I need to pause to acces debug to give him godmode temporarily (until I can get him out of the situation)
Oh, perfect, thanks
oh, yeah, the file won't even load if it's not in client, shared or server
i can tell you that what you are doing is possible
i've done it before with a slightly different method that i don't remember the exact details of
That said, I would think you should be able to accomplish the same thing by spamming the "Pause" keybind on game start. 🙂
i think i edited the player's data with a hex editor to flip god mode on? that might have been one of the things i tried that didn't work though...
I'd think so too, but either I'm doing it wrong or my computer's just too quick to load things; I was also worried about pausing, but unpausing immediately. I tried it like 15 times before realizing I wasn't making headway.
actually i think it could've ended up being as simple as 'open another save, turn on god mode, load the actual save'...? i remember 'things i tried' a lot clearer than 'this thing actually worked' 😅
nvm found it
Well it seems to be working! Thank you kindly, time to save this poor soul.
are you just trying to get their sprite names?
i know the sprite names
atmTiles = {"location_business_bank_01_64", "location_business_bank_01_65", "location_business_bank_01_66" , "location_business_bank_01_67"}
im trying to capture them via context
onfill
i got it
So I still die even with godmode/healing myself because it (correctly) recognizes me as dead even after I heal myself. I'll plug in CheatMenu and see if the PreventDeath Mode can actually handle it.
Well, we've done it - thank you everyone, it felt impossible for a bit.
Is there a way to make the drunk effects last A LOT longer?
I get sober with 20 minutes usually
Trying to figure out where to start with modding the base map to create a building for it
There's a distinct lack of fire lookouts
From what I hear, you need to recreate the cell you want to modify in the editor, then add in your fire lookout.
Players using your mod will also need to worry about your fire lookouts either overwriting other modded locations they may have in that cell, or having the fire lookout overwritten by the other modded location.
So I'd suggest looking into using the map editor, and once you've decided on a place for your fire lookouts, make sure each one is in just a single cell, so if a user overwrites it, they won't have, say, half-a-staircase hanging at the edge of a cell.
As for tips to actually get started, I'm afraid I don't know 😦
This is actually very useful information, I know I would need to keep an eye out for other modded locations in the game but knowing the deal with the cells is very helpful, thank you
How does aiming skill affect hitrate chance of range weapons?
Like in general (Should be on the Wiki) or where is the code?
Idk, im just viewing the scriptfile from the mod i dl
The normal txt file or something
AimingPerkHitChanceModifier = 12,
AimingPerkMinAngleModifier = 0.05,
These stats should be the ones influenced by the Aiming skill. Everything else is just your baseline levels.
I understand the former, but how does the latter work?
I think it reduces the Minimum Spread Angle by 0.05 per level in Aiming.
In other words, it should let you aim longer to get a more precise shot at the zeds.
There's also two stats for Crit and Range
AimingPerkCritModifier = 10,
AimingPerkRangeModifier = 1.5,
Hmm i see, so its that orange green outline on b41, idk about b40 tho
Yes i could understand these parts
Yeah it should be. Never played b40, so I couldn't speculate on that.
are you sure that's it? wouldn't that make these two lines do the same thing?
Yes but no
I was under the impression that the HitChance is your chance to hit something within the current Angle, and that MinAngle determines whether the shot might just fire so wide your HitChance doesn't matter at all.
Yep that sounds more like it
I reckon this is why shotguns have a huge HitChance, because there's already plenty risk your angle will make you miss at intermediate range.
But I don't know this for sure, I'll admit.
Iirc theres a code that tell like how many bullets per shot
ProjectileCount = 5,
MaxHitCount = 4,
First line is how many projectiles to try to hit with per shot, and MaxHitCount is how many projectiles are allowed to hit and/or the overpenetration chance. I forget which one exactly.
Is there a certain spot of the zomboid folder where the cells are stored? I just wanna see if there's a "get out of work free" kind of card so I can take the cell and change it to my likings while keeping it flush with the environment instead of having to recreate it fully
fair enough
no
fudge
Are cells different from chunk?
the editable format is not available for the vanilla map
damn, so would have to recreate it one for one
alright makes sense actually
seeing how most mods have weird cell differences with the building mods that make my ocd go crazy
thank you all anyways
Perhaps knowing that will let your ocd rest a bit, now 😛
yeah, at least i know it isnt a purposeful choice
unless it isnt 
Perhaps ask in #mapping for some advice, too 😄
Took me a hot second to realise we have a dedicated channel for, well, what you're doing!
Is learning lua important on creating pz mods?
for most types of mods yes
What are the minor types of mods that doesnt need lua knowledge?
if you just add a generic item or something you might not need any special programming
Lua isn't too bad a language to learn. I remember it being one of the first scripts I toyed with way back with Stranded 2.
But itll still take months to learn, ill try learning it bit by bit tho
Start small. Try out doing just some small stuff at first.
Oh, and are you familiar with IDEs or anything like that already?
Nop
If i learn lua, itll be my first programming experience
Unless u consider a certain game's command block 
Then I suggest just getting a good text editor (my preference is Visual Studio Code - or VSCode for short), and once you feel like you're ready for some supporting setups, you can look up PZ-Libraries and use that with IntelliJ IDEA which is a full-fledge IDE.
It's a bit much to jump into an IDE day 1, imo. Too much setup and you'll lose the will to program before you get anything done 😄
I have note++
I started making mods 3 days ago and with the basics of Lua I more or less managed to understand the lua files of pz, what is difficult for me now is to understand the parameters of the methods
i started to learn lua two weeks ago
I'd suggest opening a whole folder in Notepad++ to make your life a little easier (just drag and drop your mod directory).
Once you have your mod folder open, you can also open the full Zomboid/media directory so you can search in all the vanilla files for existing uses of things.
Arigathanksgosaimuch

Same tip for you, with regards to the parameters, open up the Zomboid/media directory and search in all the files/folders to see existing uses. It helps a ton.
You can also spend the time setting up PZ-Libraries in IntelliJ for some really in-depth options.. But still a lot of searching in files.
I'm currently using vscode, I think so, it's time to switch
There's a very lovely in-depth tutorial on the PZ-Libraries GitHub on how to set things up. You can just google it.
Knock on wood but
This is actually really simple
Very good very nice
Created a little forest area and pond in less than an hour
er about an hour correction
Nice


worldzed is being weird
im following the instructions of tilezed > tools > worldzed > new window popup instance of worldzed
but this pops up infront of worldzed
and no matter what i click
it just closes worldzed
dunno what do
😦
if anyone knows what to do, please @ me the response or respond to it with the respond feature or any way because i have a cold and i am not gonna work all night on this for christmas 
goodnightfolks
Good night, MF, and Merry Christmas + swift recovery!
thank you very much, and thank you again for the help!
I have a question of my own, just a simple one: Is getServerModData safe to use for MP, or should I store ModData on items and players instead?
I think my brain shortcircuited on that one. getServerModData doesn't even return a value, so that wouldn't work anyway.
lol
So, time to try a strategy that'll (hopefully) give me a list of all players, even the offline ones 😄
Actually, I think I have a solution. Since we have Lua script checking so users don't modify scripts:
I can run (on each client) a tick every X minutes, and just use that to increment some info I need. Excellent.
Trying to create an XP log of sorts so I know roughly when you earned a specific amount of XP for different things, then let you write that down in your diary.
... There's an AddXP event.
F
This makes my life much easier, so all in all, this is good 😄
imanage to create a function to convert the atms into containers but i can seem to make it solidtrans
i can still pass thru it even if i set it to canpassthru false
any ideas how i set it so that i cant run thru it
Make sure you spawn new ones / make a new save when testing. Sometimes tiles can keep old behaviours if you save the game.
I made a freezer mod once which had lights you could turn on/off, but even after removing the light functionality, the freezers already in the world continued to have that feature.
hmmm
how exactly did you convert it
cuz mine i used manual method
to so that default atms dont have the feature cuz im going to convert it to a cash trading thing
allows player to convert gold to cash
Unsure, sorry 😦
Anyone knows by coincidence where TIS put their music? Trying to change some tracks but they are all linked to NewMusic and OldMusic paths in their scripts
No audio equipment to listen for myself, but looks like it is all in ProjectZomboid/media/music/?
Yeah thought so too but it seems there are no folders for either NewMusic or OldMusic
Im gonna verify rq
Right, I see what you mean now.
Tried looking through the banks but neither are they there
I'm not seeing anything in the Java code, either.
TIS black magic
Someone knows how to copy a filtered table? i have
`local equippedClothes = {}
local count = 0
for i = 0, items:size() - 1 do
local loopitem = items:get(i)
if loopitem:isClothing() and loopitem:isEquipped() then
equippedClothes[count] = loopitem
count = count + 1
end
end`
tried this one but can´t use index to copy table
for index=0, items:size() -1 do print(index, items:get(index)) end
someone help
this truck is from that one car mod
and I put my clothes in the passenger seat
then i got in from the other side and it sent my clothes to the back seats that dont exist
bro
🤣
how tf Do i get em back
download backrooms map
Good morning and merry Xmas.
Good morning and merry xmas @jagged ingot
Once you use {} in lua it's not an array anymore - you have to use table interactions




