#mod_development
1 messages Β· Page 309 of 1
OnlyZeds π
maybe I should try to embed the stock a bit into the pipe itself
cuz that tape might as well be doing nothing if the pipe isn't pushing against the stock itself
kinda like how when you attach a knife to a spear, you want to cut out a space in the spear for the knife to push against the wood, and then tie the knife to the wood with it in the space
I mean it from a weapons point of view looks real nice, maybe instead of joining with tape, you could use brackets to hold it in place for stability over the tape?
If you know what I mean?
I mean sure it looks nice, but without any back contact between the barrel and the stock, it's not gonna work properly
Ah I get you, like a small u cut into the top of the stock which the pipe would slot into before getting joined?
eh it's fine I guess
I don't need to get that caught up in the details
besides, I realized there's probably enough contact here for the recoil to get transferred properly
I'm really struggling to understand lua. How the f do you insert into a table? Why is this getting a tried to call nil?? local ffs = {} ffs:insert("0")
table.insert(ffs, 0)
it's sort of hard to explain why without explaining some more advanced lua concepts but tables don't have any functions by default for a couple reasons so any table library functions are called with table.funcName(theTable, ...) and not theTable:funcName(...)
Ok thanks. I am truly spoiled with high level languages I guess
Circumcised
Oh, ait
I would highly recommend downloading a gun mod so that you can have a reference point in blender
because the models are genuinely very very small
You work on them in 1.0 and then shrink them down to 0.01 for export
π«‘
is there anywhere where I can read about how to use hooks?
guys i havent tried doing this before so idk how.. but anyways
i want to make a recipe (b41) that uses 4 items but those items can be either poisoned or not
since the variable is unknown , do you thinkj i need to create multiple versions of the same recipewitht the item=qty
or just do this
recipe Pack Moonshine
{
DeadlyMoonshine/Moonshine,
DeadlyMoonshine/Moonshine,
DeadlyMoonshine/Moonshine,
DeadlyMoonshine/Moonshine,
RemoveResultItem:true,
Result:MoonshineCase,
OnCreate:Recipe.OnCreate.PackMoonshineCase,
Sound:MoonshinePack,
Time:15.0,
}
Good morning guys, is there chance to get the positive & negative character effects by name?
Only found the int method with 0.15 = hungry etc.
multiple recipes is the only way to do this
b41's recipe system is just really badly equipped to handle this exact kind of thing
HELP!I uploaded my mod to the Steam Workshop, but it turns blank. Why is this happening?
What do you mean by "name"? The name of the thing you are checking (hunger/thirst. etc) or the moodle level (moodle 1, moodle2, etc)
the mouse over name of the effect. for example hungry, vergy hungry, thirsty, very thirsty
Those strings will be in the translation files.
AFAIk there's no way to know what level a moodle shoudl be at othe rthan getting the numeric level and knowing where teh breakpints are.
If you're on B42 try looking at https://steamcommunity.com/sharedfiles/filedetails/?id=3395171770&searchtext=lua+moodles
(there are moodle framework mods for B41 as well, they may have a function to get the level to convert to a text string instead of just a number)
ahhh they called moodle's... thanks! will look into it
yup! a lot of moodle stuff in handled in teh java side, which is why mods like "moodles in lua" exist so it's esier for modders to work with moodles
Otherwise it's all stuff like getPlayer():getBodyDamage():getUnhappynessLevel() and knowing which count up, which go down, and where the breakpoints are for moodles to appear.
is it btw. still worth to code mods for b41 or is there not that big chance expected to b42?
from mod perspective
Personally I only do B42 because that's what I play and I don't want to keep another copy around just for B41 back compatability testing.
But there are a lot of people on B41 still for multiplayer.
in general, b42 did not really break compatibility nearly as much as people expected
so i don't expect further updates to break much except when mods are very directly related to in progress systems
So... I suggest just go with whatever version you are using if you're only doing one, or you can make mods that work in both (if teh mod is for stuff that didn't change a lot)
There will be a lot of small breaks in B42 updates - things like recipe syntax changing or chaning the way halotexthelper works for some reason.
But those are all quick to fix
in my experience with modding exclusively for b42 since it released, updates have broken things but it has usually been 'change one function call to the new one'
mods with recipes are more prone to break since that's an in progress system
i didn't know taps were going to be an in progress system but they've made major breaking changes to those two times in a row too π
We might get some bigger changes with the craftingand fluid systm, but at this point I expect it to be more adding stuff in than changing the fundemental design.
mhmm. i suggest you both modded in 41 and 42. is 42 easier in order of API&Events?
42 has some stuff 41 does not
yes but not majorly
Not enough to be a big difference.
it's very similar either way but they did expand on some pretty basic requests modders had
The B42 aiming system will get a big update, but 1) it needs a big update 2) mods don't touch that because it's all in java and 3) it will probably get half a dozen random huge updates until they decide how it should work.
many thanks to both of you! rarely seen such a good community for a game.
The Community is a huge plus for Zomboid
I need to add a few more wiki pages about such frameworks
huge means not good. looking to league of legends
Depends which part of the community you look at
"huge plus" not "huge community"
Because I can assure you there's terrible people in both PZ and LoL and great people in both too π
thats true Jvla
Just go in #general_chat and dare to tell me most of the time it's lovely there lol
of all communities i've been in i'd say pz's is on the bad side
but the modders are mostly separate and mostly quite nice
And games with a learning curve like this tend to keep very good communities, becasue 1) you don't get flooded with inmpatient people and 2) everyone remember how excited they were the first time the saw snow, landed on the Mun, got a dwarf to put on an entire set of armor, etc.
#general_chat isn't great, but by the standards of modern online gaming it's a veritable utopia.
Anyone want to go into #pz_b42_chat and ask if multiplayer is out yet because "the channel name hasn't been updated in a while so I want to know if it's still accurate"? 
you helped me, so i will help you now
hold my beer
looks like they get this question kind often, because the reaction is kind pissed haha
hahahaha
Yaaas. And then when they freak out just be like "why are you so mad, what's MP?"

