#mod_development
1 messages · Page 147 of 1
I am trying to make a visible trunk
is there a "onputitemincontainer"
or something similar
OnContainerUpdate and OnFillContainer neither one fires when adding stuff to a truckbedopen
GRRRRRR
depends what you want to overwrite, same file path will replace the whole file.
now im really glitching haha
For me this is the first game I mod. But I've been using mods always. It would have been cool if somebody introduced me to modding earlier, but it took a broken game to start me modding.
Or rather all the broken mods on workshop, I've been patching stuff constantly.
plowing trailer the you turn on and off with the headlights. lol
sounds like a realistic survivor wiring job
ah looks like the modeling channel dead or peeps got no idea what\s going on
i need help with this
idk if its uv issue or weights
but it doesn't do this in blinder
How would I go about adding a counter for how many times an item has been used?
{
DisplayCategory = Vape,
Weight = 0.05,
CantBeConsolided = TRUE,
UseWhileEquipped = FALSE,
Type = Drainable,
DisplayName = GnomeBar (Rainbow Blast),
TimesHit = 0,
}```
I set a custom parameter like so in the item definition script
Then in my lua I have the following
```lua
local vapeFlavorDelta = item:getModData().Flavor
How do I change that value? there's no setModData function or anything that I could find
or is there a better way to go about this entirely
The modData once gotten is a table that you can modify as is
but for an items condition or uses - there's a vanilla function for that
Oh you already have it as drainable
basically i want this vape item to be a drainable that works off a battery
so it can be recharged
but i want to limit it to 3 recharges
ah
so basically 1 battery will last 20 uses
but the vape in total has 60 uses of "flavor"
so i'm trying to make a flavor counter for each item but i'm struggling trying to figure out how to assign this new parameter to each item
You could add the counter to the tooltip
but all you have to do is grab the item's modData and modify the table
it's connected to the item via reference and saves with it
local vapeFlavorDelta = item:getModData().Flavor
vapeFlavorDelta = vapeFlavorDelta + 1
ModData is the way to assign custom variables to modded items?
Simply, yes. It's a Lua table for the object. You can store anything but references.
testing this now
but will this modify that value for all items of that type or just that specific item?
modData is per item specific
it's also something that exists for all isoObjects
although behavior changes for certain types
If you're setting it up you have to define it first though
item:getModData().Flavor = item:getModData().Flavor or 0
local vapeFlavorDelta = item:getModData().Flavor
vapeFlavorDelta = vapeFlavorDelta + 1
Otherwise 'vapeFlavorDelta' is nil
local function getVapeFlavorDelta(item)
item:getModData().Flavor = item:getModData().Flavor or 0
local vapeFlavorDelta = item:getModData().Flavor
vapeFlavorDelta = vapeFlavorDelta + 1
print(vapeFlavorDelta)
return vapeFlavorDelta
end```
it works once, but doesn't increase more than one time for some reason
Where are you calling it?
local op2 = context:insertOptionAfter("Favorite","Check Flavor", isVape, getVapeFlavorDelta)
just a context menu option
so i could call it / check it quickly
which that is called by
local function OnFillInventoryObjectContextMenu(player, context, items) --# When an inventory item context menu is opened
local playerObj = getSpecificPlayer(player);
items = ISInventoryPane.getActualItems(items);
local isVape = nil
for _, item in ipairs(items) do
if item:getDisplayCategory() == "Vape" then
isVape = item;
break
end
end
if isVape ~= nil then
local op2 = context:insertOptionAfter("Favorite","Check Flavor", isVape, getVapeFlavorDelta)
end
Not sure why it's locking at 1
Also if you want it to count down you need to make that a - 1
You dont have something capping it to 60 do you?
Kind of odd it is at 60 to begin with
i set it at 60 in the item definition script
the + or - didn't matter currently, I was just trying to get a counter working in general
Where is 60 defined?
{
DisplayCategory = Vape,
Weight = 0.05,
CantBeConsolided = TRUE,
IsTelevision = FALSE,
IsHighTier = FALSE,
NoTransmit = TRUE,
DisappearOnUse = FALSE,
Flavor = 60,
}```
Those get consolidated into the modData automatically?
its able to grab it at least once, so I guess so
I saw this technique by searching in the discord here for "custom parameter" and saw someone doing this method
theirs was a static, unchanging value ; however
Could be related - I wasn't aware such a feature exsisted
Does not seem like it would logically keep referring to the script in this case though
hmmm
local function getVapeFlavorDelta(item)
local modData = item:getModData()
modData.Flavor = (modData.Flavor or 60) - 1
---since it's being added via script you can get rid of the '( or 60)'
print(vapeFlavorDelta)
return vapeFlavorDelta
end
You could try getting rid of the local var - it could have been interfering with it as a reference now that I think about it
Yeah that is what it is - sorry just woke up
You can make locals into tables and retain references but if you localize other stuff it breaks the reference connection
Also changed my snippet to my prefered way to handle modData for the sake of readability I try to cut down on repeated calls
it works! Thank you so much! I really appreciate it!
this is going to make my mod so much cooler i think
any idea what changed? i've seen other mods with this issue, trouble getting tow points to be fixed
@sinful vessel has a huge military semi that is stuck with that state
Could it be related to the wheel placement?
Good morning.
Apart from the two questions I've received, I haven't thought about ZedScript & PZ in the past 10 ish days.
Haven't had a burnout this bad in years.
=/
Hope the coder's block wears off soon
Is there an event that runs before the game really starts, but after OnInitGlobalModData?
Gonna do lua patching and I want to make it run after other patches
like half of the events in the game
ongametimeloaded is a random one that comes to mind
Thanks. I hope so too.
I already have a lot of updates for the extension. I simply haven't written the changelog and updated it.
asadly i don't it just remade the vehicle script. txt from a working on and then went from there
Sad to see so many people confused with scripting and how to do it.
A lot of confusing and winding scripts, often full of deprecated and non-functioning properties.
Question
If I add some mod data to an item
Do I need to transmit it to the server afterwards?
no
really? To an item instance?
they're synchronised automatically
Are you sure
yes
Okay
That makes my job easier
to get how much of an item is left, I call "getUsedDelta", right?
On the subject mod data, what about IsoObjects?
what about them?
If I add some mod data to an IsoObject
Do I need to transmit it to the server afterwards?
yes
players and items are the only exceptions, you usually have to
with transmitModData()
I see.
annoyingly you need to do this even if you only need the moddata on the client
Otherwise it won't get saved?
transmitModData overwrites the moddata for everyone, so if you don't transmit yours it'll get overridden eventually
oh god
it kind of seems like there's a race condition there but i've never seen it come up as an issue so i might be wrong about that part
It was only added in like... B41.51?
object moddata has existed longer than the patchnotes go, global moddata was recent though
Oh I see
so the global is new
this is how I use it, right?
savedUses = items:get(0):getModData().EasyPackingRemainingUses
assuming items is an array of size of 1
yeah
no, hasmoddata is pretty much useless
essentially all it does is check if the item has ever had getModData() called before
yeah
it isn't
then that's a slight issue
How do I make sure that there's actually some mod data loaded...
Though I might be overthinking it
Working for someone else is hard man, you don't know all the use cases
modData is like a Lua a table, it's not ArrayList
the moddata table is created if it doesn't exist, which is why hasmoddata doesn't seem very useful
...Oh fuck, that means I have to work on both types from a single loop
I think you only need the getModData().myVar here, unless you also want to check other things?
no no, I need to, uh...
I save some stuff to mod data, then load it back onto the items
Packing recipes
Can I... Even loop over the result?
Or is the result actually a single item?
Result is a single item.
If you have more than one, they are added in the craft action.
I meant that more than one of an item type
As in, my result is 5 planks, or 5 rolls of tape
How do I handle that
Which part should be modular?
Is the plan to create those manually, or do you set that in the recipe result?
Oh, the result of the recipe is the duct tape
if I was creating those manually, then that would be less problem... I think
and the problem is to add data to them or make them 5?
I have data
Result is 5 items
I use data, to alter those 5 items
my data is 5 numbers
Can I? if yes, how
yeah check the craft action if there's a way to do that. Otherwise spawn them manually with the oncreate.
what are the reasons to use ModData instead of your own file?
well, ModData can be slapped onto live things in game
Craft Action?
can you not do that if you save things in other ways?
ISCraftAction.lua
if you save that to a file, others may not be able to read it.
thanks
I currently have the problem that I got things in moddata I would like to read before moddata initializes
but it's like a cross compatibility thing between mods or what?
Not even. It's data you need to save for later use, by your own mod or otherwise
you can save to your own files if you want but global moddata is basically the game's standard api for that
and object moddata is just a million times more convenient than anything you could do with your own formats
yeah. i will have to check whether in multiplayer the moddata initialises earlier, maybe it'll still be good for that purpose. otherwise I dunno what kind of workaround I should do :-D
what are you trying to do? moddata initialises very early
i've run into it myself but it was a very niche use
need it at character creation
at least in sp it's not loaded until after a bunch of textures and radio things when loading the world
yeah, it won't load until the world starts loading
Uh... I tried to do a getModData().MyVar when that didn't exist, tried to laod it... And I got yelled at for calling nil?
oh nevermind, I'm dumb
I called HasModData on an ArrayLisyt
Right... So, at the moment that OnCreate is called, only a single item exists as a result
OKay so i'm STILL working on the issue from last night.
Hey, anyone know the different ways to have sounds play? I want to add more options for server owners to play audio for events, but I’m not super well versed with the audio modding aspects
Do you need more than one item to be created?
Yes. I create more than one item and I wanted to modify all of the created items
i haven't looked at it beyond sound emitters, but they've told me that if you look into this you definitely need to read the source code
For clarity, I create multiple of the same item
I cannot seem to be able to do that...
probably because of the audio engine switch, there's a lot of redundant methods and methods that just lie about what they do
(e.g. playsoundlooped doesn't loop the sound or do anything at all, it just calls playsound)
Beyond then reading the player's inventory and applying the changes there...
Oh, you can do that. You’d just have to add the data after each item you create. I have done something somewhat similar in a mod of mine, if you wanna check it out
But no, that wouldn't work
Oh, absolutely show me
It’s roleplay descriptors on the workshop, I’m on mobile rn but I’ll try and get a link rq
Got it
neat, I already have it
Oh! Awesome :)
The file has to do with the pinned notes, so you can see kinda what I did there. I could have done better now that I know more 😂 but you can basically just tell it to change each instance of item you add to the inventory
Oh, you seem to have misunderstood me
Oh?
You're creating a paper and a knife
I am creating two knives
and I need to break both
You should be able to do that, just do the same thing 2x times? Basically add an item, and set its durability to 0, and repeat
Issue
I'm adding the items in the result?
and the result is only a single item when that function is called. No other items exist at that point in time
You can only ever have 1 resulting item, but you can modify that too (I do that in my mod too), and you can have it add the additional knife on creation of the recipe, and set that durability too
Yes
The result is a single item in code. However, if the recipe creates multiples of that item, those multiples are made after the OnCreate completes
They even note that as a bug in the code
oncontainerupdate is a misleading name, it's actually called when containers might become accessible/inaccessible to the player
it's not especially useful to modders, it's mostly just used to dirty the inventory ui, it usually doesn't even pass the container that 'updated'
But that is if you have multiples of the item, so if you just add the second knife during the oncreate, instead of during the result, that would be fine, right?
I would have to tell that to the mod creator... But yes.
Gotcha, that seems like the best way imo. The recipe code has some jank, but I’m hopeful that the new revisions for the next update will be better for all of us to make some great stuff haha
Same. I too hope for the base game having less holes with each update instead of more
This however, creates an incompatibilty
Since this is a mod update, items may not have had the mod data
I guess a table of hard-coded values will have to do
Yeah, you could also check for the data at some point, and if it isn’t there, add it in to the items. Could do it “OnTest” for the recipes
Again, I'd need to refer to a list of values
These are packing recipes
The function may be used on a recipe unpacking 4,5,6 or more items
I only know based on the amount of numbers stored in the mod data
or the result...
Or the hard-coded list I need to make
How do I... remove the result from the player's inventory?
oh
I think I found it
Bc you can edit the result on create, you should be able to do it there. Idk the lua for that off hand tho
My plan is to yeet the result and just add whatever I want
What is the ISAction that responsible for swapping bag front to back or part?
What do you mean? Like, the act of equipping a bag vs holding it your hand? Or are you talking about the mods that let you swap parts on the bags?
Well, this is awkward
Apparently when OnCreate is called, the Drainables that went into the crafting are already drained
Which makes sense, but it makes things harder for me
but if they're set to "destroy", then they aren't used up by that time
Okay, now to figure out why my result doesn't get deleted lmao
Apparently there's a field in the script that does that for me, which is... convenient
equip bag and swap the bag location on the go
I include defaults if data is missing, helps if the item is spawned with debug or other means
@bronze yoke so how does onFillContainer work?
i'm guessing when the game fills it with loot?
yeah
well that sucks as well lol
i just want a listener for when a cars trunk has and item put in or taken out.
you could probably just hook the inventory transfer action
Hi Folks!
Is there a C# project for PZ mods on GitHub or anywhere? I code C# and know some unity
i don't think there's ever been anything like that
Ok, whats the best way to start modding? Apologies for the super open question
What do you use for an IDE? Is there youtube channel on this or wiki?
i use intellij idea, but visual studio code is pretty popular too
tutorials are a little sparse but a lot of information is collected here https://pzwiki.net/wiki/Modding
also this: https://github.com/Konijima/PZ-Libraries
not sure if you saw this...
but how i do that?
Wasn't there modding guide or something?
Check threads
what red name do I have to hump to get "OnContainerInventoryChange" added as an event?
Wait... PZ supports loading java libs as well?
not quite, it's a reference library of the game's java for modders to refer to
Can I somehow refer to a recipe that was calling the OnCreate function?
Generic OnCreate
it might pass the recipe object
oncreate gets passed a whole bunch of crazy stuff everyone either doesn't know about or ignores
Ah, then no...
It passes the list of items going in, the result, the specific selected item, and the item held in the right and the left hand
Not the recipe that went in... Drat
Hi, there's already an mod about electronics or a research tree under development?
Does anyone know of a low memory map option for mod development to run dedicated on the same machine? It seems 16BG of ram can only do so much
{
keep GnomeBarRB,
Result:Battery,
Time:30,
OnTest:Recipe.OnTest.VapeBatteryRemoval,
OnCreate:Recipe.OnCreate.VapeBatteryRemoval,
StopOnWalk:false,
AllowOnlyOne:true,
Prop1:Battery,
Prop2:Source=1,
}```
is there a way to remove the "all" option?
AllowOnlyOne:true, didn't do the trick
that's on a single item, not a stack
drainbales have uses, that's probably what it's refering to.
Use Notepad++ like a real man
- itemType=Count,
Specifies the type of item and the quantity of the item that will be used. If the item is Drainable, then the uses of the item are used. If only one item is needed, then only the item type can be specified.
it is because of the drainable
this is what i got from the wiki
i just don't know if there's a way around that
when you OnExitVehicle how do you get the vehicle you are exiting?
i fixed this by simply making it destroy the vape as a requirement instead, then just re-adding a duplicate vape to their inventory during onCreate
for anyone who searches for something similar in the future
vscode is nice, am doing my first mod by forking another one. if you like a video format I found this one to be a pretty nice one, covering the whole process in order. https://youtu.be/-yrmCAwzTbY
1:11 Step 1 - Know your file locations
4:06 Step 2 - Storyboard your ideas out
9:03 Step 3 - Get your files from the game or other mods
11:47 Step 4 - Build your mod files
1:01:54 Step 5 - Create the textures (mislabeled in the video, oops)
1:19:45 Step 6 - Put your mod files in the right structure
1:30:37 Step 7 - Test your mod (please back up ...
Posted on the nod resource thread
setting both to 6 seems to run
this .... IS the official discord?
yes?
this made no sense... are we are already in the official discord. he could just say "i'll pin it to the mod resources thread". the clarification of it being on the Official discord is what got me.
there are so many discords related to pz mod developments. doesn't hurt to be specific
i finally got it all to work. Now each vape has separate flavor and battery level mechanics
cool tooltips
ty each flavor has its own color
would be great if you could reduce the size of WorldItems textures
if you're testing a mod for multiplayer on a steam dedicated server is the only way to do it via uploading the mod to the workshop every update?
Nice
i feel like instead of a % for flavor remaining it should be one of those progress bars like vanilla
because realistically you don't know the exact value
you just guess based on if it tastes burnt or not
You could run nosteam then host
This will allow you to run 2 or more instances of the game without worrying about steam ids
Thats how most modder test MP
ty
This makes sense
Good idea
I'm thinking of reordering parts in the ISVehiclemechanics self.bodyworklist, are there mods that interact with this I should be aware of for compatibility reasons?
Hi can someone help me with how to upload a mod? I have custom textures in my game files that I wanted to upload but idk how
you need to create a workshop directory for your mod. after you make a directory for your mod, put it in C:\Users\YOUR USER\Zomboid\mods, open project zomboid, click the "workshop" button, click "create and update items", select your mod and go from there
Ah oki thanks I’ll try that out
Can I reload mod from inside game without relaunching whole game?
You can reload lua
From specific mod? Or just all lua?
Or if you are in sp just quit to main menu and continue
You can reload your specific lua file from the f11 menu in the search bar and click relod
Debug mode must be enabled, correct?
Yes
Thanks!
Heyyyyyo, is there some way to get player list of server knowing its ip and port ??? (Doing it from code ofc)
Afaik
Ip is not real persons ip
Steam masks it somehow
Which is why you can see the same person login but then the ip is inconsistent
Tho im aware of dynamic ip and such but still it doesnt seem thats the reason
If connectivity is managed via Steam's P2P you're not going to see somebody's IP or port.
MAC ID ftw
do you guys know of an item mod that does something if the item gets added to the inventory of a player?
trying to create that effect but to no avail. hoping to find something i can use as a reference
Knowing current IP of SERVER not player, I think that's obvious enough. for your knowledge tho, ip addresses are inconsistent for players for two reasons, one dynamic public ipv4 address allocation, and in case of using steam servers to connect to the game server (steam relay servers)
Hello everybody 🙂 i hope you're fine !
Trying to find to command to get a player foodsickness
Like getBodyDamage but to increase foodsickness
And i don't find it into wiki
Do somebody know what I could use please ?
Ye, some people who have no idea how networking works always have the most to say about it
I'm saying that if connectivity is handled Steam P2P or Steam Networking, you aren't going to get real IPs of servers or players. For hosted game servers they have some kind of randomly steam assigned ID, and for players they use steam's user ID. Again, only if connectivity is handled Steam P2P or Steam Networking. Anyway, all these questions are more towards actual developers of the game.
its even more fun when you only got IP6
Ye, you're completely right
How many routers in the world are powerful enough to properly handle IP6 tables? 😅
I can tell you a model that sure does cuz its what I use... a Nighthawk :P
that and my motorola gateway
Lmao
My Mikrotik RB4011iGS+5HacQ2HnD as well =_=
my ISP would give me one for a lovely monthly fee but I was like f that.
Hey, I'm not seeing a way to get an ambient temp for a square. I can get the current world temp, but I'm looking to get the temp of areas affected by a stove or other heat source
ClimateManager.getAirTemperatureForSquare seems to be what you're looking for (there's also getAirTemperatureForCharacter)
Yea, I think getAirTemperatureForSquare
Didn't see that one
the "airtemp" is what threw me
I wouldn't have even thought to check ClimateManager so I can't blame you
Yea, that's where I first looked, then when down the ClimateValues hole, then when and looked at the square functions, then the isoObject I'm working with is a container so I went that route, and then I went over to rooms to see if there was a room temp
ahha, figured I'd just ask at that point
perfect thanks @frank elbow
Anyone able to explain to me / provide an example of how to modify existing item without overwriting the initial script?
Basically I want to create a patch for an existing mod, but I want to edit the values of the items after the fact. I am fairly certain I would use the doParam Function, but I wanna be certain before I jump the gun on it
local item = ScriptManager.instance:getItem("Base.Whatever")
if item then
item:DoParam("Weight = 5")
end
Thank you! When should i trigger that? If I need to
it's fine to leave it outside of a function as long as you don't need sandbox options
Nah, that should be fine! Is there a good way to edit a lot of items? Or should I just duplicate that code for each
you can make it into a function to simplify things, and of course you can use loops
Like, make a table with the items and the values to change.
IE,
1 = {
itemNameVar = "xyz"
itemNewWeight = x
}
2 = {
}
3 = {
}
etc..etc
}```
Then just run a loop using the variables from the table, using that data in the one function
???
https://gist.github.com/brandonbothell/433f12368a5f1eb6bc6e92cad9ef3935 I did this to do it
Ooh, I see. Thank you!!! That is super helpful haha. Basically within the same line as what I was going to do, but so so so much cleaner haha. Mind if I yoink the basics? Just for a server specific patch for a single clothing mod
Do someone know where we can find the "Zombie proximity infection" vanilla script into the game files please ? 🙂
Go ahead, do as you please
Hey @bronze yoke do you know if ClimateManager.getAirTemperatureForSquare is client only?
if I run it in my code and print it, it returns the global temp, if I run it in game it prints the ambient temp.
it doesn't look like it's intentionally client only
if the square is indoors and power is on you would expect to get room temperature if that's what you're getting
well, I'm trying to see if I can get the temp of the square to reflect there being a campfire or other heat source near it
I also tried running the code from shared, but get the same result. The code being run from the mod returns the global temp, but if I do it from the lua console on the same coords it gives me the adjusted temp as it should.
which leads me to believe that the server doesn't know what the squares adjusted temp is, which really sucks 😦
it doesn't feel like anything in this should be client only
you should check if the square exists
it'll return the global temperature if it doesn't
function SBioGasSystem.getModifiedOutput(square)
local cutOffTemp = SandboxVars.BioGas.cutOffTemp
local minTemp = SandboxVars.BioGas.minTemp
local maxTemp = SandboxVars.BioGas.maxTemp
local currentAmbientTemp = round(getClimateManager():getAirTemperatureForSquare(square))
print("Square X: ",square:getX())
print("Square Y: ",square:getY())
print("Temps: ",currentAmbientTemp)```

literally this
Skill books do not unlock recipes, only recipe books correct?
I.e. skill level won't unlock new recipes as well, correct?
yea
Is there any way to make specific recipe book finished reading on start, or no need to bother and just add recipes to profession directly?
I think most people do it to the profession directly
then additional question: you can read same recipe book multiple times, but it won't have any effect after first time, correct?
correct
yea, I'm not sure this is functioning as intended 😦
I don't see "NightOwl" implemented anywhere in game's LUA. Do I need to decompile java or something?
it's implemented in java
So, if I want to make trait with new functionality, such as regeneration and infection immunity in LUA, I can't?
you can
a lot of the vanilla stuff is java for performance or convenience, most things are still doable from lua
Good afternoon.
Good afternoon!
Hi, there some mod under develop about electronics, I would like to make one, but if there are some under develop, I must help in the development
What kind of electronics? I'm sure there are quite a few; I'm working on one but it's a bit more limited in scope than "electronics"
Computers, domestic installations and electricity production
Gotcha, not me then—might do something with computers, but not planning on it anytime soon
Sounds interesting, though
Hey guys, general question: .obj files or maybe .X files have a model and a texture. I exported a blender model in .fbx but I dont see a .mtl file or anything like that.
The code looks like this:
model LargeSaltContainer
{
mesh = WorldItems/LargeSaltContainer,
texture = WorldItems/LargeSaltContainer, <-------- Coders block occurs here
scale = 0.1,
}
item LargeSaltContainer
{
Weight = 0.5,
Type = Normal,
DisplayName = Large Salt,
Icon = LargeSaltIcon,
SurvivalGear = TRUE,
WorldStaticModel = LargeSaltContainer,
}
But my question is WHAT DO I PUT IN THE TEXTURE PATH? Will this code work as is because the material is part of the .fbx file or do I need to rework how I write this code? Thanks in advance.
That is also script, not code. ;)
AFAIK the mesh and texture are paths from a folder in media.. one sec.
Specifies the model file to be used. File must be located in "media\models_X". Write path to filename without extension. Example for file "media\models_X\Burger.fbx":
mesh = Burger,
Sets the texture for model. File must be located in "media\textures". Write path to filename without extension. Example for file "media\textures\BurgerTex.png":
texture = BurgerTex,
@primal remnant
anyone happen to know this?
running into this problem with making custom perks where, when you remove a trait from your chosen traits, it duplicates the trait. this is happening with both positive and negative ones, base traits and modded ones. what could be making this happen?
le sigh
Im not at home skiz i could have helped with this 😦
if i can get this working my trailers are don, just atm it leaves the water spraying.
local function MowerWater_OnExitVehicle(character)
local vehicle = character:getVehicle()
if vehicle == nil then
print("No Vehicle")
return
end
end
it always says no vehicle 😦
GetLastVehicle() would be GREAT
onexitvehicle is a lua event so just hook the function that calls it if you need to do something before it
how do i change all footstep SFX to 1 or 2 custom sounds? can someone help me with this? is it possible?
just add if not script then return vehicle or whatever
omg, somebody should fix that
LOL
got one like "OnContainerInventoryChange" ?
i can work with that other than it's being a pain lol.
function GetLastVehicle(scriptName)
local allVehicles = getCell():getVehicles()
local test
for i = allVehicles:size() - 1, 0, -1 do
test = allVehicles:get(i)
>>>print(test:getScriptName())
if scriptName == test:getScriptName() then
return test
end
end
end
local vehicle = GetLastVehicle("Base.MowerWater_trailer");
if vehicle == nil then
print("No Vehicle")
return
end
``` vehicle is always nil.
but if i add a print to show all the tests.
i SEE ir there
so why does it NOT return my vehicle?
😦
HAH! it would also help.... if i was getting the mower instead of the trailer XD
but thank you albion and poultrygeist!
that bug is fixed though!
all i need now is how to tell if a vehicles trunk contents have changed.
Nothing says fun like being up all night to catch up on IRL work.
Are there any good tutorials on reading the lua files for PZ? I get the gist of what's happening, but my syntax skills are a lacking and I'm not sure where to find particular function/method names. Just wondering how those who are skilled in PZ Lua got their start.
Also @red tiger gotta burn the candle at both ends to keep warm.
I'm going to warn you immediately about the state of affairs with PZ's Lua codebase.
- It's not authentic Lua.
- It's trying to be Lua 5.1. Anything past 5.1 is not supported.
- It's an absolute mess. Do not copy the way that the code is written.
Try to learn modules and use this approach.
I was afraid of that. I'm trying to figure out drainables, but the closest I've found is combining water bottles. Kinda messy to read.
Drainable items are part of the scripting data format which is not Lua.
Any .txt file in media/scripts/ is scripts.
They do affect some Lua function executions though.
I can't tell you anything specific to scripting or doing what you're doing. I only know what I do from past experience in Lua and the current projects I have right now to make scripting in PZ much easier.
This is what I'm working on / toward:
Hey @ Poltergeist, are you still working on the solar panel mod by any chance?
People are generally so lost with scripting...
It's such a headache to anyone fresh to modding PZ.
oh, decompile the java
everyone seems scared of reading the java but you'll be solving the puzzle with half the pieces if you don't
Yup.
I believe that the goal should be working towards making this not necessary to mod.
no new features planned
yeah, most of the time i'm only reading the java because there's no other indication of what most methods actually do
Fair enough, I assume radius is 20 for power delivery. Any way to change that to be configurable (I would really like to increase it)? I don't really wanna request an entire mod update just or that but I figure I should ask before I go digging in myself (and probably fail at it)
only rebumping my question as people seem to be peeking at this channel… if anyone has an immediate guess without looking at the code. i can get code as needed upon request
that's rather hardcoded in v41, waiting to see the update in v42
I don't need to bombard you with my work that tries to fix this issue.
Heheh
You hit the nail on the head though if you were trying to state the main goal of PipeWrench.
does your trait use profession framework?
I see, out of our hands I see, that is a bummer -- I didn't know it was hardcoded. Thank you for your reply 🙂
i've seen this issue before, i think i even solved it in my own mods, but i don't remember what the issue was really, but i was using that previously and don't anymore
i am 99% sure (it was made by one of my team’s members) it is based on base game coding, not the prof framework, as profession framework was preventing our custom occupations from appearing despite no errors in code format
I think that it's going to get silly in here when I get my VSCode extension feature-complete.
upon loading in, the traits are fine. but removing them from one’s build causes duplication
well if anyone can figure out how to tell when items are being added to or removes from a vehicle trunk that would be AMAZING.
I'm really surprised that this event doesn't exist.
just hook the inventory transfer action
i don't think they can really get in or out any other way
me too
oh they can fall out actually
i can't find an invetory transfer action lol
hasn’t udderlyevelynn made a patch to prevent items from falling out?
could you see what she has done and see if there is an inventory transfer action?
https://projectzomboid.com/modding/zombie/network/PacketTypes.PacketType.html#AddInventoryItemToContainer i see this...
declaration: package: zombie.network, class: PacketTypes, enum: PacketType
i can't find the action lol
Find in Files
i'm not at my computer but something like that
Thanks man, I was wondering where all the function names were hiding. Java isnt scary to me. I grew up on C++. 😐
this site is handy too https://projectzomboid.com/modding/
function Seeder_Fill_update(container)
print("Updating a Container")
local container = container:getContainer();
if container then
local vehicle = container:getParent()
if vehicle ~= nil then
local Trailer = playerobj:getVehicle():getVehicleTowing()
local bedpart = Trailer:getPartById("TruckBed")
local truckbedcontainer = bedpart:getItemContainer()
bedpart:repair()
bedpart:setContainerCapacity(25)
local CurrentAmount = bedpart:getContainerContentAmount()*4
print("Current % full = " .. CurrentAmount .. "%")
end
end
end
Events.OnContainerUpdate.Add(Seeder_Fill_update)
this si what i was TRYING to do.
but that on event is what i am needing 😦
It's too bad that I don't have some gin nearby.

