#mod_development
1 messages Β· Page 322 of 1
I tried this, but it never gets called:
function VehiclePart:getTable(name)
local tbl = old_getTable(self, name)
print("Made it.")
return tbl
end```
it's from Java, not a Lua function
yea that wouldn't work. getTable is a java function. There's a way without worrying about it. Worst case you grab the context menu and rip it out there. Let me dig around some more
Better Car Physics replaces BaseVehicle.class. Would it be too crazy to recompile VehiclePart.class to make getTable() call a Lua function that can be overriden?
I don't like it, but all other solutions I can come by result in overriding a shitton of Lua functions to mitigate this, and it end up being a potential compatibility issue with other mods. Being able to edit the table at run time would mean full compatibility. At least in my meager understanding of PZ and modding it (and Java and Lua also, loool)
overriding a shitton of lua functions is going to way better in the long run then replacing game files.
for the moment, I know UninstallTest and that idea you gave me has a success path, even though I might need to rewrite a lot of vanilla vehicle lua code
if you can get the part script, you can remove the jack from the needed items, and then put it back after the action is finished
definetely. I just can see it there, so close... overriding getTable() would be so simple, and it would cascade down the call stack like a charm
and other mods wouldn't even know it. oh, I just don't need a Jack...
it's something i haven't messed with much so I need to dig around and see what options there are
hey, thank you very much for your help. I didn't say it enough
you already gave me good ideas I didn't see before
I'll walk the dog and have a thinking session while at it
I was playing around with the IsoCell, thinking i might be able to change the loaded area, but i seem to go nowhere with that one.
There is a mod called Better FPS that changes the ChunkMap but it does so in java. Is it possible that it is... not possible to change the size of the loaded area with lua? Does anyone know?
stupid hashmaps
I highly doubt you can
Most likely the reason it's a java mod
We have zero control on map loading from the Lua
We can't even force load a specific area
Tho there might be some tricks no one has found yet for that who knows
But I'd be surprised...
Thx, thats what i feared, but its good to have confirmation. π Was kinda hoping for it to be possible, but was thinking that if someone does a java mod for it, then its probably not.
I've yet to see anything that does something remotely close with a Lua mod. I could be wrong tbf
Idk how many people dug on that aspect either
Yeah, i dont think ill succeed where so many others failed (probably ^^). Also i did jsut do a short comparison between what those guys do in their mod and what is done in the original. Turns out, most of it boils down to one line:
original: private static int StartChunkGridWidth = 13;
1080p mod: private static int StartChunkGridWidth = 8;
static eh... XD
I think it being static isn't the problem, it's mostly just that you don't have any setter for these that exist I think ?
Tho I'm probably completely wrong
the problem is, 3 5 functions need to be modified for install and uninstall
No i dont think so. Just checked, coudnt find any setter for either StartChukGridWitdth nor ChunkGridWidth π¦
I think if they gave us that, we could do some really nice stuff.
Not really tbf
I don't see any other application than just this single application of boosting FPS
There's literally 0 point to dynamically setting this value
they don't usually like exposing internals like that
FPS is important too, but by contracting and expanding the loaded area freely, you also would have control over the are where zomboids are 'active' so to speak (ofc i might have gooten it wrong)
Not sure what you mean, is the loading area really that sensitive?
But you omit one thing is that increasing this value increases AROUND the player
Not just at a specific area of the map
So there's no point to dynamically increasing that value
Also at best you're probably to cause a fuck ton of problems by dynamically changing that value
Imo that's just pure hazard to leave such a parameter available to change by modders easily
I wouldn't mess with chunks tbh.
Experimented a bit with that way back in FO3 modding. It's a slippery slope.
I agree on it being able to cause shit ton of trouble, also i dont quite know whate youre getting at with the committing thing? Wasnt it clear that its around the player? I just imagined how it would look if all of LVs population would suddenly march towards a certain point while you hide in some building and see the stream of zombies march down the street. Well, thats just my mind imagine me messing around with stuff, but still... ^^
That's already a thing ?
Zombies are "simulated" further than the loaded chunks
Yeah, so? I tryed to lure those around but they dont quite act on it? Well that or i did something wrong which is absolutly possible since when i mess around, i can be quite tired sometimes. XD
i just don't get why you'd want to do that in the first place
You can lure them with a world sound
That's how they get lured from firearms for example
There's a lot of mods that utilize this
You mean the loading area? It came from my initial question about cars and performance - from where i went to: if i could reduce the loading area to a minimum around the car, would it help with the performance of multiple people driving all over the map.
Honestly, me messing with this stuff is mostly about me learning how things work. π
Yes, but somehow it only worked on the guys that where loaded, well, might have been to tired last time, so ill look into it again. π
Ah well desync is fucking insane to handle in PZ lol
Supposedly this is getting improved in B42
One can hope so. But yeah, meeting black areas while driving isnt a lot of fun. ^^
Tbf I feel like we get in a part of the game where it's literally not even the job of modders to fix that
And it should one of the priorities of devs to fix render issues and desync issues. Which is something that was improved in B42 it seems
We'll see when MP comes out
yes, that is crazy. If you only care about the java function when it gets called from lua you can overide that in lua
example:
local index = __classmetatables[DevicePresets.class].__index
local old_addPreset = index.addPreset
index.addPreset = function(self, ...)
local maxPresets = self:getMaxPresets()
if self:getPresets():size() >= maxPresets then
self:setMaxPresets(maxPresets + 1)
end
old_addPreset(self, ...)
end
That overrides DevicePresets:addPreset() when called from lua (i.e.: a java function calling DevicePresets:addPreset() will ignore it)
Credit to Albion for this deep magic.
Remember that making a mod that need java files replaced is a commitment from you to keep it updated as versions change, and requires extra work from every user... so it needs to be something important enough to justify that with no other option.
was I having a conversation with them and not understanding what they were after?
Unless I'm mixing people up, the goal is to not need a car jack when parked near a mechanics lift
Which is a really good idea!
ha, I thought I was having a stroke or something
The issue I saw is, they would also need to overwrite canInstallPart and canUninstallPart which just calls the test functions in the part script
but there should be no need for java mods since the mechanics interface is in LUA (possibly other than tooltip generation, but that might not be done the same as InventoryItem tooltips)
Overwrite as in completely replace, or just prefix/postfix?
the way I did it was to catch it in the tests and the doMenu.
the test functions in the part script
WHere does that get defined? If the test function could be changed that's an easy fix.
I already undid my work but I have some notes
if liftNearby then
for i = 1, #keyvalues.items - 1 do
local item = keyvalues.items[i]
if item.type == "Base.Jack" then
table.remove(keyvalues.items, i)
break
end
end
end
that would need to go in the lua tests and the context menu after part:getTable
Set a variable when opening the mechaincs menu if a lift is found, then the new test function takes that into consideration and falls back to the vanilla function if it does not need it
That looks good too
just zap it before it's checked
I really wanted to modify the part script on the fly but I think that would cause issues if say, you stopped the install before completion. it would turn in to a nightmare to get the script back to what it should be
if liftNearby or player:getStrength()=10 then -- motivation to exercise
I pulled weeds in my front garden and noticed today I'm player strength -2
you;d have to add a reset to the start just in case.. and it feels messier than just removing the jack at the right moment like you did
I'm Flexability -2
meee tooo
"Pushed a shopping trolley around that is too low to be comfortable using so you have to bend over a bit the whole time? PAIN MOODLE!"
the ISVehicleMechanics.doPartContextMenu only calls canUninstallPart/canInstallPart which checks the install/uninstall tests anyways. The only way to ditch the red "you don't have a jack" is to get it out of the items table. I mean, it can mucked but you're going to have to get in to those test scripts anyway. From what I can tell.
I think that's an elegant approach
I like you. but not really elegant because there's 3-5 functions that need changed to make it work
So change 3-5 functions, not a big deal really.
Unless you mean "fully overwrite because it's not practical with a prefix" in which case I'd be looking at putting the mod in the too hard basket, because of risk of conflict with other mods just to not use a jack.
(or looking for another way even if it's harder to code)
I mean, if my mod add a prefix to the function will this approach wipe that out?
depends on load order
you know it would. It's PZ
hooking VehiclePart:getTable() may be the elgant solution
it is, but that doesn't fix the context menu
it would let you uninstall it, but would still have red text saying you need a jack
you know
add a line to the end of the tooltip "jack requirment ignored due to lift"
maybe grab the menu on click, rip the jack out of the items table and then send it on it's way
the menu has to has to reference the part I would think
would still need the VehiclePart:getTable() override for the tests. idk, I'm over thinking it
this guy has a mod that overwrites like 5 java functions and 2 lua functions
and I can't even figure out how to center this damn text in the window
https://steamcommunity.com/sharedfiles/filedetails/?id=3454255518&searchtext=camp Added an extension of@brave bone's "Camp in the rain" mod to make tents also protect campfires
ahhh it seems you changed your perspective regarding load order
only in build 42
also depends on what you mean by load order
the file load order always matters in build 41, but mod load order doesn't matter until b42
this is useful info..
i wonder why they made it so that it matters?
is it better this way?
i think it's worse
What does that mean for mod development when the load order starts to matter? (Still doing .41)
Proof that UI coding is horrible.
There's a reason every sane developer uses some sort of easy-to-use framework instead of hand-coding each piece in Java with some lua sauce.
@silent zealot and @queen oasis those are great ideas. I will check the Java override example you gave, since I think all calls are from Lua
I also had another idea while walking the dog. Instead of removing the jack requirement, InstallTest and UninstallTest both call to VehicleUtils.getItems(). If a Lift is near, I could insert a bogus Jack (maybe a CarLift item) which will satisfy the Base.Jack need, and then both will call to ISVehiclePartMenu.transferRequiredItems() and ISVehiclePartMenu.equipRequiredItems(), where I could just ignore those items
that would keep the Jack on the Tooltip, and it will show green since it found a tool with the right type. And then just ignore getting that tool into inventory and then equipping it.
I just got out of MP server with some friends. I will cook some dinner and give it a go. I will try first overriding getTable() since I think it's the fastest and cleanest way
and this will come in handy, since I wasn't exactly sure how to remove an element from the table
couldn't resist, it looks like this:
local index = __classmetatables[VehiclePart.class].__index
local old_getTable = index.getTable
index.getTable = function(self, ...)
local keyvalues = old_getTable(self, ...)
if carLiftNearby(self:getVehicle()) then
for i = 1, #keyvalues.items - 1 do
local item = keyvalues.items[i]
if item.type == "Base.Jack" then
table.remove(keyvalues.items, i)
break
end
end
end
return keyvalues
end```
Me learning by doing but still just messing around.
https://youtu.be/c4jb0CCRAtQ
Nothing mod worthy yet, tough. ^^
thx. π
Hm, no idea. O_o Honestly didnt pay attention that being a thing, but youre right, how are they doing it?
found it
Oh pls tell!
DER.lSub = ISContextMenu:getNew(context)
add a newline after the language
'''lua
code'''
or
'''lua
code
'''
looks like it worked, just a not so fancy line
try if, then, end, local, function, etc
Yeah, no coloring for me, but its a step in the right direction
I'm starving, reduced strengh and health recovery. brb
how do you feel with this?
local function isCarLiftNearby(vehicle)
local range = 3 -- how close the Car Lift must be
local square = vehicle:getSquare()
if square == nil then return false end
for dx = -range, range do
for dy = -range, range do
for i=0, square:getObjects():size()-1 do
local obj = square:getObjects():get(i)
if obj and obj:getSprite() and obj:getSprite():getName() == "location_business_machinery_01_11" then
return true
end
end
end
end
return false
end
After the Jack requirement is solved, I will have to deal with the Car Lift item placement in itself... I already dug into it and it's a nightmare to deal with Moveables. I wanted to make it in 4 different items like a Large Shelves
Nice, you got the color going. Also, can you just put a minus before a variable like that? Not that i get why you'd do so or more precisely, for what: since i cant really see what youre using those lops for.
perhaps would anyone know why i just, cannot open the door to get into a vehicle?
I will openly confess ChatGPT generated that code a few days ago, when I decided I wanted to make a Functional Car Lift mod... I have no Java or Lua experience. Only C, C++ and C#
maybe it's locked? is it a modding issue or just a regular playthrough question?
modding issue, might be related to it being a left hand drive vehicle?
Yeah,im also from the c faction. XD have heard a lot about chat gbt doing programms, but i think it migth still need a bit of time to become a true do what i mean machine. ^^
range, dy, and dx arent being used anywhere, so they're just wasted for loops. unless im missing something
i can get in through the radial but not the highlighted thing
crap, you right. I simplified some code and ended up cleaning that part.
nice. which ide are u using? i think vscode tells u when a variable or function is unused, which is really helpful
I'm using VSCode with Lua and Umbrella
local function isCarLiftNearby(vehicle)
local range = 3 -- how close the Car Lift must be
local square = vehicle:getSquare()
if square == nil then return false end
for dx = -range, range do
for dy = -range, range do
local sq = square:getCell():getGridSquare(square:getX() + dx, square:getY() + dy, square:getZ())
if sq then
for i=0, sq:getObjects():size()-1 do
local obj = sq:getObjects():get(i)
if obj and obj:getSprite() and obj:getSprite():getName() == "location_business_machinery_01_11" then
return true
end
end
end
end
end
return false
end
it was telling me, but the difference was so discrete I didn't notice
Dont think it makes a difference, but you should also be able to write:
local sq = getCell():getGridSquare(square:getX() + dx, square:getY() + dy, square:getZ())
I never used it until just recently. It helped me because reviewing its code gave me ideas
Dito, my learning material was/is the code of other mods and the search function. Especially the one her in chanel is a gold mine. Lots of code snippets to look for. Have a doc file where i copy a lot of stuff together i found for later reviews. ^^
I don't exactly know what a cell is, but I'm guessing is a group of squares. How would it know which cell to return?
I've been reading other mods' code for days now lol
Here, that one holds a lot of back ground info. found it when i was looking for what cells and chunks are. Also in essence: getCell gives you the loaded are back (at least if i understood one of albions comments right)
Let me start off by saying that I don't know very much about this game (yet); I've put it in the cooler a few years back, because shortly after buying it the (then still) Mondoids came out showing off the animation system and I didn't want to burn myself out before it released (this isn't a criti...
And I only have 150hs on PZ. Probable 20 of those were testing mods or just idling
thanks, I will read it in a few. I'm about to test some codeee
IT WORKED!!!! first try, both the getTable override and the isCarLiftNearby()
If you know C++ you know Java. Mostly.
code is code
it gets spammed! some virulent checking for the part's table
only when the hood is opened, though
near the lift
a bit far from the lift
One suggestion: have carLiftNearby trigger when you open the mechanics interface and store the result, then when you check from VehiclePart.getTable just look at that stored result. Some of the functions involved in UI get called every single frame, sometimes multiple times, and you don't want to be doing expensive "look at all world objects in a 7x7 area" type stuff that often
... and while I was writing that you discovered exactly what I was talking about π
lol yes. I was thinking where could I store that. I will look into Auto Mechanics, since it does something like that storing the state
Just make a table to store it in
doesn't matter if it gets cleared when you quit and reload
or a single variable, but with a table you can index by vehicle:getKeyId()
but for single player only, no issues just having UsefulCarLift.NearALift = true/false
or whatever you want to call your variable
oh, I'm just an idiot. I was overthinking it because I placed the code on the server side
Just use a distinct name
hahaha
A robust way would be to make a table:
UsefulCarLift.CarsNearLift = {}
Opening the Mechanics interface clears the table
When you call isCarLiftNearby(vehicle) is says if UsefulCarLift.CarsNearLift[vehicle:getKeyId()] ~= nil then return UsefulCarLift.CarsNearLift[vehicle:getKeyId()]
And if it is nil, it does the check/stores it in UsefulCarLift.CarsNearLift[vehicle:getKeyId()] and returns it.
that sounds great. I will take some notes and implement them tomorrow maybe. I'm a bit drowsy now. And I can go to sleep with a small victory
getKeyID() was the best property of a vehicle I could find for indexing, since it's a number that persists and is unique per car.
yes, that sounds about right
Sleep well, mod is looking good and might make me regret sledgehammering my vehicle lifts for more space to work on cars. π
tomorrow I will get this cleaned up and start with the items and pickup/placement
I wanted to make a pickup/placement using vanilla mechanics, but I tried different mods and every one implemented their own Context Menu option π¦
picking up large multi tile objects and splitting them into items, like Shelves and stuff
FYI: there are probably 4 sprites, for each end of a north/south list and each end of an east-west lift.
yes, it was just a test. now only that, each tile has two different sprites
even thought it's a 1x4, it uses 8 sprites
yeh, top/bottom. Takes two sledgehammer destroys.
that's another challenge. I need to find out how to make an item that has two sprites
making it work was the easy part lol
You may be able to just check spritename starts with "location_buisiness_machinery_01_1
after moving a lift?
I guess the same way as a four-part bed does it, but putting more than one sprite on the same tile.
And hope it's not hard-coded to one item -> one sprite, and the 2/4 boxes for 2/4 tile items is just convention.
either way, get some well deserved rest.
And weld some sheet metal onto your hood before you drive anywhere.
I would love something like this. Split the lift in 4 different heavy parts
hahaha I crashed it several times trying to fit it in the lift. It is TIGHT
Such great and memorable sound effects.
I might need to add an extra tile just to make it easier
Need an auto shotgun for MMMMMMMONSTER KILL!
Is there a way to "get" the AmbientStreamManager using lua so you can run its methods such as doAlarm(RoomDef room)? (This is for SP only atm)
gnight, folks. and thanks for you help!
Yeah, old memories can make nostalgic. Was a bit drunk when i started it, trying to find my way into the sound system, but now im quite fond of the whole thing and just keep adding stuff to it. XD Auto shutgun, hmmmmmmmmm, nice idea. π
Not certain about the ambient system honestly, but if you just want sound and zombie attraction, you could use the WordlSoundManger, i think? Im using it for stuff like that, but i might miss the point since i dont know much about the functions you are talking about.
Sound that the player hears and sounds in the world zombies can hear/that stress players are 100% seperate. Can confirm WorldSoundManager is the one to attact zombies.
It has no idea what sounds were actually played, just where and how loud.
i dont have experience with ambient sounds but i do know that ive seen it on tile zed as a property
so i think the emitter are objects
Thanks for your help, friends! I figured it out - For anyone looking for it in the future it is literally just
getAmbientStreamManager()
LOL!
<-- how I feel rn
So, for example, you could do:
getAmbientStreamManager():doGunEvent()
It doesn't get much easier than that I suppose!
I think it's goofy that our character just picks up a cow and moves around,
There should be a mod that makes it that you can't pick a dead cow or any big animal.
Instead you could winch the dead animal to ur carπ€ could that work?
Corpses are special objects, so... maybe.
Hi guys I am trying to make my first mod but it seems all over the place. I can't even load the mod properly. If anyone can tell me what I am doing wrong it'd be much appreciated.
..\Users\[user]\Zomboid\mods\TestMod1\42\media\lua\client\TestMod1.lua
require "ISUI/ISInventoryPaneContextMenu"
local contextMenu = {}
---@param player IsoPlayer
---@param context ISContextMenu
---@param items table
function contextMenu.onFillContextMenu(player, context, items)
print("context menu")
end
Events.OnFillInventoryObjectContextMenu.Add(contextMenu.onFillContextMenu)
..\TestMod1\42\mod.info
description=Test Mod 1 desc
modversion=0.0.1
id=TestMod1
name=Test Mod 1
poster=poster.png -- this is a valid img
Do you have a common folder in your mod root?
So it should be ...\TestMod1\common. It can be empty, it just needs to be there
I do
Also, is the content: string actually in your mod.info? Because it shouldn't be there, unsure if that's what's messing it up though
oh yeah it's not that's a typo sorry
Ah okay, yeah it should be there
Tbh I never really used the \mod folder, I always just go with the workshop folder directly, so I'm not 100% sure what's going on.
But maybe try just moving it to the workshop folder instead.
You'd put it like this
[user]\Zomboid\Workshop\TestMod1\Contents\mods\TestMod1 and that would be your new root folder where you put mod.info, b42 folder etc
nevermind it shows in the list now, I didnt move it to workshop
but I am guessing my lua is wrong now right
not a mod issue
Your Lua looks fine to me, but I'm not quite sure when it's going to be loaded, so you might not see the print in the debug log in-game. But if you check the \Zomboid\console.txt and search for it you should see it
I'd go with a keyboard event to try stuff out instead, something like this:
contextMenu.onKeyPressed = function(key)
if key == Keyboard.KEY_G (or whatever key you want to use) then
-- your code to test
end
end
Events.OnKeyPressed.Add(contextMenu.onKeyPressed)
Then whenever you press G your code will run
If you do indeed want to make a contextmenu mod and you need to trigger when it creates them, I noticed that I used this event:
Events.OnPreFillInventoryObjectContextMenu whereas you don't check for the PreFill event, just the Fill one.
Not sure exactly what the difference is because it just works for me, so maybe try that as well
oh my damn I am an ultra idiot
I edited my comment above btw, I wrote the wrong thing first
I was reloading a save that didn't have the mod enabled
but somewhere along the way we fixed it
because it didn't work before even though the mod was enabled
Okay that's good! Now you should be all set to play around with it
No problem! Always good to have more modders π
Actually I remember what the difference is I think, the Pre will make your context option show up at the top of the list instead of the bottom
I was about to test what it does I copied it from JournalRecovery ^_^
Ah nice! The context menu is a bit funky sometimes, but that could be said for a lot of UI stuff lol
The best way to learn is honestly to just open the core game \media folder in vscode and just poke around in the vanilla files.
I add prints directly in the vanilla code all the time to see what function does what
I decompiled java for extra reference but I am so lost in it that I can't even tell how to plug in my own right click function.
caughing print at everything seems like a good way to do stuff tho
I'll try that
I haven't even decompiled the java yet, but definitely should
You can do a lot with just the Lua, especially if it's not animation/physics related. UI is easily handled with just Lua, so if you feel overwhelmed by the Java then I'd say just set that aside for now
yeah I reckon I won't need java it's too much of a hassle and I hopefully won't need it anyway as you say
alright thanks for the help, I am going to botch things up π
Haha awesome, have fun! π
is anything about this code that could be depreciated in B42 or something?
PauseStart = {}
PauseStart.OnGameStart = function()
if getActivatedMods():contains("Lifestyle") then
LSMenuOnDestroy()
end
UIManager.getSpeedControls():SetCurrentGameSpeed(0)
end
Events.OnGameStart.Add(PauseStart.OnGameStart);
i wanna use this PauseStart mod, and i also happen to use Lifestyle
but it doesn't work while using it (i'm assuming this code was supposed to fix that?)
and i'm pretty sure it worked fine for me back in B41
so i guess something about this must be depreciated?
or maybe not, since the mod does work on it's own
so it has to be something about lifestyle
Mod IDs have changed; they're now prefixed with a backslash (\). Presumably, at some point this will be changed to be prefixed with both the mod ID and the backslash, so for future-proofing I'd check against that pattern
i.e.,
local lifestyleEnabled = false
local activatedMods = getActivatedMods()
for i = 0, activatedMods:size() - 1 do
local id = activatedMods:get(i)
if id:match('^%d*\\Lifestyle$') then
lifestyleEnabled = true
break
end
end
You can run this once & then just check your flag. If you end up checking for more than one mod, it'd be best to extract them to a table (associated to true) instead
cheers man, worked like a charm
this is the code if anyone else ever needs it:
PauseStart = {}
PauseStart.OnGameStart = function()
local activatedMods = getActivatedMods()
for i = 0, activatedMods:size() - 1 do
local id = activatedMods:get(i)
if id:match('^%d*\\LifestyleHobbies$') then
LSMenuOnDestroy()
break
end
end
UIManager.getSpeedControls():SetCurrentGameSpeed(0)
end
Events.OnGameStart.Add(PauseStart.OnGameStart)
making a mod to take all the money in your inventory on April 15th
does anyone know why my vehicle loot distribution just is not working?
thats pretty neat actually!
Dont nail me on it for im not sure, but: Trailer_ww_50'senclosed <--- has an ' in it. Try removing it?
it makes no sense to me wy but that actually worked!!!
thanks!
It's because Lua naming rules won't allow apostrophes in identifiers, only letters, digits and underscores (and I believe it can not start with a digit)
an apostrophe opens/closes a string
makes sense!
wasnt even something that was consistent through all the different things for the trailer anyways, made more sense without it
still having the issue with it refusing to have a proper trunk but
Is there a smooth way to set the volume of my custom sounds in the mod options?
Right now the volume is controlled by this sound block in my item script:
sound SkateboardRolling
{
loop = true, is3D = true,
clip { file = media/sound/Skateboard/Skateboard_Rolling.ogg, distanceMin = 0, distanceMax = 30, volume = 0.40, }
}
As I understand it the ambient category is no longer a thing in B42, so I can't just use that.
I noticed I can do setVolume on the sound when it's played by the emitter, but if there's an easier way where I can just change the volume param in the script, that'd be way better.
Does DoParam work on sounds for example?
I think I might have it figured out, need to just put it together
Guess not lol, foolish of me to think that something as easy as setUserVolume on the GameSound would work. God damnit
Is the scateboard also a "HandWeapon"? In that case, woudnt it be ok if you used the noiserange and noisevolume option for regulation? Also not sure how you implemented the sound or where, so its just me guessing.
At the moment it's not, but it will be. Unfortunately I don't think that will work since I believe that would apply to sounds triggered when attacking.
The skateboard sound is played using emitter:playSound, which also has a setVolume, but I was hoping for something that won't require me to make an extra method call every time I play a sound
I guess it's not that big of a deal though, and I'm just wasting time trying to save on negligable performance gains
That is if setVolume is even gonna work lol
may i ask how you get the emitter? Im just using getSoundManager to play my sounds since it also has all the controls, but i guess having a specific emitter would allow more fine control? Not that im using it atm, but may come in handy to know. ^^
Just checked, the setVolume for the soundmanger works, so it should work for the emitter too i guess.
You get it from the playerobject, like player:getEmitter()
And then you use it like emitter:playSound("YourSound")
This is working to change the volume:
local emitter = pzPlayer:getEmitter()
local sound = emitter:playSound("SkateboardRolling")
emitter:setVolume(sound, 0.80)
I couldn't remember if it wanted the sound or the emitter
Cool, thanks. Also i just found out that if you increase the volume, you actually increase it for all sound effects? Yeah, using emitter for the player object sounds better, will have to try that one.
Yeah it took me a minute to figure out what the hell the long param in setVolume(long, float) was supposed to be haha
I remember getting mad when playing with setPitch on my metal detector
in the end I hated it so just changed it to beeps
Yeah the soundmanager increases all volumes I believe
Did you ever play around with triggering sound from animation events? I saw there's an AnimEventBroadcaster with a bunch of listener methods, but I haven't dug into it yet
declaration: package: zombie.core.skinnedmodel.advancedanimation.events, class: AnimEventBroadcaster
I haven't. I've really never even seen that before or didn't pay attention
Ah I feel ya
looks pretty useful
I'm just trying to get a better understanding of all things animations. I really should decompile the java
@queen oasis @silent zealot https://steamcommunity.com/sharedfiles/filedetails/?id=3464551542
You never really know lol
I saw you could get an AnimationPlayer from the character object, and it gave me an object, but I can't call any of the methods on it
Probably just something I don't understand though
declaration: package: zombie.core.skinnedmodel.animation, class: AnimationPlayer
s_dbgGlobalEventBroadcaster = new AnimEventBroadcaster();
s_dbgGlobalEventBroadcaster.addListener("playRackSound", SwipeStatePlayer::OnAnimEvent_PlayRackSound);
trying to find something not in debug
Triggering sounds from animations is done in the AnimSets tho ?
Not a java object that you use in the Lua
I mean perhaps that's doable, but the way animations trigger sound is done directly in AnimSets
I was trying to find how it is used. I know absolutely nothing about animations, except I suck at it
Check fence climbing AnimSets
Some of these have sounds that trigger at the end if you trip for example
Interesting, I thought it just triggered some event that was then picked up somewhere and played the sound
Ah that I'm unsure how it exactly works tho
Idk what they refer to when triggering the sound
But at least animations triggering sounds is done from AnimSets from my understanding of it
Might some exceptions tho
Like in the case of walking I doubt it's done in AnimSets ?
Haven't looked too deep in it
Oh wow, yeah I have no idea how I didn't notice that
<m_Events>
<m_EventName>PlaySound</m_EventName>
<m_TimePc>0.28</m_TimePc>
<m_ParameterValue>LandLight</m_ParameterValue>
</m_Events>
``` is a thing you can just straight up give a sound name to
Hmm, how to change the volume of these then
Quick question for y'all, I've been wondering if I should keep the character facing the location where you want to place the item, by default your character looks at it, but I'm afraid that it could lead to some annoyance in junction with my mod, what do y'all think ?
In the sound script probably
Oh man that looks really cool !
Yes you can definitely do that !
Wait unsure
What are you doing for draging the item visually like this ?
Is this a kind of Lua object ?
The method I know to forcing the player to look in a certain way will cause more issues than anything and not worth the work with it
Well I was wondering the other way around, by default the character face, but I disabled it
me, I would keep the player still until putting it down
However if you're using a Lua object to moving the item in 3D (place item basically), you could always modify that Lua object to not change the direction the players looks
Yeah I'm using the Place3DItemCursor
I meant the way I know to force the player to look in a direction will create more frustrations to players being stuck than anything else. You need to be able to move around
mod option... π
No
xd
-_-
Yeah that's what I'm fearing, right now when the dragging stop I reset the player to the original facing location and select the container they used to select before dragging, to avoid like loosing your container by inadvertantly staying too long outside the inventorypane
The code that modifies the player looking direction is simply triggered by the Lua object, most likely. If you force the player to look in a direction with setDirection and shit, the player will be stuck like this and won't be able to rotate their character bcs you're blocking commands
It's not a question of mod options
in reality, the game spins you around when you're placing an item, no reason to change it
Just properly doing it so the player can still use their movement keys to change their character rotation
Well my mod triggers the placing thingy when you drag an item out of the inventorypane (with a small delay to not be obnoxious) so you could suddenly be facing an other direction because you put your mouse out there too long, thats what I'm fearing
What about setIgnoreMovement ?
I'm already successful in stopping the player facing the 3d cursor
You can derive that object and modify where needed
Wait so what's the issue
Oh you're just asking our thoughts lol mb
I agree it would cause issues if players can suddently rotate
Tho isn't that already an existing issue with placing objects from context menu ?
It is, but you have way more control over when you're doing it
Yea I see what you mean
Like if my mod start to cause problems in normal gameplay, it's a swift uninstall to happen xd
i would have it as an option toggle π
nice! is the mod hidden? I can't find it in the workshop
mod option
zip van is complete!
cant choose between powell upgrads, bell trailer or the citicar for the next addition https://cdn.discordapp.com/attachments/473164772225974283/1361791619845587047/F28712A2-D24A-45C8-853F-CFCF0849F0F3.png?ex=68000ac7&is=67feb947&hm=5b8acb77c17efb52d24829a2c263e7a2b5652105185446f6a79e3473c407e8eb&
Hmm doesn't seem like it, and if it was it would bring me back to my initial issue of making a volume slider. I'll have to dig into it a bit more
It also doesn't seem to add a sound, so it won't attract zombies when played
it says public, but I can find it when searching either
if I create a git repo inside Workshop/FunctionalCarLift, will the .git (an other git related files) be uploaded? Or only the files inside "Content" are uploaded?
only files inside content are uploaded
ooh, great. I hated the idea of having to copy files manually all the time
if you just updated it it might just be in the approval process
when I first shared the link, I didn't even accepted the workshop tos
it shows up now. nice work!
later, or tomorrow, I will create the github repo and link it in description. I will add a credits section too. Can I add you there?
this part of the mod was the easiest. the hardest part will be the pickup and placement handling. I have no clue how to do it, since I couldn't find references of existing vanilla items in any file like Large Metal Shelves or Beige Large Shop Shelves, which drop part items to the ground
if anyone knows of a mod doing something similar where I could look for inspiration, I would appreciate it
maybe dig around for the large bed. I think it still breaks it down into parts
I can math just fine, thank you
he-man running around with 990 kg of thingies
so yea, I forgot I had my capacity override mod on this save and was messing with the player inventory capacity
much more reasonable
I found there are no items for those furniture objects. If I place the tiles manually with the brush, I can pick them up just as a regular couch, bed or whatever
I placed just half a couch with the brush, and when I try to pick it up, the second half phantom appears, but I won't let me pick it up
I found where to start. TileZed and check the properties on newtiledefinitions.tile
So I kinda trailed of into making changes to the item placing, like rotating with the mouse instead of having to hold R or Shift+R, but I don't know if I should instead move this to a separate mod π€
Possibly make it a secondary mod yea
That would be cool
I don't doubt some will use it
Anyone happen to know how to make a weapon be guaranteed to spawn with attachments already on it?
that particular feature can break gun mods if you use the default method,
so its gotta be done manually
As a one-off, or for every instance of a "weapon"?
How does it break gun mods? I suspect in this case it's for kickscooters/skateboards that won't be using default gun mods.
though, a gun light would make a little headlight.
Preferably for every instance, so the bike for example always spawns with at least wheels already attached. And then I could make a few one-offs that can spawn with more attachments
anyone knows the syntax to fetch the doors property if its metal or wood
easy mod to go see the vanilla method is undead survivor, last i remember has an easy copy of that code to check
The Vanilla method is to put possible upgrades into the lua WeaponUpgrades table, java loads that when parsing scripts, yadda yadda yadda, DoWeaponUpgrade picks upgrades at random from the list with no way to influence how many or probability.
If weapons can have an OnCreate function that would be an easy way to do it.
And they can! So you make an OnCreateKicksScooter(scooter) function, add OnCreate = OnCreateKicksScooter to the item definition, and that function creates wheels and attaches them.
let's goooooo
It doesn't let me pick it up, though. But we are going forward!
I did get an error while loading the save
LOG : General , 1744767263220> tiledef: loading C:\Users\maria\Zomboid\Workshop\FunctionalCarLift\Contents\mods\FunctionalCarLift\media\carlift.tiles
LOG : General , 1744767263223> MOVABLES: SpriteGrid dimensions error for multi sprite movable, group: (Car Lift Car Lift) sheet = car_lift_01
LOG : General , 1744767263224> MOVABLES: Error in multi sprite movable, group: (Car Lift Car Lift) sheet = car_lift_01
LOG : General , 1744767263224> Missing translations in Moveables_EN.txt:
Car_Lift_Car_Lift = "Car Lift Car Lift",
HELL YEA
when i was doing the v2 of my cabover mod, i said basicly this verbatum
I'm looking into the tile properties and comparing them with other similar tiles, and I find no big difference yet.
I once got very happy when my mod got to the point where putting underpants on crashed the game.
there are times for underpants and times for breeze...
the cabover mod was such a mess, cant wait to have to clean that up when i go to port it into my current mod
i currently have what i concider to be a crutch but may just be how it is for my loot distribution
Hi, does anyone know a modder? I need help fixing a mod or practically creating one.
There appear to be some modders in this channel... 
I know one called Frybso, they are trying to fix a mod or maybe create a new mod.
More seriously: there are lots of modders in here, so feel free to ask about whatever you're stuck on/need help with.
Oh niiiice, thanks man!
Thats a big boi
Chonky Dogmeat
This is SOOOO scary I love giant running dog
I don't know how to feel about this
doggo has the zoomies
Well shit now I kinda want to get into the animal system and make a cat companion that roams around your house/farm and kills rats
always nice to find out it's probably not your mod that causes the game to crash. Also nice to know that some people read the mod description.
"I had that character getting stuck in a freeze frame bug without using your mod. ...Was caused when I opened a door with a zombie in-hand - the zombie was dropped on the floor. Next time I picked up the zombie the freeze frame began."
Maybe I can quit chasing that "bug" now
That's a fake, no one reads descriptions.
And no one read the title
bursting my bubble
I got comments almost every day like: βWhy is this mod not showing up on my server?β
"Your mod doesn't work" and I ask "What other mods are you using?" - always crickets after that
Whenever someone reports an issue and includes a screenshot,
I swear, it almost brings a tear to my eye.
now that's fake
where the heck are the speed control buttons hiding in code? I swear I've looked at everything
nvm, I can't read
Been trying to figure this out all day. Old post, but thank you!
you can just use screenToIsoX and screenToIsoY
this all looks awesome. Sucks I have no idea how to code in the slightest because I'd love to make mods
its not too hard to learn
None of us were born knowing how to code.
Exactly :)
Some of us (me) still have no clue what they are doing
Eww
I had someone report an issue with a Rimworld Mod. This includes some logs.
509 mods, including a mod called "Too Many Mods." That was followed by a list of 4200 memory patches through Harmony.
Vibe coding PZ mods with 0 prior coding experience is gonna be tricky, but not impossible!
AI loves to hallucinate up some methods and functions that just flat out don't exist
It's also going to annoy this channel when peopel ask for help with their code but have no idea what's happening or why.
Oh yeah, there's that aspect haha
And the person can't follow basic advice because all they can do is ask an AI to change stuff
So anyone who wants to Vibe code, you need to commit to it and not push work onto other humans.
Yeah they're better off taking a Lua course and using AI as a personal tutor, to ask about concepts and clarifications etc
if you have to get me to write ai prompts for you i'm not sure what your part of the process even is π
Just keep asking the AI to fix things until it does.
prompt: "The code you gave me does not work, please do the needful"
Or just don't use AI to flat out write code.
Idk, I use it all the time and find it saves me a lot of time, but I also know if it's giving me some bullshit
That's "I use AI as a tool", not vibe coding.
Like assisting in writing or making art, it should be used to help create, not be the thing that creates.
Ah I get ya, fair enough
This unfortunately is me sooo often
I honestly feel very lucky that I learned to code just before ChatGPT popped up, because I know I would have been too lazy to learn the hard way lol
How I learned to code.
This is what we got instead of downloaidng code
I learned to understand coding from hour of code, but learned how to actually do it from many kind people in this server and many others
Probably why I like modding, I grew up with the idea you could tweak games because you were typing out all teh code yoruself lol
I'd honestly have preferred that over this motherfucker that they forced on me in school
I love that fucking cat
What do they use to tyeach programming in school these days? There was no consistent plan (and I moved abot a bit) in the 80s/early 90s so it was bits of BASIC, Logo, Hypercard...
Do not sully the good name of scratch
At school where Iβve been we use hour of code
Though itβs been a few years
What language(s) does that use?
I was in high school 2010-13 and we used scratch for some classes. For web dev classes we used dreamweaver lol
The name of the cat and the name of the language is the same, Scratch, it's like a visual high level language
EDIT: Oh wait, did you mean hour of code? No clue about that one
Fairly certain it was your mod. What else could it be?
I honestly have no clue what itβs called!
Uses blocks of if and or true false statements mostly, itβs very beginner level
Though you can also use Java
I did (half of) and electrical engineering degree at Uni, and that used C and Miranda... which was pure functional language
pure functional languiages are horribel to do anything with
absolutely no access to anything other than the function inputs, and then your function can return exactly one thing.
It was designed for solving recreational math puzzles.
C was cool though. "You want an array? GO BUILD ONE. You want a string? GO BUILD ONE You want to write to an arbitrary memory address? Sure thing."
I tried taking C++ in college but my teacher was terrible. Every time I asked her to explain something she just said "it's in the book" and if I told her I still don't understand then I was met with "google it".
The fuck are you here for then??
Got so fed up I just dropped the class and didn't try coding again for like 3 years
The only redeeming thing about that teacher is that she looked exactly like a rounder version of this lady from The Incredibles
i had a computer science teacher who was the same way and it became apparent pretty quickly that she just didn't have any knowledge of it to begin with
it wasn't a poor school and it's a good area for tech so i don't really get how that happened
And it won't stop them from forcing you to pay $300 for a textbook published 15 years ago
My first and only computer class was an intro and we just learned about history and manually wrote binary ciphers
π
thats really cool actually
Saying cipher sound cool, but it's literally just http://sticksandstones.kstrom.com/appen.html
im in a computer class rn, but its about wiring and such
did a fusion class and another class but idk how to explain it
God damnit, going back to ts and I keep typing print instead of console.log every single time
Fixed my sound radius tracker. I was just overcomplicating things
Hi guys, can anyone tell me if Zomboid triggers any event to the server by receiving a message from the game chat?
My brother teached me Basic when I was 11, and then I bought this book when I was 16
Then learned C playing with microcontrollers, PHP on my first job, last stuck to C and C++ for my last job at embedded systems, doing some C# now and then (super specific low level features), and some other languages for code reviewing my team
this may help: https://pzwiki.net/wiki/Lua_event
from what i saw there is no event for this
going to age myself here.
I'm trying to make a mod that listens to the chat on the server side
I saw some content creator talk about a bot he did for connecting the game chat with discord
grep -r media/lua/client/ -e 'chat' got me a lot of hits. none on server
I want to trigger an event using specific words from the game chat
unfortunately there isn't, you may want to hook when the client sends a message instead, and send the info to the server if necessary: it will be annoying and more complicated than it should be though
yes I thought about it
I've been trying to understand things here for a while now
Hello all. I am trying to debug an old mod of mine which used the B41 ModOptions mod for settings. It seems that the settings are saved into the .ini file once applied, but they do not load the correct settings again on restart. All the values are adjustable in-game and change when applied, but are not loaded correctly when reloading back into the game. Any ideas? Thanks in advance!
are you on linux?
No, Windows 10.
It seems that the .loadModOptions function runs after I go into the options menu and Apply/Accept some changes, but not upon loading the game itself.
idea ive had (that is probably impossible)
do yall think you could use the radial menu to open a liquids ui in b42 for fuel trucks?
If we're revealing how ancient we are... this first computer I programmed on:
Are you updating thsi for B41 or B42? For B42, use the built-in mod options instead of the mod options mod.
yes, you can can add things to the vehicle UI radial menu
yeah i know you can do that, filis does it and so does PZK
just unsure if you could prompt it to open the liquids ui
No, just going back and refactoring and cleaning up some old mods of mine, and noticed that the ModOptions wasn't loading correctly.
you definitely could, the trouble would be actually having a fluid container in the vehicle
Not a problem - each removable vehiclePart holds an InjectoryOject that is teh part that has been installed
And IntentoryItem can have a fluidcontainer attached.
i'm not sure if persistence is universally implemented but now that i think about it nearly anything in the game can have a fluid container anyway
So you make a "fueltank" VehiclePart or similar name, then Vehicle -> getpart("fueltank")-> getIntentoryItem-> getFluidcontainer
they're doing a kind of ECS now so everything should be able to have one, though i don't expect them to fully work in most weird cases
It's a property of InventoryItem, so anything that goes in the inventory inherits it. And probably similar for isoObject.
any entity should be able to have one
persistence would be the issue in most cases (i assume) but vehicle parts being items gets around that for sure
you're right, it's "Entity" that has getFluidContainer.
oh wow thats alot simpler then i wouldve thought tbh
yeah, it's kind of late in the game for it but they're using an entity component system now so optimistically most newer features should benefit from this
glad they are making improvments like this!!!!
If I want a hammer with built-in whiskey flask I can.
thats actually so peak
there is ALOT you could do with the liquid stuff and im glad they added it
it will probably be a bit before i go and try to actually impliment a fuel truck to see if the idea would work (unless someone else does it first lol) but i dont see any reason it wouldnt
wish TIS would impliment it as a game feature, could be cool to see a new vehicle and would fit with the new companies they have added
ive added it into my notes though so i dont forget in five seconds
Hi! Trying to create a trait mod but am having trouble, could anybody help me?
Basically I wanted to create a mod where you can select to be a "licensed gun owner" and start with a +3 aiming, +2 reloading, and begin the game with a pistol and 2 boxes of ammo. I created profession mods but haven't done a trait and can't seem to get it to work or show up in the game
It's pretty easy.
(code for B42, but probably the same in B41)
local function initNepLumberManTrait()
local Fisher = TraitFactory.addTrait("Fisher", getText("UI_trait_Fisher"), 6, getText("UI_traitdesc_Fisher"), false, false);
Fisher:addXPBoost(Perks.Fishing, 2);
Fisher:addXPBoost(Perks.Cooking, 1);
end
Events.OnGameBoot.Add(initNepLumberManTrait);
That adds a trait that gives some skill boosts and costs 6 points
description goes in a translation file, and you need a texture media\ui\traits\trait_fisher.png
For giving the player extra stuff at teh game start see lua\shared\Items\SpawnItems.lua for examples
basically, attach a function to the OnNewGame event that says "if player has trait("BinxGunShopOwner") then player:getinventory:additem("Base.Pistol") end"
You should also add "Unlicensed Gunshop Owner" who starts with two assault rifles, a stack of cash and a suspicious package. π€£
Gina be having a bit of fun re-texturing the Powell tomorrow!
Not sure what vehicle to do next yet, maybe one of the semi trucks
Show off with your 16-bits and all
I was using my Atari 800XL until like 1995
We had Advanced BASIC!
Atari Basic was ok - but we had ANTIC! and Pokey!
It had some support for sprites!
I think there were 32 16x16 sprites and some rules about not having too many on a single horizontal row
it did. I had graph paper everywhere for years, looking like Beautiful Mind or something
For defining the sprite using numbers?
Something like conveying each row to 16 but integer
It's been a while!
yep, I don't remember the math exactly now. I just remember 7-0, add em up and poke them somewhere
Oh god... PEEK and POKE.
Who needs graphics drivers when you can write directly to video RAM?
That was more of a Commodore 64 thing, at least for me
I never got that in to it. By the time I was old enough to grasp any of that, I had gotten a 486DX running 100 MHz in turrrrboooo
played pascal for a high school class, quick basic, visual basic(ptsd) and then perl, php, js and finally settled on python. I still suck at all of it tho
just remembered DHTML. them the days
I was hoping to grab when the player clicked on the "Play" button:
if UIManager:getSpeedControls():getClickedValue() == "Play" then
JB_SpeedKeeper.newGameSpeed = getGameSpeed()
end```
which works. except I think when the game changes speed, it sends a "click" to the speedControls hud. if I stick a print in there, it's a waterfall of phantom clicks
maybe have to go back to a mousedown event and check from there
might help if I looked at the java functions before opening my mouth
The UI does a lot of "phantom" stuff, sometimes you can just trigger and set a variable somewhere to not trigger 500 more times
"Write your code on a piece of paper and give it to the teacher" - yeah I am old
Glad I never had to do that. Except for exams. Writing code in paper for exams was so stupid.
I also missed the punch card era, aka give your stack of cards to the guys that run the computer and then will put them in sometimes in the next week and give you output cards, hopefully those don't just say "syntax error"
And some people may know that the term "bug" comes from actual real AF
getting squished in a relay hence causing .. unintended program behavior π
Q: When steam updates workshop mods, how can I see which mods actually updated?
the easiest way I know is to go to the steam workshop folder and sort by modified date
too late
Let's just pretend like that didn't happen
@drifting ore infused WHAT!?
devil's lettuce
be careful kids, you'll get reefer madness
me and these speed controls are gonna fight
Hey! Whatβs the correct dimensions and plug ins to have the photos show up in game? For example, I made a profession mod for a reporter and wanted to add the picture to it like all the rest of them have. What do the dimensions have to be and such because what I currently have in there wonβt appear. Same for the trait mod I made
Id like to make zombies attack a non player target like a dummy/mannequin but dont really know where to begin. Does anyone know a few commands or better a mod that does that so i can have a look?
ffs lua. I just spent an hour debugging a case where I defined a function and a field with the same name in the same table π«₯ . . .
workarround brainstorming: Having learned that animals are players, maybe define a new invisible animal π
Hm, no that wont work for me, i want to use world objects... like bomb looking dummies... ^^
got it whittled down to
local function clickedSpeedControls()
local sc = UIManager:getSpeedControls()
return sc:isMouseOver() and Mouse:isLeftDown()
end
if getGameSpeed() > 1 then
if clickedSpeedControls() or isKeyPressed("Normal Speed" then
-- change speed to one "Play"
else
-- set var to game speed
end
end
I fought with the speed control buttons and the HUD but they won.
just have to implement a keyboard check for speed changes but that should be straightforward
Can someone help me with the SendCommandToServer function, I know what it does but I have doubts about how to use it, and is it possible to use it on the server side, if not how do I trigger a command like 'createhorde2' and in the case of using it on the client side the client needs to be an administrator?
Is it me or is setGameSpeed() pretty much binary , everything below 1 pauses the game?
Phu that is a deep rabbit hole Gusteivos.
First of all, you are on b41 or on b42?
Be aware that, at least on b42, the SendCommand functions (at least one of them, can't remember if the to client or to server) are NOT executed in single-player. You can and need to call your code directly then.
Secondly, to test true multiplayer, you have to run the dedicated server version of the game and the client separately. I have not done that so I cannot comment.
Thirdly, I am not so sure about client-permissions but changing game-world-authorative state you should always do on the server (it will automatically have all the god powers).
My recommendation: Download a mod that does some of that and study it. And you may have a cautious conversation with an AI of your choice about the general concepts of Zomboid server/client, however don't trust its specific code or detailed recommendations.
b41
it's not a direct speed multiplier, you pass the index of the speed multiplier you want(0 = paused, 1 = normal, 2 = faster, etc, the same as the in-game controls)
the argument is an integer so anything below 1 is going to get rounded to 0
I'm starting to study how to make mods
And there is probably no way to suppress/replace the "Game Paused" text π¬
It looks like the expectation is to call both that and getGameTime():setMultiplier(n) if you want to change the multiplier; setGameSpeed doesn't actually set the multiplier sets the multiplier to 1, missed that somehow
fellow linux user detected π§ β€οΈβπ₯
I'm writing some simple mods for a server I'm setting up but I still don't understand the Zomboid architecture very well. It seems like the server has little authority and what is done on the clients is replicated in multiplayer mode.
linux is life
yeah that's basically it
That, people say, is largely true in b41 and gets drastically (but not entirely) corrected in b42.
There is probably a reason why in b42 there is no multiplayer support right now.
the server does barely anything in the current version of multiplayer
sad
This is a problem because it is very simple to hack.
i think the game still shows you a 'do not play on public servers' warning when you start it up π
Now for simpler things like how do I save information on the server side? Does Zomboid have a Lua API for this?
you can save stuff to mod data
-- returns a table that will be saved automatically
local myModData = ModData.getOrCreate("my unique key")
Can you give me a basic tutorial on this? Is it possible to separate the data by player?
you can use their username to differentiate the data per player, or save it clientside if appropriate
Cool but how do I flush this data?
Uploaded yesterday but it never showed up on the workshop, didnβt get any errors on initial upload but whenever I updated it also apparently fails, anybody know how to fix it? Formatting should be fine for the files
Released
If yall try it, lmk if yall have any suggestions
much appreciation for all the helpful tips during production
How do I get an image to work with my profession mod in the character creator? I have the image but Iβm guessing the properties are not correct
Not my cup of tea, but nice work! Looks awesome.
Yooo fireπ₯π₯
I somehow figured it out lol, check out my very first mod ever and pair with the my gun license mod for a RP style story line: https://steamcommunity.com/sharedfiles/filedetails/?id=3465768715
Yeah, my mods not for everyone
But I mean irl you can't exactly shoot hundreds of zombies every day without repercussions lol
reminds me of that 'everyone is deaf' theory I read a while back about The Walking Dead
aye this is super cool!!!!!
hope some clothing mods impliment support for this mod in the future!!
not something id use in my runs but i can see alot of people liking this
nice concept!
woah, great writing there
came here to make a quick question and found those new gems, congrats!
I'm working on replacing vanilla car lift tiles with my own now. I'm hooking on Events.LoadGridsquare to delete the vanilla tile objects and replace them with the moveable ones. Does someone know in which order the world loads squares? I'm about to test it, but maybe someone has insights on this
since the vanilla car lift has repeating tiles, it's not a one on one replacement. So I want to wait for the first or last vanilla car lift tile, and then replace them all at once
also, being hooked to LoadGridSquare would mean I should keep this converter mod on all the time, right? because it's loaded as it's discovered?
that would explain why Water Dispenser doesn't have a "converter" mod.
https://pzwiki.net/wiki/Scripts_guide/Recipe_Script_Guide this link is empty, is there any where i can get recipe script guide for build 41?
many thanks!
Result
The result of crafting (item type and quantity). Example:
Result:FishingHook=10,
If the result of crafting is an item in a single copy, then the number of items can be skipped.
Result:Hat_TinFoilHat,
sir, can i add 2 type of result in 1 recipe?
for example
Result:FishingHook,Hay_TinFoilHat,
no
if you want more than one result type, you can spawn the items in the player's inventory with the oncreate function
Thank you! Iβm a news reporter in real life so I wanted to add the profession to the game lmaoo then for some reason, I think maybe because I have superb survivors downloaded, when I choose that profession a bug happens where you spawn with an armed military NPC bodyguard so I came up with that whole lore π€£
thank you!
Does anyone know how to make a trait mod? Like I can add my own traits. I want to make a Korean War Vet trait mod.
What outlet?
Currently at The NY Post!
Oo very cool !
What about animals with bombs strapped to them? Sometimes you need to change your plans because what you want is buried deep in the java side of things.
Was discussed rexently: #mod_development message
That discussion covered the trait having skills & starting gear, but anywhere you can patch in code you can add a "if player has trait XXXX then do something"
Keeps saying I got a mod info file missing but I have it and it's filled out wtf
Might be in the wrong spot?
where is your mod.info placed?
your mod is for B41?
im on B42
https://pzwiki.net/wiki/File_structure#Build_42
File structure is slightly different on B42
Zomboid\Workshop\Korean War Vet Trait\Contents\mods\Korean War Vet Trait\[[42_or/and_common]]\mod.info
it shows up now thanks
That link is not a thing in the first place
Wiki links don't use this format
Where did you get it ?
what do i do π im no coder so dont make fun of me pls
Made my first mod in anything ever
https://steamcommunity.com/sharedfiles/filedetails/?id=3465865657
Just a simple beard mod cause I noticed there were no vanilla moustache chops, and I wanted to do my CDDA run as Harry Du Bois. I'm proud of it though so I wanted to share it!
gonna fix the crusty pictures in the page tho, didn't notice how bad they looked
If you're using your own tiles you can just make two tiles that look identical.
Kudos for more immersion and RP!
Nice Work, and great mod descriptions.
Something I didn't see mentioned that would be easy to add: give the player a Base.PressID along with the other gear when they spawn.
Those exist in the game,. but only get used for special named reporter zombies.
I did exactly that. But when loading the grid, two consecutive squares will have the exact same sprites, so I can't just replace them one on one with my own. I have the place mine in order. So I thought to wait until the last square was loaded and then replace all four at the same time. For that I need to know in which order de squares load, so I don't tru to replace sprites on squares that didn't load yet. Does that make sense?
And, is there a chance where a grid is loaded and only half a lift is on it? I could just assume there is a chance, and just replace one by one with some logic around it
This week I learned:
- ISUI/ISRichTextPanel is cool (not yet fully explored)
- I shall not rely on complicated/unreliable game-or-real-world timers in ISUI render functions, per-frame counting ends up smoother
- Building and using simple runSequence to make async nesting more flexible and readible can be nice, thanks chatGPT
- assert is cool
- lua scripting = nice and flexible but oh the type checking during prototyping is important and ends up faster
Looking back, not such breakthrough-learning relative to all the self-inflicted stupidity I ran into. π
from past post in this channel lol, just search recipe script guide and that link pop up
35 animations later and the skateboard is starting to feel pretty smooth! Now I can finally focus on making tricks
That's an impresisve number of animations for a mod
I can now fully use those, knee and elbow pads to be pretty safe..
Love this!!!
So .. whats the status of playMusic(trackName) - doesn't seem to do anything - and I have a hard time determining what a valid track name could even be.
I downloaded and patched https://github.com/zatherz/fevlist to so it doesn't demand a master file and to work with recent v2 of fmod and when I run it against ZomboidMusic.bank all I get is a bunch of GUIDs (because string names may not have been included when TIS build them). I did a sample check in the game files for a reference but to no avail.
you can smack a Z with that thing too? π
Haha when I make it possible to fall off, I'm definitely making it so if you have knee/elbow pads and a helmet it will reduce the damage you take π
Sure can!
Hey there do you know if it's possible to embed a browser page in a PZ UI Panel?
Opening a panel that displays a browser page
basically I want a way to display images without having to reload the server and update mods
For example creating a camera mod that would take pictures, upload them to a server and then looking at the item picture would open a panel that would display the image from the server
So not displaying advanced wep pages, only images
Was probably old wiki link formatting then, @sudden lichen might be able to confirm that
PZ's networking system does not support transmitting binary data such as images through its sendClientCommand / sendServerCommand system, as these are limited to serializable Lua data types (strings, numbers, booleans, tables).
Unfortunately PZ doesnβt support rendering HTML pages in the UI, there's no embedded browser or web rendering engine exposed to Lua or Java modding.
As for getTexture(), it only works with images that are already part of the game or mod files, so you can't use it to load external images from the internet at runtime. It just fetches preloaded textures from the game's internal texture cache, which includes .png files bundled with mods or the base game.
Also worth noting, there's no real-time image generation capability in Lua. You can't create images from scratch (like drawing pixels manually) because Lua in PZ has no access to pixel-level manipulation or a canvas API. The closest you might get is taking a screenshot, but that's done through internal Java functions (used, for example, to generate the savegame thumbnails), and I'm not sure if that functionality is exposed to Lua at all. I've only seen the Java code handling it.
If you really need to show dynamic web-based images, the only real option is to open the image link using the Steam overlay browser, like via openUrl(url), which will open the link in the Steam overlay (not in a UI panel).
damn that's a real bummer
yeah I've seen the steam overlay method but it ruins immersion
Yeah didn't work π¦
Hi all
Do you know of any mods pulling hordes towards the Player for No respawn Runs?
Like gathering Zeds in a big ball and letting them wander "through" the Players Position?
Made a Thing for learning modding with Project zomboid and it works pretty good.
Now i am wondering if thats already been done
https://steamcommunity.com/sharedfiles/filedetails/?id=2953621037&searchtext=Before+the+storm
This one ist for b41 only i believe
this is probably on purpose for security reasons
and/or stopping people from displaying nsfw content
something like this maybe?
local objects = cell:getObjectList()
for i = 0, objects:size() - 1 do
local obj = objects:get(i)
if instanceof(obj, "IsoZombie") then
obj:setTarget(<your target player-ish-object>)
end
end```
wasn't enough then π
gettexture only grabs a filepath
yeah damn
so no way to get pictures in game without having to reload the data
Thanks for the immediate Input in how to solve the problem π
Since in am a bloody beginner in programming anything i Took the sloppy Method of playing a 'nil' world Sound to gather and move them around in a big straight Line dont know how this could affect Performance instead manually targeting the Zombies towards the playwr
If Theres No such Mod i will try to polish and publish it π
The Journey hast been Fun so far
Still saving this for later 'studys'
<@&671452400221159444>
it's not the real link don't click
`local modID = "WalkerTest"
GameTime = getGameTime()
WorldSoundManager = getWorldSoundManager()
player = getSpecificPlayer(0)
Radius = 1000
function playSound()
print(GameTime.getStartDay())
print(GameTime.getDay())
local x = math.floor(player:getX())
local y = math.floor(player:getY()+startVal)
print(x)
print(y)
WorldSoundManager:addSound(nil, x, y, 0, Radius, Radius)
startVal = startVal - 10
print( "SoundPlayed")
if startVal < -500 then
startVal = 1000
end
end`
i know its bad but using a world sound to move them around works like a charm
How is this shit where you can send a fake link in discord still a thing?
How does it even work?
i hope it just doesnt in the end
Markdown
Not such a stupid idea for performance if zombies are plenty TBH. for the cell-scanning approach, triggering it once per second might be enough.
Problem might be that when zombies come close and the player moves, the "target" may be not exactly on the player and I also have no idea if it could screw with Z close-range attacks etc. so excluding a small radius around the player may be necessary. All which complicates things so .. if the sound works for you, go for that man!
Better to use that, I can assure you that lol
Unless playing a world sound causes something you don't want to happen, incompatibility etc then yes you should switch it. But this is a method used in a lot of mods and what this achieves is move both load AND unloaded zombies that are in the player cell and a bit further out
Overall, that's your only solution to properly move zombies without being dependant on the player cell range limit which is different in:
- solo
- MP
- modded with a java mod
Considering you don't want zombies to target the player directly and just wander around, you should use that yea
I did not know this, thank you very much for sharing! Iβll for sure have it updated with this, very thankful!
guys, can someone help me with a scripting situation?
Maybe
Simply ask your question
oh, alright
That's the whole point of the channel, simply throw your question and someone will check it out
i was just waiting for someone to awnser
yeah sorry about that
I will link that dumb ass website just for the sake of it lol
https://dontasktoask.com/
i need a script that bypasses the sandbox settings and changes the temperature, darkness, precipitation, fog, clouds, and windspeed of a map
done
i'd do that script myself, but i just don't know the terms
A few mods out there can you good examples on how to handle weather via the Lua API
https://steamcommunity.com/sharedfiles/filedetails/?id=3051276857
https://steamcommunity.com/sharedfiles/filedetails/?id=2937238597
https://pzwiki.net/wiki/Modding will provide you with the things you need to get started
does this work?
i was about to ask if i should just make weather manager as a required mod
No idea lol
but i realized that the weather manager mod is b41
I don't know how any of it work
i'm doing a map for b42
np
New to modding, so this might be ignorant but is there an elegant way to tell a recipe to take ingredients by weight instead of by number of items?
Lua Method is global
@LuaMethod(
name = "getClimateManager",
global = true
)
public static ClimateManager getClimateManager() {
return ClimateManager.getInstance();
}
ok, another question
oh wait.. maybe not the
how do i make a b42 compatible mod
i think you have to do:
thats how the ClimateManager.class looks inside
looks confusing for me
maybe its weather:updateFx
same xD
but if no one can help we have to solve it on our own
anyway
when i did my other maps for b41 for testing i put the files in my zomboid folder it worked
now i made a map for b42, but when i put it in the same place as the others it doesn't show up in the unstable version
structure has to look like this if that helps
Horde\42\media\lua\client\StrollingHordes
oh
in my last map i used a script and it didn't need the client folder
so i thought it'd be the same now
instead it was named shared
i dont think you need one but what u need is that 42 folder
i'm confused
understanding is not my strong suit
ha xD
if i'm not seeing a person doing it infront of me i can't really learn well
ok i try visually
C:\Users\Countrydoge\Zomboid\Workshop\TestMod\Contents\mods\TestMod
my user is user, i never bothered to change it lol
anyway
thanks
basically you just have to move your mod inside the 42 folder
the rest is just coding it so it works with b42s base code
oh wait
i just realized i put it in the wrong folder
or did i
because the mods i put in the same folder didn't appear in the unstable version
just gotta wait for it to update since i keep switching normal to unstable and verse versa frequently
i dont evven know how this has happened
hahah was that a scooter?
semi truck π
i need to figure out the attachment system so the texture isnt done but i have absaloutly no idea why it has decided 90% of the model just doesnt exist
has to be mitsubishi if its that narrow xD
dodge LN 1000
got a few of these SUPER thin semis im gonna do
it will have a more regularly shaped varient
they are SO funny looking
share a sneak peek please
this is what the model SHOULD look like
is that a SPOILER
nope!
yeah the 5 wheel
i will further pretend to see a spoiler
i might so some goofy stuff like that on a couple vehicles in the future but right now i no no wanna
No spoilers!!! :p
i dont know how to make mods or if this is the right chat for this but i had an idea for a mod that replaces some of the zombie spawns with npcs to simulate a more realistic day one. have people running in the streets, a group fighting zombies in spiffos, people in their homes, etc. some could be friendly some could be hostile. if enough group up they fortify, have premade blocks on the map set up that they go to and set up a base over time.
there is a mod that does this, a few really
human npc modding is very difficult in b41, no clue how it would be in 42
i dont even know how ive done this
you guys are amazing im not sure how i didnt find this before
So i was playing around with recipes and OnCreate/CanPerform & OnTest - but is it normal that these functions are called from all over the place? heck its own module seems to trigger OnTest, or in my case Log_DMA_OnTest multiple times, what are the chances for outside modules to do that? Same for the other two functions, also not that often. I just dont get whats going on, can someone enlighten me pls?
ontest is called for every single ingredient that could possibly be considered for the recipe every time it is tested
i'm not entirely sure when oncanperform is called, but it's used to check if the player is allowed to craft a recipe (basically any condition that isn't to do with the ingredients, which is what ontest is for) so i'd imagine it's nearly constantly (as it has no idea what these conditions are or when they might change)
oncreate should only be called once, when the recipe is crafted
Huh, hm, OnTest makes sense, and i guess OnPerform too if it just checks if the recipe can be used, but why would the OnCreate be called from outside then? Hm, ill test it again, maybe i made a mistake somewhere (which isnt unlikely ^^) Thx. π
Ok, youre right, the OnCreate is really just called once. Also the debug says its called from a nother mod? Hm, ok that clears it up. Thx again. π
Hey guys, Iβm trying to add the press badge into the reporter mod but for some reason it isnβt working. Iβm using:
Events.OnNewGame.Add(function(player, square)
-- only for Reporter
if player:getDescriptor():getProfession() ~= "reporter" then return end
local inv = player:getInventory()
inv:AddItem("Base.Notebook") -- notebook
inv:AddItem("Base.Pen") -- pen
inv:AddItem("Base.Camera") -- camera
inv:AddItem("Base.PressID") -- press badge
Do you only want to use it when the game is new?
Scratch that, didnt use that event before, so i had to look it up. uhm whats the error in your debug?
Not sure, how could I check that? And I was trying to do it like that so when you start a new character you spawn with it on you
Yeah, thought so. The debug has an, whats the word, error window? You could look it up there.
Also, maybe just to test it out, move the function to its own place, give it a proper name and call it through that. Not sure if it helps, but it will help you to see if the function has a problem if you couple it with something else too, like keypress or mouseclick (just to make sure its not the function itself that has a problem).
Easier to track errors if you dont have to relog with a new character everytime.
found it
it says: LOG : General , 1745025668188> ERROR: ItemContainer.AddItem: can't find Base.PressID
which is odd because it says its Base.PressID here: https://pzwiki.net/wiki/Press_Badge
if your mod is in b41 that might be why
you ever get that mod done by chance?
How do I change it? And will mess anything up when I do?
im not sure,
i believe there is a tutorial out there somewhere
Is b42 the current version of the game? I made this mod a few days ago so I think it should be in b42 unless thats not the current version
b42 is in unstable, so yes and no
unless you put yourself in b42, your in b41
When you say unstable, how unstable we talking lmaooo
mostly balance issues, unfinished content, and the occasional save breaking update
the really severe bugs get cleaned up fast but they are often there
it is VERY stable
Thanks! How do I make my mod appear in that version?
Where do I put the files and is it the same as the previous version? Can I just copy and paste the folders?
Hey uh you guys know how I can make custom VHS tapes?
It's super easy. I can send you some examples of my own, if you're interested
That would be appreciated!
Check the pinned posts in this channel.
Short version is make a folder names "42" that you copy everything into, make a fiolder named "common" that you leave empty, then try it in B42 and see if you need to fix anything.
Recipies will 100% break, your mod will likely be fine or just need a very small tweak.
Perfect thanks for the guidance ππ½
https://steamcommunity.com/sharedfiles/filedetails/?id=3466494064
Steam Workshop::Korea Veteran Trait
I finally made this mod work! well, half work, it doesnt give the aiming and reload xp like its supposed to, but gives the trait and the gun with ammo. Ill figure out why it doesnt give the xp in the next few days.
I can see why the Aiming and Reloading stuff is not working:
Koreavet is the variable that gets assigned to the new trait (really a profession, but internally it's a trait)
but then you call ww2vet:addXPBoost()
instead of Koreavet:addXPBoost()
@spiral tapir tagging to make sure you don't miss that, since I didn't reply to your message when I started the comments
Also, what is this for? Events.OnPlayerUpdate.Add(playerUpdate);
Your function for adding the items is created inside the arguments list of Events.OnNewGame.Add() which is fine, LUA is crazy like that... so there's no need to call any additional Event.Add stuff.
Also... congrats on your first mod!
...I probably should have opened with that. π
I borrowed some code
I'll have to change it then when I get the chance
Easy to fix.
Im laying in bed rn for sleep lol but I'll fix it tomorrow first thing
Thanks for pointing that out though I missed it
I used chat gpt to help a bit
And it did
It got some stuff working like making it show up on the info and making the gun spawn
I literally have no knowledge of programming so I slapped random things together from other mods and A.I. π
Wait where did you get this from?? It's all koreavet for me already
subscribed on steam and looked at the downloaded files.
If you already pushed a new version to steam sometime the client doesn't immediately update, sometimes it gets "stuck" until you unsubscribe and resubscribe.
Is there an elegant way to tell a recipe to take ingredients by weight instead of by number of items?
Nothing about the recipe system is elegant.
You can use "uses" if the ingrediant has a UseDelta,
And the fluid system allows for "X mL"
But I don't think any recipe does "use X weight of this item"
How might one make a mod that allows for radio messages to be seen with the deaf trait
So you'd have to write a custom OnTest and a custom OnCreate to reduce the weight
Thanks for the info. I'll keep poking around at the individual ingredients.
Start my finding where the deaf trait blocks them being seen.
can't find the reference for the function switch that interacts with the deaf trait to prevent messages coming through either
It's not going to be in a singel neat place, it will be everywhere being deaf has an effect.
I've checked through the lua for all radio and chat related functions and found no mention of the deaf trait which means it might be within the base function file
...bad news. looks like it's in java.
it's ok I'm relatively familiar with java
programmed minesweeper in it in two hours for my final in high school
It's not OK, because making a java mod is a very big deal.
oh true
You can do it, but you're committing to extra ongoing work to keep it up to date and requiring users to do manual installation, so it needs a big payoff to justify that.
not viable for a server
a workaround mod might be preferable then
maybe an extra tab or a redirect to a different tab in chat
Maybe if the mesages are in lua at some point you can create a whole parallel display of them, instead of relying on the EmitterSound or whatever the proper system is
which displays incoming radio messages, that is
How are these radio messages being generated? The built-in radio stuff, or other players using radios?
Spawn points lua, it lists spawn coordinates for various professions
Im editing one rn to have only one spawn coordinates, for all professions. How do i set up the "any profession" bit
function SpawnPoints()
return {
unemployed = {
{ posX = 3905, posY = 12254, posZ = 0 }
}
}
end
I used that and it worked for every profession.
I see a lot of mods list every profession with the same co-ordinates, but... that was fine for me.
(in B42, though it is probably the same in B41)
Looks like a different syntax, 5 numbers - presumably "cell" and "location within the cell" - is that B41?
yes
im tryna get the coordinates fromthe online map but im not sure what to input where
there are 3 sets of coordinates
enable the grid overlay
okay
they are
okay i got them down now imma try if this spawn point works
brb
what is this error
Exception thrown java.lang.RuntimeException: can't create player at x,y,z=7732,11899,1 because the square is null at IsoWorld.init line:2799.
Looks like bad co-ordinates.
Z 1 == 0ne level above ground, is that correct?
what numbers did you put in?
The structure for "maps" is weird. (and spawn point mods are technically maps)
No error this time
I spawned in the prison
But a few cells off
Not cells uhh the small squares idk what theyre called
I spawned outside the room
Maybe the web map is slightly wrong on nuimbers
When I looked up the chef earlier using teh map I was ~5 tiles east of a kitchen, in a book shop
Are you in debug mode? rigth click the gorund, check the X & Y coordinates.
How do i get debug mode?
Start the game with -debug as a command line parameter
Debug mode is very very very handy for working of mods and testing stuff
(that link is not the only way to enable debug mode, but it's an easy way)
I got it im loading into the world now
Its not showing me any coordinates
even when right clicking on the ground?
Must be a new B42 thing. Just a sec, you can use the lua console.
p=getPlayer();print(string.format("%d, %d, %d", p:getX(), p:getY(), p:getZ()))
thanks
i dont have this
i should have the right coords now
do you know anything about this?
It worked
Even with z=1
Im exactly where i wanna be
Thanks for the help
I added what seemed to he missing files at that location
Imma see if it workd
yes
im making a thumbnail for it now in photoshop
close enough
could this be my first mod
Even if its a small tweak for personal use