So there is a mod Ladders, and whenever I pick up Base.SteelLadder , the picked up item turns into Moveables.industry_railroad_05_36, is there a way I can convert it back to Base.SteelLadder on pick up?
nvm lol. i just added it on the crafting list, forgot i can do that .
ok that did not work, just crashed the game ;_;
omg so if i have 6 types of moonshine and i want to pack them i should make 126 recipe just to make that packed version omg
moonshines:
clear, peach, apple,
deadly clear, deadly peach, deadly apple,
hook on actions such as grabitem, pickup, transfer, etc..
and add a check if its Moveables.industry_railroad_05_36
if its that then despawn it and spawn the Base.SteelLadder
you can also just use inventory contextmenu event
OnFillInventoryObjectContextMenu
Im gonna try this tomorrow.. ty for the advice β€οΈ
how i can catch up the current animation? running, idle, read, eating, sit, aiming
I have tried player:getCurrentStateName() but running, read, eating etc. is not in there
Reading is a timed action, not exactly a state
Overall I suggest checking the java doc
Eating is a timed action too
Check IsoPlayer and inherited methods
Thanks!!
any time
ait so little help needed
the scale is set to 0,015 btw
is the scale script okay? Changed it down a little bit further
The scale in blender should be 0.01, also this is why I said you need to compare it to modded guns
here's the rifle compared to the barrel of a pistol that hasn't been scaled down yet
if done properly in blender, the scale won't need to be set in the model file
Yeah I set it to 0.01 in blender
Then replaced old model files with the new model
can you show the item in blender?
Yeah, gimme a sec
Also, scale in the code doesn't seem to change anything
here's the model without texture @vast pier
yeah that's too big
see the comparison with the pistol barrel?
It's so small that if you zoom in on it, the camera clips through
Here's the grid so you can better see the size
almost exactly 6 squares
so this should be OK, yeah?
use the grid comparison I did above
looks better size since it's scaled to mm in blender
wait why the hell do you even need to scale it down in blender???
surely you could just use the model scale in the script file right?
yeah ik that's because it's zomboid being zomboid
Makes it easier to position, as the txt scale can make guns the right size, but the wrong position when on your back n' stuff
Here's an example of a gun looking right in the player's hands, but wrong on the back because I edited it using the txt params instead of in blender
Also because the model's scale affects the muzzle flash size
Same gun after I fixed it in blender
well first off, why are you developing your mod with a bunch of other mods loaded
makes it kinda hard to find your error
also, sub to errorMagnifier
Don't think that scale 0.01 will automaticly make your model be "perfect size". Thing of it as if you were to import ANY vanila model, what you see will be 100x size of the same model in game. So they do usually have 1x1x1 scale (though some have 0.25 for some reason) and are 100 times bigger. If you set it's scale to 0.01 Then it will be 1 to 1 ingame (it will be small in blender, so you will need to scroll alot and change camera clipping settings to see it).
Then if you have your model change size to your desired one based on imported model (or even use Player model for size reference, that one isn't 100x bigger, at least not one pinned by me in #modeling )
You have 2 ways of changing size, Scale, which i personally always set to either 1 or 0.01, and then work on it in 2nd way of changing size, EDIT mode
also yeah nik just made me realize. I said to set the scale to 0.01
You need to set it to 0.01 and then use the edit tools to size it further if it's still too big
the scale should stay at 0.01 tho
then after it's sized properly, you can set it back to 1 scale for editing the model itself, since it will still scale to the same size when put back to 0.01
allright
so
if I did the resize in blender further than 0.01, is it maybe the reason for crashes?
maybe tbh
also the grid squares are 1:1 so you can have it in 1.0 and scale it based off the large squares
the rifle is 6 large squares when 1.0 and 6 small squares when 0.01
also you should rotate it 90 degrees on the X axis and have the barrel facing up the Z axis with the grip going to the right on the Y axis
If you are making a pistol, the grip should face to the left on the Y axis instead
why is my hood at the origin even if I did apply all transforms?
Because of animation maybe?
What a scene
Why does using Vehicle shader mess up UVs?
get flashed
New page to have common issues made by new modders and their solutions
https://pzwiki.net/wiki/Common_issues
are there any details on how muzzle placement affects accuracy?
I have a concept I want to mess with, but I would need more info on how the muzzle attachment in the model txt works
Is there a way, to make worlditem model be different to the model of the item in hand?
Yea, simply chose a different model than the one in hands
which option is it? Weapon Sprite?
No, just the option where you chose your world model
ohh
now I see why I was confused
I don't have this defined
so, I should just type something like worldmodel = ? @bright fog
Yeah, link to a different model script
followed by
model pipegunonfloor
{
mesh =
texture =
} and so on
allright, thank you very much
is the zomboid code case sensivitive? @bright fog
Uuh not sure
ait
sorry for asking so much, but
is it the right option?
WorldStaticModel = PipeGunOnFloor
or did the pz extension screw me over
Iβm 95% sure itβs case sensitive but even if it isnβt, why type them out differently?
In your example, it should be WorldStaticModel = pipegunonfloor,
When the safety rules say "full face protection and a protective apron must be worn during testing"
There's also a risk something referring to a file will be case insensitive on windows, but care about case on Steamdeck/Linux... definitely best practice to always match case.
hi, is there a way to use the hardcoded debug functions such as godmode without the -debug being in the game properties
i haven't found any examples except getPlayer():setGodMod(true) which does not work without debug enabled
(b42)
just go in the files
im trying to debug it rn
No I mean, go in the console file
.
its stuck at >parsing script recipes.txt
media/scripts/recipes/supportcorpsrecipes.txt
DEBUG: Script f:0, t:1741043692404> ScriptManager.ParseScript > Parsing...

I'd say wrong script format
Verify comas
A lot of the debug features are lua control for what shows up in context menus, so if you have a specific cheat you want without debug mode it may be possible... or for most you could make a mod that does the same thing (if one does not already exist)
Damn... I was about to put the finishing touched on my high-beam mod when I realized I can make it even better by attaching spotlights to vehicle parts other than headlights.
Since there is no control over headlight intensity/distance, but you can move the lights around and adjust how much they spill light outside the cone...
so I can make a super light using 4 or 5 light sources.
Yeah I tried to call god mode through getPlayer():setGodMode(enable) but it only works if debug is enabled
maybe because debug enables the actual script?
u can just steal the script if u can find it and replicate it
make a new godmode essentially
It's a java thing, you can see setGodMod checks for Role.haveCapability(this, Capability.ToggleGodModHimself
What is your actual goal? There are ways to prevent dying - check out Mark of Caine for example.
To be able to turn on godmode and ghost mode without debug and all of the overlays that come with it essentially
What file is that?
Take a step back: you don't need to turn on god mode/ghost mode, you need to be invulnerable/ignored by zombies.
Yeah
Mark of Kaine is a mod that gives an example of not being able to die.
Braven's camoflague is an example of a mod that makes zombies ignore you.
If you see how they do it you can take those functions and use them yourself.
We get the number of seats in a vehicles by using getPassengerCount
local passengerCount = vehicleScript:getPassengerCount()
I iterate through all these seats running getPassengerPosition on each
local outside = vehicle:getPassengerPosition(seat, "outside")
However, on any vehicle with 4 seats or more, getPassengerPosition produces nil - 1-3 produce valid values.
Any ideas on why this would occur?
do these seats all have doors?
they probably don't have an outside position if they don't have a door
Yes, police car and taxi do, but the seat van doesnt.
From memory camoflague doesn't mute your attacks, so if you fire a gun teh noise will still attrack zombies - they just won't react to you. You would need to do some extra work for that, or just accept that depending on what you're doing.
I can see why that may happen for seat van if that were the issue since you have 4 entries and 6 seats. but for vehicles with 4 doors and 4 seats... dunno
not sure, but i took a quick look at how this is used by the vanilla game and nil seems to be an expected value
hrmm, I'll take a look as well. I dont think I ever looked at the Java.
getPosistionById i maybe missing.
it's also reasonable for getPositionById to return nil
i looked at the police cars and they seemed like they had outside positions defined for all seats though
nvm that
getMaxPassengers() ?
Yah, police cars should for sure
getMaxPassengers() returns the length of the vehicle's passenger array, getscript():getPassengerCount() returns the size of the vehicle scripts passenger list
I'd expect those to always be the same unless the vehicle script was changed after the vehicle was generated.
Hrmm, what would prevent getMaxPassengers from being the same size as getPassengerCount
and you beat me to it
i can't imagine any reason they wouldn't be the same
as far as I can see, this is where it gets set:
more context - it sizes the vhicle array from the script's passengfer list size, then copies each element in, then has some "make up a new passenger if there is no script passenger" logic that should never get touched.
I dont think the amount of seats is the issue. Its getting the correct amount of seats. I think we have that established.
The main issue is that valid seats with doors are nil on getPassengerPosition(seat, "outside")
only seats beyond 3
I've found it really helpful once you start doing things that don't have good examples in lua. I used ZomboidDecomiler to get the java files, and then VSCode to view/search them.
Yup I have a decompiled version of 41.78
I am looking at it now π
If you're working on B42, make your own local decompiled copy
Though a lot of things didnt change between versions.
I am working on MP mods, so havent touched B42 yet
Is there any way to identify via lua which sprite an item is using from WeaponSpritesByIndex ?
Hi there! Is it possible to change the tilt of a hat? I tried changing it with rotate in the model script, but it didn't work. The hat is the vanilla sheriff's hat, I only made a texture change but I would like to tilt it back a little
module Base
{
model M_CARLHat
{
mesh = Clothes\M_PoliceHat,
texture = Clothes\Hat_CARL,
static = TRUE,
scale = 1,
rotate = -10 0 0,
}
}
you need to use Blender or equivalent software to adjust the model i think
the hat model in question should be in models_x/skinned somewhere
if it's an .fbx file you can load it in Blender and adjust it that way
the model script is for the world item (eg when it's on the ground) afaik
I think I just understood, I was experimenting with the XML but I believe it's not working either. If I wanted to modify it with Blender, how would I make it positioned diagonally on the head? I believe this would be adjusted in some code because the hat should be the same, only the position in which it is worn should be different
by any chance, would you happen to know any mods that let you faze through walls? like the noclip
Does anyone know how to make custom radio frequency to appear in walkie talkie channels? What defines pool of that frequencies and if there's even a way to change it?
I think I found it. TY
Hey man! debug menu mod brings the option to go through walls like in vanilla debug menu if that's what you mean
hi, whats the name of the mod?
nvm, I guess I figured it out
try this and see if it enables setting god mode: getPlayer().role:addCapability(Capability.ToggleInvincibleHimself)
Note: will need Starlit library installed
and similar, getPlayer().role:addCapability(Capability.ToggleNoclipHimself)
or no need for starlit:
getPlayer():getRole():addCapability(Capability.ToggleInvincibleHimself)
multiplayer isn't even out yet and we're already hacking through their permissions code? π
It's not security if it lets you edit yoru own role π
i suppose in multiplayer these changes won't be replicated so you'd be banned anyway
Role might be set to readonly...
looks like starlit could get past that anyway
it'll be a sad day when someone finally works out the security exploit that gets field access removed
Can starlit access private fields?
yeah, there are absolutely no restrictions on what fields it can access, so long as it can get an instance of the class
and the class declared those fields
it can even access fields of non-exposed classes, but you have to use slightly different api for that (the object.field syntax only works through hacking the metatables, and non-exposed classes don't have metatables)
I can access name and description, not isReadOnly
it is a function?
that's because the method shadows the field
try local Reflection = require("Starlit/utils/Reflection"); print(Reflection:getField(getPlayer():getRole(), "isReadOnly"))
not happy,
wtf
my sample code might have been bad
that's definitely not an error that should be able to be thrown by that function
looks like we can acess the capabilities list, I am not figuring out the sytax to add to that though.
oh!!
Reflection**.**getField
it's static, obviously π€¦ββοΈ
(function makes no sense to be anything but static, is the original author of the function, etc, still gets it wrong)
you need to adjust the position of the hat relative to the armature (the player animation model) - if you can load it in blender, try rotating it and see if that does the job
tip: you don't need to reload the game each time, the model updates in the game when its changed, so long as it was loaded properly the first time
getField is a lot slower than the regular method but it works for shadowed fields and non-exposed classes
How do I set a field using reflection? It didn't like just adding on "=false"
oh, you can't set them
it's technically possible in debug mode but i never added it since nobody wants to find out their mod only works in debug
hahahaha
but if it's an object you still have a reference to that object
fair enough
i closed my ide but iirc that method just added the argument into a hashset field
so you can just access the hashset and add it
ah, but a boolean is not an "object".... can probably edit private HashSet<Capability> capabilities = new HashSet(); directly
I turned it 5 degrees and that turned it into a BIG hat haha ββit's huge now
Thanks, even read-only access to protected stuff is helpfull
yeah, this whole 'getting access to objects you really shouldn't be able to' thing is why i think there's probably security exploits involving it, but this stuff has been common for a while now and nobody's found one yet
i reported a pretty bad security exploit to tis that was since fixed so i guess if starlit's field access causes one that's just evening the score
you can scale it down in the blender workspace, or when you save it
probably some trial and error to get it to the right size
Excellent, this is very helpful! When I export the file, I should choose the scale, right?
sorry, yes, when you export, not when you save
saving creates a blender file which you probably don't need
Yes i saw it when I tried it as you said, a question from a newbie in this... Is it necessary to convert the FBX to X to place it in my models_X folder in my mod?
no, zomboid recognises FBX just fine
oh is great! TY!
I tried it but the hat went back to normal. I don't understand why but now it doesn't even change the scale to giant when I modify it like I did the first time.
how did you see the model change the first time?
if you have added a new fbx somewhere, you need to restart the game i think
Ah, that's probably the problem, I would leave the game and re-enter. What did you mean today when you said I could do it without leaving the game? That I would directly modify the FBX in the mod folder?
if you change an FBX that is already loaded by the game, it will update
if you add a new FBX it won't see it until you restart
oops
Yes, that was the problem! I missed the instruction. TY really
work now!
great, good job
guess I'll be playing with the scales for a while now haha ty again
bro i want Java docs in dark mode
Hi! If I trigger an event in the client folder, can we expect that it will be detected by code in the shared folder? Does this work for B41 (multiplayer)?
More precisely: if I define a function and add it to the event in the shared folder, will it be executed when the event is triggered by code in the client folder?
on the client it will be, on the server it will not be
thanks! that's all I need!
Is there any good mods that allow you to start your game in the forest for b42? For like a survivalist playthrough
so not sure about this i succefully wrote the code but the trailer didnt load in, so not sure what to do here its also showing 4 tires and not 8 in the back.
I wondered why the headlight lights are so close in game. i always gets surprised by random stuff in the middle of the road.
It wasn't so bad with the B41 lighting engine on default darkness, but in B42 they really need a boost.
Especially when handheld flashlights are brighter with more range.
A similar question as my question about the events from above:
When I define a local variable in shared via
return var```
can I access and modify it in client? When modified in client, will the modification have effect in the shared folder again?
yes, but of course that code only runs for the client, so it is only modified for the client
Any ideas on how I can prevent a player from walking onto a square aside from teleporting them?
Safehouses prevent players from walking on its squares but also teleports them if they manage to get on the squares. However, 75% of the methods/functions used to calculate the collision are not accessible.
I haven't seen anyone talking about doing this or seen any mods that do this - has anyone else?
Finally finished my simple mod. a bit janky but works for me. π
https://steamcommunity.com/sharedfiles/filedetails/?id=3438123707
is there a better way to test item distribution?
The Settler Update is here!
Here's all the new features:-
Milk Pasteurization
Youghurt Making
Paper Production
Gunpowder Production
New TV Model (+Light effect)
Military Police Helmet
Wood chopping (Make firewood)
Jam Making
Candle-making (Using Beeswax, acquired from honey-making)
Blacksmith Trading (Sell your forged goodies in bulk!)
Bug fixes
2 New Sandbox Loot Categories (Gunpowder & Paper + Dairy Production)
https://steamcommunity.com/sharedfiles/filedetails/?id=3434464110
so no way to modify a local variable in client and then afterwards access the modified variable in shared again? (with the modified content from client ofc)
it's hard to explain exactly but on the clients that ran that client code, the variable is modified in all contexts, but on the server which doesn't run that code, the variable is not modified anywhere
All players, or selective? For all players (and zombies) you could make an invisible wall and disable sledgehammer-ing it.
selective, some players should have conditional access
I havent looked at it from the invisible wall aspect. I wonder if you can set a switchable flag that would allow walking through on and off.
Ive been trying to write my own collision code. lol. fun....
You shouldn't use Mod Options for things that modify gameplay because the day MP comes out you'll have to use sandbox options
Keybinds and debug mode that's good however
But glow level and fix headlights, you should most likely fix it with sandbox options
I decided to put them all in one place for now while I work on version two of the mod.
You see I realized... why limit myself to two shitty light source when I can glue a shitty light source onto every single VehiclePart?
I just need to work out how to turn them all on and off when the main headlights are turned on/off, then a bunch of faffing about to work out the new light layout. Also I want to replace the glow level menu option with dashboard switches for highbeam and floodlights.
π
I bet I can get all that done before B42 multiplayer is out π
Any ideas on how to remove the Reports portion from the context menu when it's a recipe?
Does a mod add that? I've not seen context menu recipes like that before
(but I've had context menu recipe lists disabled for weeks for performance reasons)
Yeah, it's the one I am currently working on
We are on LUA 5.1 so no bitwise operations, right?
yeah
is there a good resource on mod porting? specifically b41->b42
I don't know, but if you know how to make a mod, then simply do everything the same but add a 42 and common folder in the same folder "media" goes in. Then copy mod.info and the media folder into "42" along with the poster.png and you can troubleshoot from there.
Make sure the top level "media" folder gets any changes the one in 42 does. I usually delete the main media folder and then when I need to test, I copy-paste the 42 media folder into the main directory. You can also do it the other way around.
honestly im not very experienced in zomboid modding, im primarily a c++ dev, but yeah i figured i would just need to identify things to fix and go from there. thanks for the advice
theyre in here C:\Program Files (x86)\Steam\steamapps\common\ProjectZomboid\media\models_X
thx
For any modders interested in an alerts/updates UI. Fairly easy to use. https://www.youtube.com/watch?v=71Lr4EvoS0A
Brief overview of my Mod Update and Alert System for Project Zomboid but with Subway Surfers.
https://steamcommunity.com/sharedfiles/filedetails/?id=3077900375
is there a way, to export them to .fbx?
they're in some X extension
yeah use this blender addon: https://github.com/Poikilos/io_import_x
Ait', tried to do a clothing mod
can somebody look at it, and say why doesn't the model work?
Tired of waiting for TIS to change the code, what type of hostile animal mod would be worth making players install a java mod?
Obviously nobody's gonna install a java mod for a singular animal, so any suggestions on what I should do?
Oh for fudges sake, 42.4 just dropped. UGH.
Lots of good changes tho. But sucks when it happens right in the middle of testing.

Aww hell nah
Oh that's rough hahaa... the new context menu broke some context menu I was fixing hahaa so now I have to revert back to what @queen oasis sent me a few days ago.
At least that still works nominally.
I got rid of tsarslib in the local version I've been messing around with. It kept breaking menus
Yea that's what I've been trying to fix as well. I think this mod would be best as a standalone.
I did something like, if original grab menu, add the grab trolley menu after that menu and then remove the original grab menu. but really, the Grab Trolley option should be under the grab menu
I'm not sure if I like it under the grab -> trolley menu or not. But whatever I can get to work, I'll take it.
I will spend most of my day working on that and getting rid of the tsarlib stuff. I just wish I knew about implementing modelled items into PZ with animations right now. I'd like to get the SpriteConfig errors cleaned up as well. I guess we'll see what happens, but something with the models is strange in this mod.
just clone an animal anims set and control it using lua
check for collission
trigger animation for animal and player to pretend player is getting hit and do damage via lua
maybe. i dont have any experience about this but thats my best guess. i only know how to do player and zed animations aswell as controlling them via lua
but not animals tho i assume it must be similar
can you show the error
Don't think there's any way to force an animation for animals yet
i really havent checked but im pretty sure there is
how exactly do you set animations for non animal objects,
The SpriteConfig error?
yep
WARN : General f:32540, t:1741104740394> SpriteConfig.initObjectInfo > Invalid SpriteConfig object! scripted object = null
Usually spams in groups of 10 or so.
This happens in vanilla B42 I believe, but it's definitely worse with the trolley's spawning dynamically on the ground.
can you show how you defined the sprite
Invalid Matrix warns are related to the rig, right???
hmm.. i guess. also if you dont have a a bone thats getting called i think (not 100% sure)
strange, I'll check the script
anyways, the only problem I have rn is floating doors
I have a hard time with these, even if the hood turned out to be good
shit sorry vehicle mod
my bad
lol
not character animation so yeah idk
ive only done 1 vehicle mod and i dont remember having that error
so i got no clue sorry
it crashes the game every time I want to access it
No idea how did you achieve that
remove your mod
then try the panel
if it still crash its not cus of your nod
mod*
try to narrow down the possibilities to tryand figure whats going on
like if you think its related to the model.use your script but use another model to test
or something like that
im not sure if i explained this correctly
Did the new patch do anything unexpected to break mods? I don't want to check my steam messages in case it's full of people complaining everything broke.
I'm having enough trouble trying to sleep without putting my brain into bug solving mode by accident
For the most part, no. Maybe if it messed with context menus as a new one was added. Something didn't gel with what I was working on and I had to drop it for the time being.
Yay!
I'll need to look at the changes to vehicle scrapping, but if they just altered the loot then my vehicle scrapping mod will still be fine for now (but based on the older loot)
Wait... @queen oasis @bronze yoke The tsarlib port for B42 done by someone else only has 1 media folder? Only the poster is in 42. Think this might be causing issues? Guess I'll find out quick.
the 42 code is in the common folder
it is my mod, sometimes it does it, sometimes it doesn't
weird . idk how to help ya sorry
there's something really wrong with my vscode. it just inserts whatever it wants whenever it wants. makes bug hunting fun
Ah, dang. There goes that idea hahaa.
i keep getting duplicate playersay. can someone help me?
it keeps making two player:say instead of one
cant figure out why
I kind of rewrote almost all of the mod for my use but you'll get the gist of it for getting rid of tsarslib
local vanillaGrabExists = context:getOptionFromName(getText("ContextMenu_Grab"))
if vanillaGrabExists then
context:addOptionOnTop(getText("ContextMenu_GrabTrolley"), _, Carts.EquipCart, playerObj, cart)
context:removeOptionByName(getText("ContextMenu_Grab"))
else
context:addOptionOnTop(getText("ContextMenu_GrabTrolley"), _, Carts.EquipCart, playerObj, cart)
end
and then do the same idea for ContextMenu_GrabTrolley
and then pretty quick into the onFillWorldObjectContextMenu function, you'll want:
if playerObj:getVariableString("righthandmask") == "holdingtrolleyright" then
context:removeOptionByName(getText("ContextMenu_MetalWelding"))
context:removeOptionByName(getText("ContextMenu_Build"))
end
Thanks friendo π π π I'll get on this soon; I am doing this as I am working my full time job (loads of fun hahaa).
no worries. I run my own business from home so I usually just do whatever I want. And really, I'm just trying to avoid the mod I was working on since it's a context menu hell
Aight, verified the files and the editor menu works now, strange af, modder life ig...
anyone having this issue?
42.4.0 javadocs: https://demiurgequantified.github.io/ProjectZomboidJavaDocs/
42.4.0 api diff: https://github.com/demiurgeQuantified/UmbrellaAddon-Unstable/commit/8d59633e7d888ec768c4fdca9888c54f687eb6f1
umbrella unstable updated to 42.4.0 (update may take some time to be approved and sent out)
This works amazingly. Awesome job, and as always -- thank you so much!!!
i think its because of the new update, i only have my mod enabled
unfortunately this error will happen even if the mod isn't enabled, since the mod.info is always read
name=y3v Tool
description=
id=y3vTool
poster=poster.png
modversion=0.0.1
authors=y3v
tags=Tools
tags goes in workshop.txt
You can just delete it and select Tools as a tag when uploading to the workshop in the workshop menu in game
i don't think that's the issue tho, since mod manager would open anyway
i cant reload lua or open modmanager
it might not like the blank description line
i will try to delete my mod from local files and see if that works
nope its not my mod
some installed mod causes this
how do i check all subscribed b42 mods?
View my subscriptions on the Zomboid library page, if you scroll down on the right you can filter to Build 42 tagged mods
weird the last mod updated was 6 days ago
unsubscribed from all mods but still does not work
vanilla issue maybe?
it's not happening to me
gonna verify game files
Maybe you could try verifying files on steam and deleting all files from your Zomboid users folder except for the saves folder if you haven't
Yeah
will b41 local and workshop mods affect it?
well 42.4.0 must have changed the getWaterAmount() code again... doh!
yeah the tap code is completely different again
this is going to be such a pain in the ass to fix
Is there a way to require the player to be near a certain tile when executing a recipe?
wow, this will be a mess I think...
what shader should I use on my vehicle parts, for body I can only use basiceffect for it to work, and for animated parts if I use vehicle shader the texture gets messed up if it's bigger than 516x516, if I use basic effect it bugs the rig
in 42.3.0 i changed water goes bad to just lie about the water's tainted status, now the transfer is done in java so that won't work
seems like it'll need a lot of manual patching that wasn't necessary in any prior version
this happens if you dont have the mod info or something wrong with modinfo
modinfo needs to be in common folder?
the thing is the mod was perfectly fine yesterday
have you verified files?
did you just recently add it to the modlist
like the mods button
You can only use the vehicle shaders for the body if you want the blood, damage and rust textures to work
cuz maybe thats the cause
load it when creating world instead
it doesn't have to be in common, 42 is probably better
Anybody know if I'd be able to prevent something from spawning beneath stairs?
it was in the mods ever since i installed b42 few days ago
and it is the only mod enabled
and yesterday night before the update it was working fine
idk
cuz this is what i thought so too
i mean when i saw the post that they said you only need 1 on common OR 42
but when i added on 42 the mod didnt show up so i also tried common
and it showed up.. b42 is weird
then yeah it wasnt working after update
so its becz of what i was saying just followed the guide how to convert mod to b42
no what i mean is, at build 42.3.1 it was working
How is the texture messed up? I was only able to get all of the textures (damage, blood, rust etc) working with vehicles by using the multiuv vehicle shader (it requires two uv maps). (The large power of 2 texture sizes are 512, 1024 and 2048. I quickly tested some random sizes between these and they seemed to cause some issues)
and when i updated to b42.4.0 it stopped working
also i tried deleting my mod from the local files but it did not help
then idk
so I am wondering if this is my mods issue at this point
unsub to it too
its not in the workshop rn
only local
i will try reverting to build 41 and back to b42 to see if that helps
maybe deleting the zomboid folder too
Remove the tags=Tools and put literally any word you can think of after the description= part. B42 is finicky as all heck sometimes. Also make sure you have media in BOTH either 42 or common PLUS in the main directory.
When I have had this issue, I didn't have media in the main directory.
Also, try putting another copy of mod.info in common or 42 (whichever is empty). That also has given me grief.
And also try switching your B42 version from within 42 to common, or vice versa. I've had the game break from putting B42 stuff in common and also vice versa (for whatever reason).
so basically add media and modinfo in common but i can keep common media empty, and add a media empty folder in the main folder with the versions?
Basically just throw it at a wall until it sticks lolll. I was messing with tsarlib earlier and it didn't work in 42, but worked on common. Doesn't always seem to make sense for whatever reason.
should i keep the media in common empty?
common is used by 42+ exclusively. it can be empty but the folder needs to be there
oh sry but I meant the shared folder and not the server. so, if I change it in client and access it later in shared, will the variable contain what I wrote to it in client code?
it seems like the UV's are repositioned if I don't use the basiceffect shader and a texture larger than 516x516.
And it is a pain to fix it manually, it is impossible
Idk why it happens only if I use larger textures
all of my mod.infos are in 42
Try scaling the texture to 512, 1024 or 2048. My vehicle just looks gray when trying to use 516x516 texture with vehicle shaders
how do i turn off every mod without going to the game?
found it nvm
okay no mods enabled, no build 42 mods downloaded from workshop
no mods enabled and downloaded but still getting the issue where i cant open mod managing ui
Maybe it depends on the way the game launches for the user? I use the alternate launch via steam with 8GM ram allocation. Could also be where the mod author designs their unpublished mods? I design mine straight in the Workshop folder in C:/Users. There's gotta be something creating this disconnect for people.
some people assume the 42 folder doesn't work for things because they don't know you have to create a common folder no matter what
even if it's empty, it must exist
There must be something the game doesn't like about your mod structure. That's the only other thing I can think of. Are both media folders identical?
anyone with the same problem?π’
i disabled all mods and no mods downloaded
for b42
and i deleted all local mods
maybe i should move the workshop ones?
It could be someone updated a mod with messed up file structure?
Try it.
It's hard to say when I dunno what you've tried and what you haven't tbh lol.
You can also maybe verify your game files in Steam. There might be something else that got removed somehow? Just back up your PZ x64 .bat and .json if you set up custom ram allocations.
already did that
tried changing back to b41 where the mods worked perfectly
and then this issue again in b42
You have no custom mods loaded either?
okay, i unsubscribed from all mods, deleted all local and workshop folder stuff
lets see if this works
it worked lmao
now i gotta figure out what was the issue
okay not the workshop folder
Someone probably borked a mod update and you downloaded it.
How can I update a value that is outside of a loop, from inside a loop?
not the local mods either, so yeah its a mod update
we will never know what mod is that
can you show an example of what specifically you're trying to do? the answer to this question generally is 'you just do it' but i'm sure you've tried that π
but the weird thing is that the last updated b42 mod was like 6 days ago
local SpriteColor
for i=1,items:size() do
local item = items:get(i-1)
if item:hasTag("SaltyGunAssembly") then
local Sprite = item:getWeaponSprite()
SpriteColor = Sprite.gsub(Sprite, "ImprovisedMagRifleNoStock", "")
end
end```
doesn't seem to update SpriteColor
it should, are you sure this branch is being reached?
wdym
is the part of the code that writes to SpriteColor actually being reached? maybe the items don't have the tag or the loop is bad?
you can put a break point or print in there to be sure
a bug?
It should be? I'm not getting any errors, the items are tagged correctly π
anyone know if raccoons spawn in trash cans? dunno if I should archive my Early Raccoons mod or repurpose it
write print(SpriteColor) after if item:hasTag to test
to be sure, what are you trying to do with the gsub here?
delete part of the sprite string
i can't see any reason why this wouldn't update the SpriteColor then
I name the sprites like "ImprovisedMagRifleNoStockOrange"
Sprite would be a sprite, not a string?
so the gsub should return just the color
getWeaponSprite returns a string with the sprite name
(pedantically Sprite.gsub is the weirdest way to call gsub: prefer string.gsub(Sprite, "ImprovisedMagRifleNoStock", "") or Sprite:gsub("ImprovisedMagRifleNoStock", "") )
Oh boy...
This is the one thing I hate about basements... they're mostly not set. So I have no way of replicating this except trying repeatedly in new debug worlds.
Oh well, guess I'll make the dynamic spawns toggle-able via sandbox and call it a day.
grain of salt. I just checked your mod in a basement and it took 3 rolls of lootzed for the first cart, another 7 for the 2nd cart
the chance for a CartContainer is pretty high in CrateTools though
I'm just seeing your cart spawner. it wasn't in the version I got the other day
also, the only good way I've found to identify a basement is check the Z level
Yea I only implemented it this morning with the .4 update today. Going to make it sandbox adjustable to enable/disable on the fly anyway. You only really need it to run when you want to encounter them dynamically on the ground. They still occassionally spawn in storage containers.
function Recipe.OnCreate.AttachStockMagPipeRifle(craftRecipeData, character)
local items = craftRecipeData:getAllConsumedItems()
local result = craftRecipeData:getAllCreatedItems():get(0);
local SpritePrint = result:getWeaponSprite()
local Inventory = character:getInventory()
local SpriteColor
local StockType
print(SpritePrint)
for i=1,items:size() do
local item = items:get(i-1)
if item:hasTag("SaltyGunAssembly") then
local Sprite = item:getWeaponSprite()
SpriteColor = Sprite.gsub(Sprite, "ImprovisedMagRifleNoStock", "")
end
if item:hasTag("GunStock") then
StockType = item:getType()
end
end
print("Sprite: " .. "ImprovisedMagRifle" .. StockType .. SpriteColor)
result:setWeaponSprite("ImprovisedMagRifle" .. StockType .. SpriteColor)
end```
```craftRecipe AttachStockImprovisedRifle
{
time = 100,
category = Assembly,
tags = AnySurfaceCraft,
SkillRequired = Maintenance:2,
timedAction = ChoppingBlock_Hammer,
OnCreate:Recipe.OnCreate.AttachStockMagPipeRifle,
inputs
{
item 1 tags[Hammer] mode:keep flags[Prop1],
item 1 tags[Screwdriver] mode:keep,
item 1 [Base.DuctTape],
item 2 [Base.Screws],
item 1 tags[GunStock],
item 1 [SaltyFirearmsFramework.NoStockImprovisedMagRifle] flags[Prop2;InheritCondition],
}
outputs
{
item 1 SaltyFirearmsFramework.StockImprovisedMagRifle,
}
}```
I'm not getting any errors, and NONE of the prints are printing in console
check your console for any warnings saying it couldn't find Recipe.OnCreate.AttachStockMagPipeRifle
oh that'd do it
you used : instead of = in the oncreate in your recipe script
yeah, i'm shocked it let you get away with that at all
the recipe worked fine too lmao
All this work is JUST to have the gun with a stock have the same color/texture as the stockless one that was used
my game when i miss a comma in a recipe
I assumed it had to be something wrong with the lua because normally incorrect recipes just crash outright
honestly, i wish the console would tell us several errors in recipes at a time
would be really helpful instead of dying at the first error and telling us to fix it and come back
i often implement alot of recipes in batches
the problem is if you have a syntax error the rest of the recipe is unreadable, that's why it has to give up, so it has no idea what might be an error for the rest of it
it does have the ability to predict what the correct thing should be in other things
for example in lua, some errors have "end was expected at line XX"
or smthin
maybe future compilers/languages would be easier and "smart" haha
Project Zomboid B42 has been surprisngly resilient with this for me. I've mucked up a few things and instead of full on crashing, it just fails and goes to the log.
new problem, it does the prints, but doesn't change the weapon sprite. Still no error.
i wouldn't be surprised if you had to set the model index instead
you can work backwards from the weapon sprite by doing item:setModelIndex(item:getWeaponSpritesByIndex():indexOf(weaponSprite))
oh wait I think it's user error (again)
I'm assuming it's trying to set the sprite to a sprite that doesn't exist, so it just doesn't
It's because I have the wood stock name as wooden stock, so it's adding it to the sprite incorrectly
also last night I had a dream involving lua coding
and oddly enough, the code was actually readable words? which is strange because usually words in my dreams are illegible
Does anyone know if "Nearitem: Workbench" works anymore
I've found no use of it in B42 scripts but it's mentioned on the wiki page
This crap will be the death of me. I hate making Sandbox options, but they're so good I can't help it 
...no matter what it will not use the name instead of that mess...
Literally did this first try yesterday with my other mod lmao.
...I am missing a comma... 

It happens to everyone!
Hey guys, am i allowed to post a mod I made in this chat, its a lifestyle music add-on??
I am trying to create a mod that shows current players online, but I have an issue/question I hope y'all might be able to help with!
I have used https://github.com/MrBounty/PZ-Mod---Doc/blob/main/Make an custom UI.md which is an amazing resource, but cannot quite understand how to make a scrollable window. I tried ISScrollingListBox example provided, but couldn't get it working as I intend... <_<;;
I'd like the UI panel to be at a set resolution relative to the native screen resolution and once the list of players gets beyond 10 entries (this part is done), a scroll bar would appear for scrolling down to view the rest (this is the part I can't figure out). __Does anyone know of an example of a scrolling window in this vein/style? __
Thanks in advance!
Because PasturMachine_OnTest_CanPerform() is getting called more than once. Is this code for a workstation? (placed iso object in world used for rcipes) or something else?
well its used in two recipes
would that break it?
i tried making two ontests but it didn't work either
its a normal item
just used for a recipe
if this is used as the onvalid for a timed action, those just get double called
you can see vanilla run into the same bug when you try to read a book you're not high enough level for
I'm not sure exactly when the OnTest gets called, but it may be multiple times not related to the player action; it's not a place meant for player feedback.
Also, you can find out if global power is on with getWorld():isHydroPowerOn()
Quick fix: something like
local lastPlayerMessage=0
local secsBetweenMessages=2
<in function>
local time = math.floor(GameTime.getInstance():getTimeOfDay()*3600) -- seconds since midnight
if (time-lastPlayerMessage >= secsBetweenMessages) or (lastPlayerMessage > time) then
lastPlayerMessage=time
<say the thing>
end
needs to check days to, since getTimeOfDay() is seconds since midnight... or just
if (time-lastPlayerMessage >= secsBetweenMessages) or (lastPlayerMessage > time) then
so it also works when time resets to 0
It gets called when checking items for ingredients im pretty sure
And if itβs in two separate recipes then it would getting called for both of their ingredient checks
Hence the duplicate
How do vanilla workstations like the bandsaw handle power?
As in, what feedback do they give if you try to use one with the power out
where do i put this?
Probably not with the character talking in game, thatβs for sure
it ends with a then
replace the if...then in my earlier comment, it's just adding an extra clause
original comment edited
how do i make the player say on message only
it says <say the thing>
but its already in the test function
I'm giving an example of what to wrap around your code that makes the player say the thing that gets duplicated
local lastPlayerMessage=0
local secsBetweenMessages=2
<in function>
local time = GameTime.getInstance():getTimeOfDay()
if (time-lastPlayerMessage >= secsBetweenMessages) or (lastPlayerMessage > time) then
end
oh
So instead of "always say this" it becomes "only say this if I have not already said this in the last two seconds"
Welp, trolleys fork/port is now mostly completed (thank goodness). Thinking of expanding the sandbox functionality, and learning how to do animations (if the priority fix doesn't work) to get this finished.
Sounds like work for tomorrow tho!!!
ooopps, GameTime.getInstance():getTimeOfDay() is game time not real world time so isn;t teh best way to get a two second lockout... need to find a way to get actual time or sometyhing equivilent.
Can you lock it to a tick count?
lua's os.time() is usually good enough
Ahhh there you go.
ticks are never a great idea since the game doesn't have a fixed tick rate
hows this work
weaponSpritesByIndex is an array list of weapon sprites where the keys are their model indices, so getWeaponSpritesByIndex():indexOf(weaponSprite) returns the model index of that weapon sprite
how would I then set it to a specific model from that index?
42.4 feature: sheet ropes are one way only, and trying to climb up them will crash your game.
so assuming weaponSprite is the string name of the weapon sprite you want (like you already have in your function), you'd just do item:setModelIndex(item:getWeaponSpritesByIndex():indexOf(weaponSprite))
(Also applies to ladders if using the ladders mod)
so
result:setModelIndex(result:getWeaponSpritesByIndex():indexOf(FinalSprite))?
gonna kiss ya
it works
Just a heads up, if you were using getWaterAmount() from objects change it to getFluidAmount() and if you were using setWaterAmount(float, boolean) change your code to useFluid(float) instead... that just saved me post 42.4.0
Is the format of the map_xxxx_yyyy.bin files documented somewhere?
what do i need to do to get the print() messages to appear in b41 debuglog
go to F11 in debug mode, click "debuglog" in top left corner, and tick "General" to save prints to debug log
Noooo! the ladders is bloken~~~~ ;_;
does oncanperform still exist in 42?
is it possible to mod animals?
Is there any way to use instanceItem without module name when item has custom module ?
Or is there any way to get FullType of gun's magazine?
-- let me example the item is MyModule.556Clip_modded
local magTypeMod = _module and _module .. "." .. self.gun:getMagazineType()
local magTypeBase = self.gun:getMagazineType()
print(magTypeMod) -- returns MyModule.556Clip_modded
print(magTypeBase) -- reutnrs 556Clip_modded (This is not a fulltype) << Problem
local magInstance = instanceItem(magTypeBase) or instanceItem(magTypeMod)
print(instanceItem(magTypeBase) -- returns nil
print(instanceItem(magTypeMod) -- returns correctly
Currently I'm using this for temporary and everything is functional without issue, however i don't like it because there's a debug log generating like: Couldn't find item: 556Clip_modded
does getMagazineType not return the module? because I'm using this in one of my lua scripts and I wasn't aware of it not working with modded mags
if item:isContainsClip() then
local Mag = item:getMagazineType()
inv:AddItem(Mag)
end```
If it doesn't parse modded mags then I also need this info so my lua script is compatible with them
I feel like I tested it with a modded mag tho? maybe the mag item was using base module so it had no issues
excuse me, how could i more easy work to a weapon attachment location? anyone kown?
im used debug mode but it occured error. not option for me
im just finished the modeling, but cannot use debug mode it make me sick
maybe i just got a reason.
that's because i did
local bestMagazineType = bestMagazine:getType() -- looks like I should fix this to bestMagazine:getFullType()
print(bestMagazineType) -- returns 556Clip_modded
self.gun:setMagazineType(bestMagazineType)
lol
I didn't get its full type myself :/
My mistake π€£
what's this for exactly?
getMagazineType() doesn't have any fault itself.
seems returing exactly same string from item script.
// from item class java
else if (var1.trim().equalsIgnoreCase("magazineType")) {
this.magazineType = var2;
KnockdownMod = 2,
MagazineType = Base.M14Clip, /* This */
MaxAmmo = 20,
do you mean my mod?
yeah
oh neat
I always wanted to make a mod like this.
There was something I wanted to do with this function when I first joinned PZ modding
βοΈ
so, im try to port my mod for build 41, the item is showing up on the item list but it doesnt show up in the crafting menu. is there something i needed to do first for it to show up in the crafting menu? here is the recipe script.
{
Ladders.SteelLadder,
Result:sd.Collapsible_Ladder,
Time:120.0,
Category:Survivalist,
}
recipe Make Uncollapsed Ladder
{
sd.Collapsible_Ladder,
Result:Ladders.SteelLadder,
Time:120.0,
Category:Survivalist,
}
Do you mean in a savegame? The file names relates to which bits of the map they are (so you can match up to B42map.com and selectively delete areas) but I don't know of anything about the content of hose files.
Someone know if its possible to have different spawn if the character is male/female ?
idk if you can control spawns via lua or not, but I think you can use isFemale to check player gender
you can just teleport them as soon as they spawn after checking for gender
hmm... just wondering why are they all commented..? its rosewood spawnpoints.lua
Seems like yes. We currently have a horse project on the modding Discord
I'm having some issues getting this to properly show, it does the thing where it makes everything invisible when worn. I've done what I can to make it work but I'm still new to clothing stuff. haven't made the retexture yet so it's all still base game stuff but the coveralls being visible is what I'm mainly looking for.
(this is just a mod in the folder, all the other formatting is done correctly before that so it's something related to the attributes of the item itself)
you need to change the order in which the masks list is loaded or whatever it's called
Idk how it entirely works but this is what I used for my mod BeltPants
local group = BodyLocations.getGroup("Human")
local locations = group:getAllLocations()
local BeltPantsLocation = group:getOrCreateLocation("BeltPants") -- Creates Body Location;
locations:remove(BeltPantsLocation)
local pantsLocation = group:getLocation("Pants")
locations:add(locations:indexOf(pantsLocation), BeltPantsLocation)```
something about the locations, idk what would work for you specifically tho
Has anyone dealt with controller support? Someone asked about it for the high beam mod, and it's a good idea but I don't know how easy it will be... Or can people just use controller buttons when prompted for a keybind in options?
The other option is a mod option to just have high beams always on instead of toggling them, which isn't a bad idea given there is no downside. I think I'll add that anyway since non-controller players might like that too.
Is there a better way to do this? This is under function ISReadABook:perform(...) and it throws errors in-game since i think the "old_ISReadABookPerform" is looking for other containers(?)[not sure how this works]
functionally it works, but the errors are annoying and I'd like to not have them if possible
If it errors then no it doesn't work
What's sBvars
Sandbox variable ?
What's the original perform function ?
If it needs to use the self.item then you should run the read function first
Finally added terminal support to the mod manager π₯
https://steamcommunity.com/sharedfiles/filedetails/?id=3422448677
Any questions let me know π
yep correct, by functionally working i meant that the magazine correctly deletes itself after reading and doesnt seem to break anything.
here is the overridden read perform function. I've tried placing the remove self after returning the old read perform but i think it exits the function before reaching that(?)
im not 100% sure, very new to lua
in short it just checks if the magazine read is one that is from my mod, then it will add or remove traits based on it
Not what you're showing me is your overwritten function
Show the original perform read
Bcs it might be you need to use the old read perform first before rrmoving your item. Make sure the item doesn't get used in the original perform
this is where it breaks, the original perform is on the right is that what youre looking for?
im inferring that its breaking because self.item is null when it reaches that line since i deleted it in my script, i've tried changing the order to return the old read perform first but i think that exits out and doesnt continue the delete function after it
Yeah you're deleting the item
But you need to do after when the original perform runned
So what you need to do is run old_ISReadABookPerform(self, ...) before you delete the item
Returning the value shouldn't be needed for performs but it is a really good habit to do so for compatibility
If you want to return absolutely you can store the result in a variable and return it at the end of your function
Fixed it, my texture was 1000x800, made it to 1000x1000 and it works fine
ah i see, how can I perform the old read a book then delete after?
Simply move the last function of the return before you delete the item
old_....
as in moving this line under?
Yes but remove the return
Anybody know which of the VS Code debug/scripts for PZ is causing random periods like this .. to appear in my code???
Read the errors you're getting
theres no errors it just doesnt go there 
That's not a thing ?
Anything in the logs ?
i can add a log and check
but im assuming its because the original readabook is exiting the action before the delete is called
nope
No shouldn't be the case
my trait adding functions are all still working too
That's not a thing
so im super confused
sure sure
But it is and it's happening.
Also add prints before running the old
But it's not the script addon
Do you have copilot or any addon which autocompletes ?
oh yeah you're right, it IS running the delete, the item just isnt deleting anymore 
did self.item get replaced?
I highly advise you go and read what the original perform does
If the item was deleted you would get an error
Could be an issue with updating the inventory
sorry where do i go for the original scripts again?
i know theres a folder for all the original pz functions
i think i've found the issue
self.character is nil..?
getDisplayName() or getUsername()
getName is for the isoobject class and would probably be nil for isoplayer
oh thanks
also if you remove self.item and its being called in the original function, it will probably throw an error since you've deleted self.item
i dont think you need to return the original function, since the original function likely doesn't return anything itself?
yeah this was the original problem, it correctly deleted the item but it gave an error because the original readperform used self.item
so you would just call the original function, then remove the item afterwards
ill try not returning and see if it cooks anything
instead of removing the item and then returning the original, just call the original then remove the item afterwards
yeah nevermind it does find my player..
you would return the original if the original is expected to return a value, for example isValid() checks would return true or false, so if you hook isValid() you'd need to return it for the hook to work
thank you
OK! it's resolved, I just returned without the old perform function and the errors are gone. I'm still curious as to why the delete wasnt running even when it found both item and player though.
but thank you both so much for the help @fleet bridge @bright fog
i'll credit ya in the next update 
i think you still need to perform the action? otherwise you wont read it
i just tested it and it read and deletes fine
i think perform is called after the reading is done if im not wrong
????
ok - i'm not familiar with that perform action , just noting that whatever the original function does will not be done
if you do it the way you suggest
No you need to run the original perform
uh oh
Do you understand what you are doing with your code here ?
right now you're basically deleting the item, instead of doing whatever the perform function does
you need to understand the base function that you're decorating/hooking/wrapping
otherwise whats the point?
heres the full snippet, currently in-game, it correctly reads, and then assigns traits based on if they have it or not
if thats the case you should just blanket overwrite it and just toss it out the window lol
again im super new to lua and pz modding
but it seemed like everything worked
you dont need to return the original function
the original function would not return anything,
Yea tho it's a good practive to so tbf
But yea
old_function(self, ...)
playerInventory:Remove(self.item)
wait so is anything disasterously wrong right now? the "?" scared tf outta me LMAO
its wrong and you're likely doing something unintended.
since you're hooking the original function everything you do will be called upon by any other mod that uses the function
You basically overwrite the vanilla function and completely break the vanilla game function of reading
im only returning nothing if the item has been deleted after, is that still a problem?
if the delete isnt enabled it will return as usual
You're on the good steps, to decorate it, but you need to understand what you're even doing
yea, but only really useful in cases where the vanilla function returns something, otherwise its not necessary. in this case it's just causing issues since he needs to remove the item after calling the original cached function
Because if you don't, your mod will be incompatible with every other mods
Nah you can store the result then return the result, that's not a problem
i hope i know what i'm doing? initially i thought returning to the readabookperform literally meant to return to the original function for it to continue
thats why it was throwing errors when self.item was null
Return means the function will write a result in a variable
yes that is true
i do run compatibility checks with mods before publishing to workshop tho
Overall I agree tho that you don't need to do it
You won't find many mods that modify the reading functions
you just do what doggy says:
local og_function = original_function(self, ...)
--yourcodehere
return og_function```
So it's unlikely you'll find any mods during your testing that break
Doesn't make your mod less fucked up lol
Yeah he did that already
but if the delete is enabled i dont have to return right? since the item would be deleted?
But that's not the problem here
No you're not returning anything anyway
ok hold on let me send the entire lua script
That's what he did here
Check his post here
imagine scrolling up and reading 
Just fuck the return
You don't need it. It doesn't do anything here
It makes things more complicated for you to understand
its good practice, but in your case since you dont quite know what you're doing its causing issues
And you're already confused enough on what you're doing
if i dont return it gives error tho, which was why i wanted to attempt to fix it in the first place
it seems like after adding the empty return it doesnt cause problems anymore since im not running the old perform script
because when you return, it doesn't execute the original function.
yes
yeah for context im more familiar with c# and there return just means to exit the function
you wont know how bad until you get a conflict.
but if i only run return if the item is deleted, is that still an issue?
return exits in lua too, but you're overwriting the original function entirely at that point
Just remove the word return from your code
since you're not calling the original function back
in normal cases it will return the original perform
ill try this
Maaan please read the Lua guide
im worried because im overriding read perform, not returning will cause other magazines to break
NO
omfg
perhaps, but you're relying on specific interaction that may or may not break depending on mod interactions. maybe it works here, in this specific instance, but theres no guarantee that it works for every instance.
to be safe, just dont return
Returning DOES NOT MEAN running the original function
Please go read a Lua tutorial, go read about functions
i did i have the page up reading rn
just use an online lua compiler, and do some tests
return returns a result yes?
returning the original function will allow the original function to execute, regardless of what your decorating function does. this is to maintain the original functionality.
what you're doing is interrupting it if your sandbox is on. while this may work specifically for your mod and your usage/test case, it might not play well down the road. the reason for this is because you're exiting the function when it meets your requirements, and not calling the original function.
since the original function wont return a value anyway as part of its code, you dont need to return anything. just call the original function at the very beginning of your decorating function, then run your code aftewards. no return is necessary. this way the original function is ALWAYS called, and your code is executed immediately after.
specifically, you had a problem because you were removing self.item and making it nil, and when you called the original function by returning it at the end of your function, it was giving you an error
you solved this by simply not calling the original function by virtue of introducing an exit point in your code
this will likely break something else down the road because the original perform function wont get called
if you're adding a lot of weapons, would using a texture atlas be better or worse for performance? since it caches textures
thank you for the clarification, and low-key sorry if im being irritating im trying my best to learn. the example Jvla gave on the lua wiki does return result, is this nescessary? they were saying to remove all returns earlier.
if i decorate it like that, the original read will always run and my code will execute after right?
this will work
its essentially the same as what i suggested, which is to call the original function first
you're simply caching it and returning it
it does the same thing
so the way i did it previously was wrong because if i only do return, it exits out the function entirely without running the original perform right?
Hey guys ive been trying to create a new mod for a new silly weapon, but the game wont load the icon of it, and it makes the weapon handle like a melee, doesnt give me the option to reload or shoot, nothing... i can provide code if needed
does ur icon name in ur textures folder have Item_ before it?
it also has to be in textures, not in textures/worlditems
so for example
Item_M16SurvivalRifle
Yes @umbral raptor
the foam darts work ingame, as icon and texture
the gun doesnt
should i dm?
ye
Why do I get mesh not found errors when the names and paths are right???
its not correct in the scripts?
or syntax error
it is, double checked
it only happens when I want to load in a specific model/part
Hold on, I fixed it somehow, it fixed itself
Another question, does pz support 1000x1000 textures or I really need to use 1024x1024, I have isssues with it again
- some WIP
this is what I mean with texture bugs
What texture bugs? Show original texture
When I tested scaling my vehicles texture from 1024 to 1000, it cause similar, but even worse UV problems (512, 1024 and 2048 work fine)
Seems like ingame texture sits abit higher
Also, I would like to see UV maps, and texture of it in blender view
This is what happens to my truck when scaling the texture...
I mean... did you resize your mask then too?
Maybe thats the issue?
Also why would you use 1000x1000 instead of 1024x1024?
Nope. Just realized that. Mask is 2048 (as the body texture normally) and everything else 256 (for now)
Hmm. Scaling everything to 1000x1000 didn't fix it. Looks exactly the same
I see, my mask is also 1000x1000
same
Wait. Not exactly same. The mask is now displaced the same way as the diffuse texture
Next time ill do 1024x1024, the only way to fix it is manually moving the UVs
You could maybe calculate the required scale and translation and apply it in blender, if you just increase the canvas size in the texture by 24 in each direction
I tried to do it, it was a difference of 0.8 but it still broke the texture, I went from a 1000x800 tex to a 1000x1000, maybe I can do it again to 1024x1024 and maybe it will be fixed
There is a pinned post about texture sizes for models too, I think if you start to go outside of the ^2 scaling you run into issues and potential memory leaks
https://steamcommunity.com/sharedfiles/filedetails/?id=3439101981
Returns a single square, a table of selected squares or a square + a table of selected squares
Invoke with a callback function and as many arguments as your cold little heart desires
selectedSquare = { square = IsoGridSquare, isEdge = boolean }
selectedArea = { squares = {}, minX = int, maxX = int, minY = int, maxY = int, z = int, areaWidth = int, areaHeight = int, numSquares = int }
Usage:
JB_ASSUtils.SelectSingleSquare(worldObjects, playerObj, mySkibidiCallbackFunction, var1, "var2", true, function() print("camelCase or die") end)
context:addOption("Change Highlight Color", worldObjects, JB_ASSUtils.PickColor, playerObj)
There's some other functions buried at the bottom, like an object highlighter that returns the object you click on and a square sorter
Hey that's cool ! If you want you can make a Modding project wiki page about your API to share other modders what it is about
I would suggest writing a Github wiki which explains in detail the tools that modders can use
Do you have an example of what this could be used for too ?
Is it an area selection basically ?
yeah i couldn't really work out what this does from your description
I'm happy I'm not the only one then π
y'all couldn't understand my half asleep ramblings?
basically an area selection. like "dragging" out an area and then returns the selected squares or invokes a callback function. I generally use it in a context menu like:
farmingSubMenu:addOption("Dig Furrows With " .. shovel:getName(), worldObjects, JB_ASSUtils.SelectArea, playerObj, JB_EasyMode.digFurrows, shovel)
so when you call the function, it lets the player select an area and then calls the callback with the area they selected?
correct, if there's a callback otherwise it just returns the selected area
Probably going to called "Logging" now since IsoTrees are such a pain. It needs some better highlight tiles.
same idea as what's in the video
awesome, doing stuff with drag cursors is always a pain in the ass
it was. before I was triggering events for everything but it was just a mess.
at least now it compartmentalized
the way you're supposed to make cursors on top of the building cursor, and manually disable all of the building functionality, is insane
the games 'drag' isn't flexible at all. I tried
now if I can ~~figure out ~~get the motivation to code predicate into one function so I don't need a thousand different functions
I'll get working on that after I catch up on some sleep
in the function JB_ASSUtils.SelectSingleSquare you can pass ... to the callback directly instead of packing it into a table and then just unpacking it again: if you just use unpack it will drop all values after the first nil argument
there's ways to avoid that with unpack but since ... is available in the scope you call the callback from that's the simplest way
That's cool !
We can link the video in the wiki page (it won't be embed but it'll show the thumbnail and link the video)
I got a issue where im trying to make a quiver for this clothing mod im making. I made it a custom body location but i also stripped off just the way to equip it by doing the way you would with a regular backpack in the zomboid game in the .txt file.
function: doClothingItemExtraMenu -- file: ISInventoryPaneContextMenu.lua line # 3682 | Vanilla
function: createMenu -- file: ISInventoryPaneContextMenu.lua line # 752 | Vanilla
function: onRightMouseUp -- file: ISInventoryPane.lua line # 1444 | Vanilla
java.lang.RuntimeException: attempted index: get of non-table: null
at se.krka.kahlua.vm.KahluaThread.tableget(KahluaThread.java:1689)
at se.krka.kahlua.vm.KahluaThread.luaMainloop(KahluaThread.java:641)
at se.krka.kahlua.vm.KahluaThread.call(KahluaThread.java:163)
at se.krka.kahlua.vm.KahluaThread.pcall(KahluaThread.java:1980)
at se.krka.kahlua.vm.KahluaThread.pcallBoolean(KahluaThread.java:1924)
at se.krka.kahlua.integration.LuaCaller.protectedCallBoolean(LuaCaller.java:104)
at zombie.ui.UIElement.onRightMouseUp(UIElement.java:1458)
at zombie.ui.UIElement.onRightMouseUp(UIElement.java:1416)
at zombie.ui.UIManager.update(UIManager.java:910)
at zombie.GameWindow.logic(GameWindow.java:262)
at zombie.core.profiling.AbstractPerformanceProfileProbe.invokeAndMeasure(AbstractPerformanceProfileProbe.java:71)
at zombie.GameWindow.frameStep(GameWindow.java:765)
at zombie.GameWindow.run_ez(GameWindow.java:667)
at zombie.GameWindow.mainThread(GameWindow.java:495)
at java.base/java.lang.Thread.run(Unknown Source)
```
Basically the game brings up this error whenever i right click the item in my inventory. And when I equip it-- it doesnt even show up on the character. I have made the model right and everything-- so I know it isnt a modeling issue.

uuuuuuuuuuuuh
Hmm
Can you share your item script please ?
Resizing to 1024x1024 seems to have fixed it
Thanks
I got some transparent model issues now but I guess it's just flipped normals
B41
Sure, ill share the part that matters at least that is the item itself
{
Type = Container,
DisplayName = Quiver,
ClothingItem = LK_Quiver,
BodyLocation = QuiverLK,
Icon = SPouch,
WeightReduction = 95,
Capacity = 9,
CanBeEquipped = Back,
ClothingItemExtraOption = Wear,
PutInSound = PutItemInBag,
Weight = 0.4,
WorldStaticModel = GolfBag_Ground,
}
Again im not the sharpest tool in the shed when it comes to zomboid coding
You seem to be confused about what some parameters are
I'm not 100% familiar with it but the error you sent made me think that was in fact the problem
But ClothingItemExtraOption needs to be another item which is a different way to wear your item
Wait
Actually I might be wrong
That is true π im still getting around to learning on coding and all that on zomboid
Here's an example script
OHH
So do i just remove that part?
I was looking at how other mods did it, thats probably where I got confused
Do you need to have your item be worn in a different way ?
If not then yes remove it
can someone tell me why the light is working but the heat source is not?
BUT i dont want it to override a backpack slot, and it has its own bodylocation. I made a .lua file where it makes a slot like that. Is there anything else id need to do from there?
sorry im also a bit lost on how bodylocations work with .txt scripts
π
I think you just put your custom bodylocation in the item script
just like here right?: BodyLocation = QuiverLK,
Just make sure that body location is properly defined, but this goes further than what I know about clothing here so I can't give much more detail on it
Add quotes - DisplayName = "Quiver", ?
WorldStaticModel = GolfBag_Ground, You sure that's what you want to use? Just curious about this one.
Is QuiverLK defined anywhere in your mod so the game knows where to pull it from?
YES It is in the clothing items folder (for your last question)
The 2nd question you have uhh its for NOW but changed later on.
Ahhh, okie. I'm not super experienced (with PZ modding) but thought I'd try.