Get slammed on some gin & tonic and go for a 17+ hour coding jam.
still aint code jammed my menu to completion., lol
check the framework's events it might be saving player data to add them back or something.
ffs.
when you remove items via code it doesn't update the container.
and i need to to UPDATE
It fails for me at id 'io.pzstorm.capsid' version '0.4.2' part. No Load Gradle Changes appear.
EDIT: seems like it happened because I was using standalone version of IDE, and not installed one.
EDIT #2: it also seems that I have to name project as capsid to make it work.
Do you mind sending the code?
Now I'm stuck at this part: Unable to find method ''org.gradle.api.tasks.JavaExec io.pzstorm.capsid.zomboid.task.ZomboidVersionTask.setMain(java.lang.String)'' 'org.gradle.api.tasks.JavaExec io.pzstorm.capsid.zomboid.task.ZomboidVersionTask.setMain(java.lang.String)'Do I need a specific version of IDE as well?
Since I can't use tutorial to get all lua APIs, question to the modding community: where I get all lua APIs on my own?
So basically most Lua code is invocated via events.
UI has exceptions to this rule but it's technical.
You'll need an IDE or rich-text environment to search through the lua folder in PZ's media folder for existing Lua code.
It contains all Lua events implemented in game?
there's a page dedicated to them on the wiki
For previous version.
41.65, not the latest one.
And for latest public release version of the game?
Haven't heard of any new events added since.
get used to that
there are a couple new events, and some of the parameters on the wiki are outdated or wrong
Will only find out when someone says something.
lol
i sent a pr to correct the ones i've noticed ages back (since those pages are generated) but it hasn't been noticed
i'll go find my documentation on one of the new events and do that tomorrow
Thanks.
I don't know what the wiki community is doing but I'm keeping my stuff up to date.
Were you asking for PZ Wiki to fix?
Or somewhere else?
yeah, the wiki
I can edit the wiki lol
I'm probably going to need to go into the wiki at some point and start cleaning & clarifying some stuff.
Yesterday there were talk that all perk's features (for example, Night Owl) can be implemented in LUA. I'm trying to understand structure and figure how to do it. As reference I'm looking at Insurgent profession mod and how traits are handled and see that everything handled via getModData() and events. Hence, I wanted to know all Lua APIs available for modding: events, and parameters that can be called (for example: from attacker, target, weapon & etc.) such as :setHealth() or .hunger or something else.
Sorry. I'm a documenter / tools developer. (Not a dev for PZ)
I don't know technical stuff in detail for helping people with their mods.
hmh because of how selecting traits normally works I guess there is no easy way to check for mutual exclusives within a list of traits? as in whether an existing player's selection of traits is valid
I am making tools to make your nightmare a simple gassy daydream.
that wiki page, this site https://projectzomboid.com/modding/ , vanilla lua and a decompile will be your best friends
And if you want to be a freak like me and code in TypeScript, PipeWrench is a set of compiled typings for PZ that is used to compile to Lua.
Decompile part from https://github.com/Konijima/PZ-Libraries already failed.
yeah, that thing is pretty old and took a bit of messing around for me to get it to work too
i didn't encounter your specific issues though so i can't help you there
Then let me follow your steps from zero in decompilation. Or rather, please tell me what you've done differently from instructions there? Maybe it will work for me as well.
i don't really remember, it was a decent while ago that i did it
i remember having to mess with the memory allocation because i kept getting out of memory errors, but there were definitely other issues i don't remember
maybe you've used older version of IDE to make it work?
no, i use the latest
It's fernflower.
I don't typically decompile the entire game to look at and modify stuff.
Zip up all the class files into a Jar archive, import it in an IDEA workspace and then double-click the .class files.
I've forgot that JAR is essentially ZIP file with classes.
I don't really need it to open created zip in JD-GUI to see everything 🙂
JAD is a very flawed decompiler. It is useful for when fernflower fails to decompile a code block.
Haven't touched Java for quite a while. Fernflower is new one?
JAD also handles constant values better than Fernflower that are above 32767.
Fernflower has been around since before / at the time of creation of Minecraft.
I've used Fernflower since 2010.
Never used it, since for work JD was enough. My routine was too peek code in JD → modify bytecode directly (not healthy stuff, don't do it).
But I will try fernflower now.
I would rather decompile into semi-broken code and fix it, modify it, then recompile it against the code it compiled with.
Where do I download fernflower from?
I can have projects spanning 100+ modified Java files doing this.
Commenting helps me keep track of every change I make.
You can use fernflower as the 'Java-Decompiler' plugin in Intellij IDEA.
You can use fernflower as a CLI as well.
Where to get files for CLI part? I don't see any download links.
I don't know of a pre-built Jar release. I build it myself.
Via gradlew.bat?
By importing the gradle project to IDEA and running the tasks.
Thanks! Now I'll be playing around with it.
What JDK should I tell gradle to use to compile it? Because I see that some classes aren't getting decompiled and throw errors.
I've been using cfr to decompile, although tbf I haven't tried the others
Can it decompile whole JAR/ZIP, or do I need to decompile each file separately?
I wonder
Since minimal display bars shows that it is possible to show customized UI displays for lots of stuff
Wouldn't it be plausible to get The Sims UI to display our character's stats and what not?
Hey dudes I don't know if I'm not figuring this out for myself or it does not exist, I want my custom server to have a timer when a player dies in order to respawn. any advice?
I want to verify something. Basically, when you do target:setHealth(float) you call actual Java function setHealth() from Lua, correct?
It would be and I fully expect it to happen eventually
Look at ISPostDeathUI—you'll likely need to override stuff from there. Someone else was discussing something similar not too long ago, could probably find it from searching in this channel
At least this is what it seems from code point of view (as setHealth() is real name of a function from IsoGameCharacter.class).
If you're talking about setHealth on a character, yes it calls into Java
x:y(...) is not always a Java call, though. It's just Lua syntactic sugar for x.y(x, ...)
Which means devs don't need to bother to make every function exposed through some means, since it will be exposed by default (I assume only if its public)
As long as the class is exposed, yeah. With some caveats, though, since you can't call an implementation with parameter types that aren't exposed (as far as I know, anyway)
Since it won't be able to resolve the implementation you're trying to call
One question here... if I call getNumActivePlayers() on client side... it will return me just the number of player on the client ( 1 or more if split screen) or it will return the number of all players in a server ?
On the client
Thanks
If I copy code from someone else's mod - Zach and Pookie wrote some good stuff for managing options in Players on Map - is a "Portions shamelessly copied from <link to steam workshop item>" blurb at the top of the file sufficient?
My mod isn't related to the map at all, I just like the code they wrote for tying config options to their UI elements and wanted to use it cuz it works well.
Does the mod have a section in its description for licensing? The default is usually to ask for permission when copying code outright (I believe that's the default per TIS modding policy, too), but if it's minor it may not matter. No one can very well copyright a method of doing a thing, but since you're just copying it I'd ask (see https://projectzomboid.com/blog/modding-policy)
K I Feel good about that. I'm not lifting content and an attribution saying which portions I copied feels right. It's not particularly clever or novel code, I'm just lazy and am a fan of using things that are proven to work.
Thanks Omar
sorry for asking again but in what file do I find that line of code? or you are referring to an specific function?
No worries, I could've been clearer—ISPostDeathUI.lua in media/lua/client/ISUI
got it thanks you!
Yes, but you gotta package it into a jar first
Personally I made a fork that lets it take a txt file of paths since I'm too lazy to do that every time
could i somehow get the list of all items in the game through lua code? i want to edit some items with a .lua file, without replacing the .txt scripts
because i want to change the data of all items provided by a mod, but the mod is updating
Has anyone ever reported a mod to be taken down that does the same thing but in its own way? Like say a s mod that has to perform ops the same way to get the result needed but isn't the code of the party filing the report?
I feel like that is something that'll happen eventually.
That scenario of those like it worry me.
Pretty sure copyright law in most countries is the code itself
not it's overall function
unless someone wants to patent a mod I think lol
I'm not talking about copyright although what I'm pointing at specifically could be easily confused with copyright.
Yeah it's more to do with bullying / cornering and holding the workshop hostage in a way.
Frankly if two mods do the same thing I don't think there's an issue
Starting an argument over something like that is just petty in my opinion
Yeah however I wouldn't expect Steam to look into the report to see whether the mod actually does infringe the other.
It wouldn't be the first time someone has abused the report feature for workshop to bully another content creator.
mm that is a fair point
I bring this up because I think it'll more than likely show up at some point.
You are all interesting however I couldn't count the amount of people who I would judge % wise to approach things with other modders here in less than good faith.
20 years of modding will teach you that real fast. =)
Welp you're a lot more experienced than me lol
I'm just poking around in the source for now
I doubt it'd hold much water & if it were taken down it could probably be appealed
People will always try to bend things to see how far they can get away with getting ahead of others. It's my concern over how we handle that going forward.
Couldn't get capsid to work so now I'm going about trying to do something similar myself
Yeah like the progress and subscribers would be restored, no?
Although somewhat more crudely
I'm not sure what is going wrong here -- but the IDE should be java 17/18
That, I don't know—I'm actually not sure how blocking workshop items works, as I've never been on either end of that
I actually had the same issue as WarStalker
The guide is pretty thorough -- make sure you click the drop down for images
Was running JDK 19
Yeah..
Well we'll eventually see it.
Hopefully it won't be a trainwreck.
I see more talk about capsid in here everyday.
Join the dark side and code in Typescript.
Eeh, I've already made it my own excuse to try learning reflection by writing a jar to export the exports
I've seen your projects
pretty cool
I made my own excuse to write a full-blown reflection mapper with nested generics support.
Thanks.
It does.
Loosely related, I've been strongly considering forking pz-zdoc to handle stuff in a way that works better for me
How'd you get it workin
A lot of curse words and writing all my stuff in-house.
haha
A lot of static members are documented as being methods by pz-zdoc, which is a very slightly inconvenience (because it's easy to fix in the type stubs) but worth fixing
I also saw your wip zedscript vscode plugin
Nice. I had to shelve it temporarily due to a megaton burnout.
My IRL job comes first.
Had an idea the other day, maybe could write a plugin that lets you do it in json with all it's existing plugins etc, which then compiles into zedscript
Fair enough
I'm unemployed so I've got time to burn lmao
Just graduated in december
I'm planning on writing a preprocessor language.
been rough
Language structure and design is something of a thing I dabble with.
It is interesting yeah
I'd like to redesign ZedScript from the foundation and then write a compiler to ZedScript.
Json is too unfriendly.
As a user-configuration thing yeah
It's a data storage format, not a pneumonic or expressive language.
that's what yaml is for etc
Yet Another Markup Language
I would be adding stronger syntax patterns for properties. Arrays would be defined more programmatically. Vectors would have their own syntax.
Inheritance models.
mm
item BaseAxe {
// ...
}
item StoneAxe extends BaseAxe {
// ...
}
A way to export/import to CSV would be something I think a lot of people would find useful
for balancing/tweaking
Although that is a bit of a tangent
Why individually edit and mentally keep track of 50 items with the same groups of properties when you could edit one or two instead.
Yeah
My concept language is to follow some of the same goals as SaSS.
I always use that in my web projects lol
A language with more syntax rules isn't a problem if you have a competent IDE / editor with support for it.
I'm curious about this too. I guess they didn't consider any existing formats ideal for their use case
I suspect it to be a product of an older programming mindset.
Which I get, I suppose. JSON is the obvious choice to match the structure but it's not great as a language for scripts
Specifically a C / C++ programmer mindset.
yeah I suspect it's a 'not broke don't fix it thing'
It's the "I own and do things myself" way.
That would make sense
I was surprised to see things like blacksmithing/npcs stuff still in the code when I was digging around
ZedScript is a product of trying to make scripting less cumbersome while not limiting users.
I think it's poorly patched up over the years however the idea isn't bad.
Good idea implemented rather poorly.
Personally the requirement of a trailing comma makes me 😡 but other than that I don't mind it
ZedScript would be pretty ok if it were documented thoroughly and a lot of needless gotchas & pitfalls resolved.
No. I wrote a generator that does it for me.
ah yeah just saw
Months to a year if manually. 5-10 seconds if automatic.
Makes 8 months of development work not seem so bad.
yup
It's there for anyone to pick up and use. It has what you'd look for in terms of intellisense and documentation support.
I wish Lua's type annotation ecosystem were just a bit more evolved
The major plugins seem to invent their own yeah
It's already pretty nice but at least the annotations I use are missing some essential stuff
They're based on EmmyLua
It's not EmmyLua's fault. It's the language itself.
I use LuaCats (used in sumneko's Lua Language Server)
are zero turn vehicles possible?
Prioritizes speed of execution over form.
It's the wild-west of scripting.
JavaScript ES5 but much worse.
I'm not anti-EmmyLua to be clear—I just wish the ecosystem were how I assume it will be in a year or two
The system I use doesn't have complete support for generics which is annoying
I'm not either. I'm clarifying what to blame.
TSTL allows for most Typescript features to apply to compiled Lua code.
I think the luacats thing is somewhat backwards compatible with some of emmylua anyway
=)
I wouldn't say Lua is necessarily to blame either, anymore than Python would be to blame if its typing system weren't mature
Most yeah
That's why PipeWrench-Events plugin allows templated event listeners that shows you what objects are passed for each event.
Generics.
I have a bit of beef with python tbh, mainly that it can teach some bad habits to beginners
How so?
But at the same time it probably stems out of my beef with people not using things for what they were made for
like using python to build something that would be better done in C++
Definitely going to remind myself to take a peek at that—I considered writing a type stub for the same purpose
But figured I'd be better off just using the info from the wiki to generate it, since the event code itself can't very well be used to do so afaik
Nice, I'll just process that & make it spit out Lua annotations when I get the chance
Or you could do your stuff in TS and forget Lua mostly.
Heh.
What do you mean, btw? I don't disagree that different languages are better suited for different tasks, just wondering what you're thinking
I will stick with my beloved (but misunderstood 🥺) Lua
I prefer Typescript for JS development by far but I'm more comfortable with using Lua in this environment
Ah. Experienced modders typically stick with what they know best.
I've spent time modding with Lua since 2015 and I chose to move to TS out of sheer will.
... and rage.
like people trying to write bulk-processing code in python, then wondering why it's so slow and not keeping their mind open to maybe doing it in a different language
a bit specific, but I've seen it before and it triggers me lol
Gotcha, that's fair
I usually ignore people who blame languages first because it almost always is the fault of the programmer.
Usually it's those people who bitch about loops.
Heh.
Java is absolutely capable of running The Sims 1 in 2023.
Very much agree, language superiority discussions are tiresome imo
Like yeah we can discuss their strengths and weaknesses but saying "X language is bad, full stop" is boring
Use Brainf**k to make a game for all I care
Use JavaScript.
Now, we have to draw a line somewhere (joking)
I don't mind JS all that much. I find some design decisions questionable but it's fine
CODEMONKIES! i need to be able to save a VEHICLE into an inventory. make that happens.
You got it boss, we'll have it done by yesterday
Yeah it's not bad, but it got a little out of control, since we ended up writing our own janky type correction anyway
using jsdoc annotations
Want to see reimplementing the same pseudo-class logic from Lua in JS?

What's cool is that script actually does what you'd expect it to.
I had to figure this out when I was working on my Lua to Typescript transpiler.
Lua to TypeScript? You have it going the other way too ?? (idk whether that was a typo)
I'm writing a transpiler that rises Lua up into Typescript.
To migrate existing code to use PipeWrench?
You can already use pure Lua with PipeWrench. It makes things easier to translate.
Ah, gotcha
What if I want to make my own ISUI?
Let's use OOP. Maybe interfaces. Inheritance. Types.
Type-Joins.
ISUI as it is currently contains a lot of dead code.
Also, same property names are used entirely differently in sub-classes in some places making interpretation increasingly difficult.
Have an example?
there's a mouse event function that doesn't even execute in several ISUI classes.
Forget the name.
Also joydata. Who knows what's passed with that by memory.
Mouse up, mouse down, mouse up outside, mouse down outside, right mouse for all of those, double click, mouse wheel. That should be everything, I think, do some of them assume more than that?
I've been looking at the JoypadSetup code recently and sighing (not anything against the code, just wish it were set up more like the mouse and key events)
Been too long for me to recall exact examples.
Fair enough
howdy folks been a while
Hundreds of hours spent in ISUI world has shown me that it's almost necessary to use something like Typescript to properly rebuild it.
it seems i was summoned by ui code talk
youre probably thinking of
---Java hook triggered when a key is pressed.
---
---Requires WantKeyEvents to be true to be called.
---@param keyID integer The id of the pressed key.
function CFUIElement:onKeyPress(keyID)
---Java hook triggered when a key is held.
---
---Requires WantKeyEvents to be true to be called.
---@param keyID integer The id of the held key.
function CFUIElement:onKeyRepeat(keyID)
---Java hook triggered when a key is released.
---
---Requires WantKeyEvents to be true to be called.
---@param keyID integer The id of the released key.
function CFUIElement:onKeyRelease(keyID)
---Java hook triggered to determine whether the pressed key was used by the UI element.
---
---Requires WantKeyEvents to be true to be called.
---@param keyID integer The id of the key being tested.
---@return boolean
function CFUIElement:isKeyConsumed(keyID)
---Sets whether this UI element receives key events.
---@param wantKeyEvents boolean Whether key events are to be enabled
function CFUIElement:setWantKeyEvents(wantKeyEvents)
Those are all executed as expected; I'm wondering what isn't
Doesn't really matter for me, just curious
lol hi browser!
hey
CANNAE DM YE?
most of the dead code in isui is unused render functions
usually overloaded java methods that never end up getting used
my dms are always open
Makes sense. I've been doing some UI-heavy stuff lately but the base classes fortunately haven't given me too much grief
Curious about the unused mouse events because I'm wondering what functionality doesn't exist that those elements expect
Jab mentioned that something doesn't execute—maybe I misunderstood what he meant and it's just that the events are being consumed
theres a bunch of gotchas with mouse events
Yeah, I've learned as much recently
---Java hook triggered whenever this UI element is left clicked. Clicks on child elements do not trigger this.
---@param x number The horizontal position where the click happened.
---@param y number The vertical position where the click happened.
function CFUIElement:onMouseDown(x, y)
---Java hook triggered whenever this UI element is double clicked. Clicks on child elements do not trigger this.
---@param x number The horizontal position where the click happened.
---@param y number The vertical position where the click happened.
function CFUIElement:onMouseDoubleClick(x, y)
---Java hook triggered whenever a left click is released in this UI element. Clicks on child elements do not trigger this.
---@param x number The horizontal position where the click happened.
---@param y number The vertical position where the click happened.
function CFUIElement:onMouseUp(x, y)
---Java hook triggered whenever a left click happens outside this UI element. Clicks on child elements also trigger this.
---@param x number The horizontal position where the click happened.
---@param y number The vertical position where the click happened.
function CFUIElement:onMouseDownOutside(x, y)
---Java hook triggered whenever a left click is released outside this UI element. Clicks on child elements also trigger this.
---@param x number The horizontal position where the click happened.
---@param y number The vertical position where the click happened.
function CFUIElement:onMouseUpOutside(x, y)
---Java hook triggered whenever this UI element is right clicked. Clicks on child elements do not trigger this.
---@param x number The horizontal position where the click happened.
---@param y number The vertical position where the click happened.
function CFUIElement:onRightMouseDown(x, y)
---Java hook triggered whenever a right click is released in this UI element. Clicks on child elements do not trigger this.
---@param x number The horizontal position where the click happened.
---@param y number The vertical position where the click happened.
function CFUIElement:onRightMouseUp(x, y)
---Java hook triggered whenever a right click happens outside this UI element. Clicks on child elements also trigger this.
---@param x number The horizontal position where the click happened.
---@param y number The vertical position where the click happened.
function CFUIElement:onRightMouseDownOutside(x, y)
---Java hook triggered whenever a right click is released outside this UI element. Clicks on child elements also trigger this.
---@param x number The horizontal position where the click happened.
---@param y number The vertical position where the click happened.
function CFUIElement:onRightMouseUpOutside(x, y)
---Java hook triggered whenever this UI element or a child is left clicked.
---@param x number The horizontal position where the click happened.
---@param y number The vertical position where the click happened.
function CFUIElement:onFocus(x, y)
---Java hook triggered every UI frame when the mouse is moved inside the UI element.
---@param dx number The delta change in the horizontal axis.
---@param dy number The delta change in the vertical axis.
function CFUIElement:onMouseMove(dx, dy)
---Java hook triggered every UI frame when the mouse is moved outside the UI element.
---@param dx number The delta change in the horizontal axis.
---@param dy number The delta change in the vertical axis.
function CFUIElement:onMouseMoveOutside(dx, dy)
I'm getting around the child element consuming events in my use case by forwarding the event to the “correct” handler based on where the click occurred
Sounds much more evil than it is in practice, I assure you
perfectly fine to do
think i did it once to allow mouse dragging when clicking a child
was annoying not being able to drag if you clicked on the child
I think it's a little dirty, but it is what it is
As long as it's consistent I'm okay with it
I'm using all of those events except onFocus actually lol, saw it but decided I'd rather handle that behavior myself
How often event OnPlayerUpdate() is called?
i wonder how im going to be able to make blood droplets fall down? i would need an animated tile to follow the playerZed
how do i change all footstep SFX to 1 or 2 custom sounds? can someone help me with this? is it possible?
Are you trying to make skeletons for PZ?
Hm... Licker β will make all these stairless safe houses rather horrible trapbox 😄
Our team and collaborators are building it slowly
If you want to join just dm me
Ill add you to the collab chat
Send you the repo link and the plan
Boss monster when
I kinda want a demon zombie that has bone sword ooo
And juggernaut
This will make OP mod less OP
Mutation trait when
Also swimming hmm
Jumper zombie
Boom zombie
Siren
Fire resistant zombie
Anything from left4dead hehe
Child zombie and baby zombie
Maybe also a flesh blob that can spread
Hmm

wait that is possible using the throw
but then
the projectile itself sucks
like its not gona stay wherevr it land it will bounce
Ye
and its java sided i bet
but this is an immortal zed whenver its not moving
you can only hit it when it is moving
links in my profile if you want to see progress and details
Make youtube reel
id rather make the mod haha
reel will follow when its done i guess
Yea
Licker β from RE universe is must have. Scary. Crawls on walls. Grabs people with long tongue. Very poisonous. Doesn't care about stairs.
wrote it =_=
Maybe make them immobile then but the animation,,, how
Yeah, to make it possible, devs will have to implement Hook framework that allows grab people/things/etc to or fast jump to them.
In theory it is. OnHit something set player or target X.Y close to player or target X.Y
But animation will be lacking.
Yeah you just teleport the play infront vut you cant have animations like the toungue to behonest
hello cuties, I'm banging my head against the wall trying to learn Lua scripting for PZ modding
I don't think banging your against a wall will be very helpful in that process but whatever works
If I want to change a weapon's script item properties, is there any way to make my changes savegame compatible? Since all weapons of a type already existing on a save will use whatever the old values were. Adjusting the values of an item object itself is itself simple enough, but I'm not sure how you would get all of the items to manipulate their data in the first place, if there's even any feasible/practical way to do so.
On further thought, can't think of any way better than adjusting weapons on OnEquipPrimary/OnGameStart events, but if anyone has another idea let me know.
@frank elbow 
In short, I'm trying to script up some magic that has a check run against any container, if the ambient temperature reaches 0c, to treat said container like a freezer, without needing electricity.
A ghetto way to make freezing weather cause food to freeze if it's in a container, and it's not in a heated room
also checks if it's already a fridge/freezer, so that it doesn't tinker with those
Is there a reason vehicle mods use the Base module? I test now with custom module
Vehicle: ok
template: ok
custom parts: ok
models: ok
???: not ok?
In my experience a lot of mods just don't realize that they're not supposed to use base
only downside is, it seems to require adding your module before everything so it's myModule.template, etc.
maybe convenience? or just more simpler time writing stuff? I would be a bit tired if i would have to write module.xyz all the time
I feel that, imagine I change it and then find that I need to revert 😅
can't use templates from other modules
it only searches base
Any tips for how to get started with modding? I have a very, very small amount of coding experience (Mostly doing very simple edits to GMod mods) but other than that I'm completely clueless.
you mean other, not your own modules? Because I can use non Base as stated above. Unless there's a part I didn't test yet?
how did you do it? what's the syntax?
i might be mixing two things here but i remember checking the code and seeing that it was written to only check base
Specifically I'm trying to make hunger and thirst increase slower and more realistic and add a way to disinfect wounds and cure early stage zombification with a lighter at the cost of burning yourself, so any knowledge that would help with that would be appreciated.
module AVC
{
imports { Base }
model WindshieldArmor1 { mesh = Vehicles/WindshieldArmor1, texture = Vehicles/Black_Steel, scale = 0.004, shader = vehiclewheel, }
template vehicle TeamOrbitProtectionParts
{
part WindshieldProtection { area = Engine, model { file = AVC.WindshieldArmor1, } }
...
}
}
module AVC
{
imports { Base }
vehicle CarStationWagonTiered
{
template = AVC.TeamOrbitProtectionParts,
...
}
}
hmm, that does seem to be what the code says too, i must have been thinking of something else
Inline bracing is so much prettier.
very nice
How many poly is the model btw
hello dude! I made my way thru and I modified this script in order to work as I wanted, really appreciate your help!
now I was trying to join this server from another client and I'm getting a message that such file is not the same, is there a way to quickly turn this modified file into a mod that a client can download ?
function GetLastVehicleArray(scriptName)
local allVehicles = getCell():getVehicles()
local test
local carlist = {}
for i = allVehicles:size() - 1, 0, -1 do
test = allVehicles:get(i)
print("Array:" .. test:getScriptName())
if scriptName == test:getScriptName() then
table.insert(carlist,test)
end
if i = allVehicles:size() then
return carlist
end
end
end
``` i know this is wrong... how the hell do i add the cars to the array
See the pins and threads in this channel. The wiki & guides should help you get started. I recommend avoiding overriding entire files, if you can help it—overriding individual functions instead is less likely to cause issues
I'm a bit confused, are you trying to add to allVehicles or to carlist? I'm assuming allVehicles is an ArrayList, is carlist a table?
test = allVehicles:get(i)
I see that part, I'm asking about carlist
So you're trying to add all cars that match the script name you're searching for?
Dunno why you're looping backwards, but the general idea of the code is okay? The if statement condition should use == and I think you meant to check for equality with 0, but rather than returning in the loop you can return carlist after it
i want to find all the cars in that cell with that script name. i wan to return a list of all those vehicles.
return outside of the loop, checking within the loop if you've reached the end is redundant and bad for performance
function GetLastVehicleArray(scriptName)
local allVehicles = getCell():getVehicles()
local test
local carlist = {}
for i = 0, allVehicles:size()-1 do
test = allVehicles:get(i)
print("Array:" .. test:getScriptName())
if scriptName == test:getScriptName() then
table.insert(carlist,test)
end
end
return carlist
end
i'm not scolding you
hey @fast galleon
function GetLastVehicle(scriptName)
local allVehicles = getCell():getVehicles()
local test
local playerO = getPlayer()
for i = allVehicles:size() - 1, 0, -1 do
test = allVehicles:get(i)
if test:getDistanceSq(playerO) < 1 then
return test
end
end
end
``` this works WAY better when you exit a vehicle.
so if you need to do something you can grab that car right away.
now for the array bits!
hi guys how do you apply two oncreate methods in recipe?
have one onCreate function
have another function
have the onCreate function call the other function
That's what I would do
alternatively, there is a difference between onCreate in the item definition script and recipe.onCreate
item definition onCreate is the function that occurs when the item is originally instantiated
@little kraken
How can I make my custom context menu item have a requirement / be red depending on a certain condition?
for example the "vape" context menu option
i want it to appear like the smoke option from when you try to smoke without a lighter / matches
but i need to do it without the requireInHand parameter
any ideas?
the condition that needs to be checked is the usedDelta of the item (battery charge)
i looked through ISContextMenu.lua but there wasn't anything I could find besides coloring the entire context menu
i need to stuff a vehicle into another cars glovebox, how do?


