#mod_development

1 messages Β· Page 309 of 1

vast pier
ember leaf
#

OnlyZeds πŸ˜‰

vast pier
#

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

ember leaf
#

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?

vast pier
#

I mean sure it looks nice, but without any back contact between the barrel and the stock, it's not gonna work properly

ember leaf
#

Ah I get you, like a small u cut into the top of the stock which the pipe would slot into before getting joined?

vast pier
#

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

nova dome
#

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")

bronze yoke
#

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(...)

nova dome
#

Ok thanks. I am truly spoiled with high level languages I guess

vast pier
#

Circumcised

drifting ore
#

Oh, ait

vast pier
# drifting ore 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

drifting ore
#

🫑

brave bone
#

is there anywhere where I can read about how to use hooks?

ancient grail
#

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,
    }
crystal sigil
#

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.

bronze yoke
#

b41's recipe system is just really badly equipped to handle this exact kind of thing

slim swan
#

HELP!I uploaded my mod to the Steam Workshop, but it turns blank. Why is this happening?

silent zealot
crystal sigil
silent zealot
#

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.

#

(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)

crystal sigil
#

ahhh they called moodle's... thanks! will look into it

silent zealot
#

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.

crystal sigil
#

is it btw. still worth to code mods for b41 or is there not that big chance expected to b42?

#

from mod perspective

silent zealot
#

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.

bronze yoke
#

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

silent zealot
#

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

bronze yoke
#

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 πŸ˜”

silent zealot
#

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.

crystal sigil
#

mhmm. i suggest you both modded in 41 and 42. is 42 easier in order of API&Events?

silent zealot
#

42 has some stuff 41 does not

bronze yoke
#

yes but not majorly

silent zealot
#

Not enough to be a big difference.

bronze yoke
#

it's very similar either way but they did expand on some pretty basic requests modders had

silent zealot
#

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.

crystal sigil
#

many thanks to both of you! rarely seen such a good community for a game.

silent zealot
#

The Community is a huge plus for Zomboid

bright fog
crystal sigil
bright fog
silent zealot
#

"huge plus" not "huge community"

bright fog
#

Because I can assure you there's terrible people in both PZ and LoL and great people in both too πŸ’€

crystal sigil
#

thats true Jvla

bright fog
#

Just go in #general_chat and dare to tell me most of the time it's lovely there lol

bronze yoke
#

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

bright fog
#

Yea

#

We chilling

silent zealot
#

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.

silent zealot
#

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"? angry

crystal sigil
#

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

silent zealot
#

hahahaha

storm trench
silent zealot
#

Military Police mod.

#

There should be some at the checkpoints.

brave bone
#

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 .

brave bone
#

ok that did not work, just crashed the game ;_;

ancient grail
#

moonshines:
clear, peach, apple,
deadly clear, deadly peach, deadly apple,

ancient grail
#

if its that then despawn it and spawn the Base.SteelLadder

#

you can also just use inventory contextmenu event

#
OnFillInventoryObjectContextMenu
brave bone
crystal sigil
#

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

bright fog
#

Overall I suggest checking the java doc

#

Eating is a timed action too

#

Check IsoPlayer and inherited methods

crystal sigil
#

Thanks!!

drifting ore
#

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

vast pier
#

here's the rifle compared to the barrel of a pistol that hasn't been scaled down yet

vast pier
drifting ore
#

Then replaced old model files with the new model

vast pier
#

can you show the item in blender?

drifting ore
#

Yeah, gimme a sec

#

Also, scale in the code doesn't seem to change anything

#

here's the model without texture @vast pier

vast pier
#

yeah that's too big

vast pier
#

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

drifting ore
vast pier
#

almost exactly 6 squares

drifting ore
#

so this should be OK, yeah?

vast pier
#

use the grid comparison I did above

drifting ore
grizzled fulcrum
#

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?

drifting ore
#

yeah, it kinda doesn't work at all

#

for me

grizzled fulcrum
#

yeah ik that's because it's zomboid being zomboid

vast pier
#

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

drifting ore
#

don't really know what caused it

vast pier
#

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

tranquil kindle
# drifting ore

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

vast pier
# drifting ore

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

vast pier
drifting ore
#

allright

#

so

#

if I did the resize in blender further than 0.01, is it maybe the reason for crashes?

vast pier
#

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

tranquil kindle
granite ginkgo
#

why is my hood at the origin even if I did apply all transforms?

tranquil kindle
#

Because of animation maybe?

granite ginkgo
#

how so?

#

i mean, seems fine

vast pier
#

Added pink

vast pier
#

What a scene

granite ginkgo
#

Why does using Vehicle shader mess up UVs?

vast pier
vast pier
bright fog
vast pier
#

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

drifting ore
#

Is there a way, to make worlditem model be different to the model of the item in hand?

bright fog
drifting ore
#

which option is it? Weapon Sprite?

bright fog
drifting ore
#

ohh

#

now I see why I was confused

#

I don't have this defined

#

so, I should just type something like worldmodel = ? @bright fog

bright fog
#

Yeah, link to a different model script

drifting ore
#

followed by
model pipegunonfloor
{
mesh =
texture =
} and so on

#

allright, thank you very much

#

is the zomboid code case sensivitive? @bright fog

bright fog
#

Uuh not sure

drifting ore
#

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,

silent zealot
# vast pier

When the safety rules say "full face protection and a protective apron must be worn during testing"

silent zealot
glacial thorn
#

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)

umbral raptor
#

the screen of misery tired

#

cant even use console cuz the game wont load the script

bright fog
umbral raptor
bright fog
#

No I mean, go in the console file

umbral raptor
#

its stuck at >parsing script recipes.txt

#

media/scripts/recipes/supportcorpsrecipes.txt
DEBUG: Script f:0, t:1741043692404> ScriptManager.ParseScript > Parsing...

bright fog
#

Verify comas

silent zealot
#

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.

glacial thorn
umbral raptor
silent zealot
umbral raptor
#

u can just steal the script if u can find it and replicate it

#

make a new godmode essentially

silent zealot
#

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.

glacial thorn
#

To be able to turn on godmode and ghost mode without debug and all of the overlays that come with it essentially

glacial thorn
silent zealot
#

Take a step back: you don't need to turn on god mode/ghost mode, you need to be invulnerable/ignored by zombies.

glacial thorn
#

Yeah

silent zealot
#

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.

glacial thorn
#

Thanks!

#

I will look into those

silent zealot
#

If you see how they do it you can take those functions and use them yourself.

random finch
#

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?

bronze yoke
#

do these seats all have doors?

#

they probably don't have an outside position if they don't have a door

random finch
#

Yes, police car and taxi do, but the seat van doesnt.

silent zealot
#

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.

random finch
#

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

bronze yoke
#

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

random finch
#

hrmm, I'll take a look as well. I dont think I ever looked at the Java.

random finch
#

getPosistionById i maybe missing.

bronze yoke
#

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

random finch
silent zealot
#

getMaxPassengers() ?

random finch
#

Yah, police cars should for sure

silent zealot
#

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.

random finch
#

Hrmm, what would prevent getMaxPassengers from being the same size as getPassengerCount

#

and you beat me to it

bronze yoke
#

i can't imagine any reason they wouldn't be the same

silent zealot
#

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.

random finch
#

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

silent zealot
random finch
#

I am looking at it now πŸ˜›

silent zealot
#

If you're working on B42, make your own local decompiled copy

#

Though a lot of things didnt change between versions.

random finch
#

I am working on MP mods, so havent touched B42 yet

vast pier
#

Is there any way to identify via lua which sprite an item is using from WeaponSpritesByIndex ?

merry patio
#

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,
    }
}
vocal vector
#

you need to use Blender or equivalent software to adjust the model i think

vocal vector
#

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

merry patio
glacial thorn
lilac mural
#

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?

merry patio
merry patio
glacial thorn
silent zealot
#

Note: will need Starlit library installed

#

and similar, getPlayer().role:addCapability(Capability.ToggleNoclipHimself)

#

or no need for starlit:

#

getPlayer():getRole():addCapability(Capability.ToggleInvincibleHimself)

bronze yoke
#

multiplayer isn't even out yet and we're already hacking through their permissions code? πŸ˜…

silent zealot
#

It's not security if it lets you edit yoru own role πŸ˜›

bronze yoke
#

i suppose in multiplayer these changes won't be replicated so you'd be banned anyway

silent zealot
#

Role might be set to readonly...

bronze yoke
#

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

silent zealot
#

Can starlit access private fields?

bronze yoke
#

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)

silent zealot
#

it is a function?

bronze yoke
#

that's because the method shadows the field

#

try local Reflection = require("Starlit/utils/Reflection"); print(Reflection:getField(getPlayer():getRole(), "isReadOnly"))

silent zealot
#

not happy,

bronze yoke
#

wtf

#

my sample code might have been bad

#

that's definitely not an error that should be able to be thrown by that function

silent zealot
#

looks like we can acess the capabilities list, I am not figuring out the sytax to add to that though.

bronze yoke
#

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)

vocal vector
silent zealot
#

hahahahah

#

.getField worked

vocal vector
#

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

bronze yoke
#

getField is a lot slower than the regular method but it works for shadowed fields and non-exposed classes

silent zealot
#

How do I set a field using reflection? It didn't like just adding on "=false"

bronze yoke
#

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

silent zealot
#

hahahaha

bronze yoke
#

but if it's an object you still have a reference to that object

silent zealot
#

fair enough

bronze yoke
#

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

silent zealot
#

ah, but a boolean is not an "object".... can probably edit private HashSet<Capability> capabilities = new HashSet(); directly

merry patio
silent zealot
#

Thanks, even read-only access to protected stuff is helpfull

bronze yoke
#

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

vocal vector
#

probably some trial and error to get it to the right size

merry patio
vocal vector
#

sorry, yes, when you export, not when you save

#

saving creates a blender file which you probably don't need

merry patio
vocal vector
#

no, zomboid recognises FBX just fine

merry patio
#

oh is great! TY!

merry patio
vocal vector
#

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

merry patio
vocal vector
#

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

vast pier
merry patio
#

work now!

vocal vector
#

great, good job

merry patio
random finch
#

bro i want Java docs in dark mode

small topaz
#

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?

bronze yoke
#

on the client it will be, on the server it will not be

small topaz
#

thanks! that's all I need!

fluid creek
#

Is there any good mods that allow you to start your game in the forest for b42? For like a survivalist playthrough

simple helm
#

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.

silent zealot
#

Complete with animated gif preview image.

brave bone
silent zealot
#

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.

small topaz
#

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?
bronze yoke
#

yes, but of course that code only runs for the client, so it is only modified for the client

random finch
#

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?

brave bone
#

is there a better way to test item distribution?

umbral raptor
#

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

small topaz
bronze yoke
silent zealot
random finch
#

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....

bright fog
#

Keybinds and debug mode that's good however

#

But glow level and fix headlights, you should most likely fix it with sandbox options

silent zealot
#

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.

bright fog
#

πŸ‘Œ

silent zealot
#

I bet I can get all that done before B42 multiplayer is out πŸ˜‚

ember leaf
#

Any ideas on how to remove the Reports portion from the context menu when it's a recipe?

silent zealot
#

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)

ember leaf
random finch
#

We are on LUA 5.1 so no bitwise operations, right?

bronze yoke
#

yeah

fallow wadi
#

is there a good resource on mod porting? specifically b41->b42

storm trench
#

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.

fallow wadi
drifting ore
#

Is there a way, to grab a piece of clothing from the game files?

#

like, the model

vague marsh
drifting ore
#

thx

sour island
drifting ore
#

they're in some X extension

vague marsh
drifting ore
#

Ait', tried to do a clothing mod

#

can somebody look at it, and say why doesn't the model work?

tranquil reef
#

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?

storm trench
#

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.

umbral raptor
#

just added firewood to my mod 😦

#

and the update adds it haha

#

so that sucks

drifting ore
granite ginkgo
storm trench
#

At least that still works nominally.

queen oasis
storm trench
queen oasis
#

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

storm trench
#

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.

ancient grail
#

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

tranquil reef
ancient grail
#

i really havent checked but im pretty sure there is
how exactly do you set animations for non animal objects,

storm trench
ancient grail
storm trench
#

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.

ancient grail
#

can you show how you defined the sprite

granite ginkgo
#

Invalid Matrix warns are related to the rig, right???

ancient grail
granite ginkgo
#

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

ancient grail
#

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

tranquil kindle
#

In vehicle editor?

granite ginkgo
tranquil kindle
#

No idea how did you achieve that

ancient grail
#

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

silent zealot
#

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

storm trench
silent zealot
#

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)

storm trench
#

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.

queen oasis
granite ginkgo
ancient grail
#

weird . idk how to help ya sorry

queen oasis
#

there's something really wrong with my vscode. it just inserts whatever it wants whenever it wants. makes bug hunting fun

storm trench
umbral raptor
#

it keeps making two player:say instead of one

#

cant figure out why

queen oasis
# storm trench Ah, dang. There goes that idea hahaa.

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
storm trench
queen oasis
granite ginkgo
#

Aight, verified the files and the editor menu works now, strange af, modder life ig...

glacial thorn
#

anyone having this issue?

bronze yoke
storm trench
bronze yoke
glacial thorn
bronze yoke
#

unfortunately this error will happen even if the mod isn't enabled, since the mod.info is always read

glacial thorn
#

name=y3v Tool
description=
id=y3vTool
poster=poster.png
modversion=0.0.1
authors=y3v
tags=Tools

drifting ore
#

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

glacial thorn
#

i don't think that's the issue tho, since mod manager would open anyway

#

i cant reload lua or open modmanager

bronze yoke
#

it might not like the blank description line

glacial thorn
#

nope its not my mod

#

some installed mod causes this

#

how do i check all subscribed b42 mods?

drifting ore
#

View my subscriptions on the Zomboid library page, if you scroll down on the right you can filter to Build 42 tagged mods

glacial thorn
#

weird the last mod updated was 6 days ago

#

unsubscribed from all mods but still does not work

#

vanilla issue maybe?

bronze yoke
#

it's not happening to me

glacial thorn
#

gonna verify game files

drifting ore
#

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

glacial thorn
#

will b41 local and workshop mods affect it?

outer crypt
#

well 42.4.0 must have changed the getWaterAmount() code again... doh!

bronze yoke
#

yeah the tap code is completely different again

#

this is going to be such a pain in the ass to fix

icy night
#

Is there a way to require the player to be near a certain tile when executing a recipe?

outer crypt
granite ginkgo
#

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

bronze yoke
#

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

glacial thorn
#

maybe something to do with this?

#

nope

ancient grail
# glacial thorn

this happens if you dont have the mod info or something wrong with modinfo

ancient grail
#

maybe you dont have modinfo inside common

#

or you dont have common at all

glacial thorn
ancient grail
#

you should have another

#

look for the pinned post about b42

glacial thorn
#

the thing is the mod was perfectly fine yesterday

ancient grail
#

have you verified files?

glacial thorn
#

ye

#

uninstalled all b42 mods as well

ancient grail
#

did you just recently add it to the modlist

like the mods button

main pasture
ancient grail
#

cuz maybe thats the cause

load it when creating world instead

bronze yoke
#

it doesn't have to be in common, 42 is probably better

storm trench
#

Anybody know if I'd be able to prevent something from spawning beneath stairs?

glacial thorn
#

and it is the only mod enabled

#

and yesterday night before the update it was working fine

ancient grail
ancient grail
glacial thorn
main pasture
glacial thorn
#

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

ancient grail
#

then idk

glacial thorn
#

so I am wondering if this is my mods issue at this point

ancient grail
#

unsub to it too

glacial thorn
#

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

storm trench
# glacial thorn name=y3v Tool description= id=y3vTool poster=poster.png modversion=0.0.1 authors...

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).

glacial thorn
#

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?

storm trench
#

Defining a version minimum might also help. Put versionMin=41.0 for the main directory mod.info, and versionMin=42.0 in the 42 or common mod.info (or both.) May cause issues if in common tho.

storm trench
glacial thorn
#

so weird

#

just checked the mod in b41 and its working

glacial thorn
queen oasis
#

common is used by 42+ exclusively. it can be empty but the folder needs to be there

small topaz
granite ginkgo
#

And it is a pain to fix it manually, it is impossible

#

Idk why it happens only if I use larger textures

main pasture
glacial thorn
#

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

storm trench
# bronze yoke all of my mod.infos are in 42

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.

bronze yoke
#

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

storm trench
glacial thorn
#

anyone with the same problem?😒

glacial thorn
#

for b42

#

and i deleted all local mods

#

maybe i should move the workshop ones?

storm trench
#

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.

glacial thorn
#

tried changing back to b41 where the mods worked perfectly

#

and then this issue again in b42

storm trench
#

You have no custom mods loaded either?

glacial thorn
#

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

storm trench
#

Someone probably borked a mod update and you downloaded it.

vast pier
#

How can I update a value that is outside of a loop, from inside a loop?

glacial thorn
#

not the local mods either, so yeah its a mod update

#

we will never know what mod is that

bronze yoke
glacial thorn
#

but the weird thing is that the last updated b42 mod was like 6 days ago

vast pier
bronze yoke
#

it should, are you sure this branch is being reached?

vast pier
#

wdym

bronze yoke
#

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

glacial thorn
#

a bug?

vast pier
tranquil reef
#

anyone know if raccoons spawn in trash cans? dunno if I should archive my Early Raccoons mod or repurpose it

drifting ore
bronze yoke
#

to be sure, what are you trying to do with the gsub here?

vast pier
bronze yoke
#

i can't see any reason why this wouldn't update the SpriteColor then

vast pier
#

I name the sprites like "ImprovisedMagRifleNoStockOrange"

queen oasis
#

Sprite would be a sprite, not a string?

vast pier
#

so the gsub should return just the color

vast pier
bronze yoke
#

(pedantically Sprite.gsub is the weirdest way to call gsub: prefer string.gsub(Sprite, "ImprovisedMagRifleNoStock", "") or Sprite:gsub("ImprovisedMagRifleNoStock", "") )

storm trench
#

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.

queen oasis
#

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

storm trench
#

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.

vast pier
# vast pier It should be? I'm not getting any errors, the items are tagged correctly πŸ˜”
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

bronze yoke
#

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

vast pier
#

🀦

#

Rare occassion where an incorrectly parsed recipe DOESN'T crash the game lmao

bronze yoke
#

yeah, i'm shocked it let you get away with that at all

vast pier
#

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

vast pier
#

I assumed it had to be something wrong with the lua because normally incorrect recipes just crash outright

umbral raptor
#

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

bronze yoke
#

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

umbral raptor
#

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

storm trench
vast pier
bronze yoke
#

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))

vast pier
#

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

icy night
#

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

storm trench
#

This crap will be the death of me. I hate making Sandbox options, but they're so good I can't help it lol

#

tired ...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... tired

south bear
sinful ether
#

Hey guys, am i allowed to post a mod I made in this chat, its a lifestyle music add-on??

south bear
#

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!

GitHub

Contribute to MrBounty/PZ-Mod---Doc development by creating an account on GitHub.

silent zealot
# umbral raptor cant figure out why

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?

umbral raptor
#

would that break it?

#

i tried making two ontests but it didn't work either

#

its a normal item

#

just used for a recipe

bronze yoke
#

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

silent zealot
#

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.

umbral raptor
#

weird thing is that other items that use this script work fine

#

its just this item

silent zealot
#

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

vast pier
#

And if it’s in two separate recipes then it would getting called for both of their ingredient checks

#

Hence the duplicate

silent zealot
#

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

vast pier
umbral raptor
#

it ends with a then

silent zealot
#

original comment edited

umbral raptor
#

it says <say the thing>

#

but its already in the test function

silent zealot
#

I'm giving an example of what to wrap around your code that makes the player say the thing that gets duplicated

umbral raptor
#

local lastPlayerMessage=0
local secsBetweenMessages=2

<in function>
local time = GameTime.getInstance():getTimeOfDay()
if (time-lastPlayerMessage >= secsBetweenMessages) or (lastPlayerMessage > time) then
end

#

oh

silent zealot
#

So instead of "always say this" it becomes "only say this if I have not already said this in the last two seconds"

storm trench
#

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!!!

silent zealot
#

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.

storm trench
bronze yoke
#

lua's os.time() is usually good enough

storm trench
#

Ahhh there you go.

bronze yoke
#

ticks are never a great idea since the game doesn't have a fixed tick rate

bronze yoke
#

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

vast pier
#

how would I then set it to a specific model from that index?

silent zealot
#

42.4 feature: sheet ropes are one way only, and trying to climb up them will crash your game.

bronze yoke
silent zealot
#

(Also applies to ladders if using the ladders mod)

vast pier
#

so
result:setModelIndex(result:getWeaponSpritesByIndex():indexOf(FinalSprite))?

outer crypt
#

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

spring wind
#

Is the format of the map_xxxx_yyyy.bin files documented somewhere?

vocal vector
#

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

brave bone
#

Noooo! the ladders is bloken~~~~ ;_;

vast pier
#

does oncanperform still exist in 42?

umbral raptor
#

is it possible to mod animals?

tacit pebble
#

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

vast pier
#

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

rare knoll
#

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

tacit pebble
vast pier
#

what's this for exactly?

tacit pebble
#

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?

vast pier
#

yeah

vast pier
#

oh neat

tacit pebble
#

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

#

✌️

brave bone
#

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,
    }
silent zealot
ivory gyro
#

Someone know if its possible to have different spawn if the character is male/female ?

vast pier
ancient grail
tacit pebble
#

hmm... just wondering why are they all commented..? its rosewood spawnpoints.lua

bright fog
vast pier
long beacon
#

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)

vast pier
#

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
vast pier
silent zealot
#

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.

spiral egret
#

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

bright fog
#

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

sharp plinth
spiral egret
# bright fog Sandbox variable ?

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

bright fog
#

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

spiral egret
#

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

bright fog
#

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

granite ginkgo
spiral egret
#

ah i see, how can I perform the old read a book then delete after?

bright fog
#

old_....

spiral egret
#

as in moving this line under?

bright fog
spiral egret
#

im trying this currently

#

but it does not* reach the delete, not too sure why

storm trench
#

Anybody know which of the VS Code debug/scripts for PZ is causing random periods like this .. to appear in my code???

bright fog
spiral egret
#

theres no errors it just doesnt go there sweats

spiral egret
#

i can add a log and check

bright fog
#

No

#

Anything about a timed action canceled ?

spiral egret
#

but im assuming its because the original readabook is exiting the action before the delete is called

spiral egret
spiral egret
#

my trait adding functions are all still working too

bright fog
#

That's not a thing

spiral egret
#

so im super confused

bright fog
#

Hmm

#

Add prints before and after and inside the delete part

spiral egret
#

sure sure

storm trench
bright fog
#

Also add prints before running the old

bright fog
#

Do you have copilot or any addon which autocompletes ?

spiral egret
#

oh yeah you're right, it IS running the delete, the item just isnt deleting anymore KEK

#

did self.item get replaced?

bright fog
#

If the item was deleted you would get an error

#

Could be an issue with updating the inventory

spiral egret
#

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..?

fleet bridge
#

getName is for the isoobject class and would probably be nil for isoplayer

spiral egret
#

oh thanks

fleet bridge
#

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?

spiral egret
fleet bridge
#

so you would just call the original function, then remove the item afterwards

spiral egret
#

ill try not returning and see if it cooks anything

fleet bridge
#

instead of removing the item and then returning the original, just call the original then remove the item afterwards

spiral egret
#

yeah nevermind it does find my player..

fleet bridge
#

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

spiral egret
#

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 yenkoFlower

fleet bridge
spiral egret
#

i just tested it and it read and deletes fine

#

i think perform is called after the reading is done if im not wrong

fleet bridge
#

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

bright fog
#

No you need to run the original perform

spiral egret
#

uh oh

bright fog
#

Do you understand what you are doing with your code here ?

fleet bridge
#

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?

spiral egret
#

heres the full snippet, currently in-game, it correctly reads, and then assigns traits based on if they have it or not

fleet bridge
#

if thats the case you should just blanket overwrite it and just toss it out the window lol

spiral egret
#

again im super new to lua and pz modding

spiral egret
#

but it seemed like everything worked

fleet bridge
#

you dont need to return the original function

#

the original function would not return anything,

bright fog
#

But yea

fleet bridge
#
old_function(self, ...)
playerInventory:Remove(self.item)
spiral egret
#

wait so is anything disasterously wrong right now? the "?" scared tf outta me LMAO

fleet bridge
#

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

bright fog
spiral egret
#

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

bright fog
#

You're on the good steps, to decorate it, but you need to understand what you're even doing

fleet bridge
# bright fog Yea tho it's a good practive to so tbf

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

bright fog
#

Because if you don't, your mod will be incompatible with every other mods

bright fog
spiral egret
#

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

bright fog
spiral egret
#

i do run compatibility checks with mods before publishing to workshop tho

bright fog
bright fog
fleet bridge
#

you just do what doggy says:

local og_function = original_function(self, ...)
--yourcodehere
return og_function```
bright fog
#

So it's unlikely you'll find any mods during your testing that break

#

Doesn't make your mod less fucked up lol

spiral egret
bright fog
#

But that's not the problem here

fleet bridge
#

no he doesnt, he just returns the original function

#

instead of caching the result

bright fog
spiral egret
#

ok hold on let me send the entire lua script

bright fog
bright fog
fleet bridge
#

imagine scrolling up and reading PepeClownMakeup

bright fog
#

Just fuck the return

#

You don't need it. It doesn't do anything here

#

It makes things more complicated for you to understand

fleet bridge
#

its good practice, but in your case since you dont quite know what you're doing its causing issues

bright fog
#

And you're already confused enough on what you're doing

spiral egret
#

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

fleet bridge
#

because when you return, it doesn't execute the original function.

spiral egret
#

yes

fleet bridge
#

therefore, you have no issues.

#

not having the original function work is... bad

spiral egret
#

yeah for context im more familiar with c# and there return just means to exit the function

fleet bridge
#

you wont know how bad until you get a conflict.

spiral egret
#

but if i only run return if the item is deleted, is that still an issue?

fleet bridge
#

return exits in lua too, but you're overwriting the original function entirely at that point

bright fog
#

Just remove the word return from your code

fleet bridge
#

since you're not calling the original function back

spiral egret
#

in normal cases it will return the original perform

spiral egret
bright fog
#

Maaan please read the Lua guide

spiral egret
#

im worried because im overriding read perform, not returning will cause other magazines to break

fleet bridge
bright fog
#

Returning DOES NOT MEAN running the original function

#

Please go read a Lua tutorial, go read about functions

spiral egret
#

i did i have the page up reading rn

fleet bridge
#

just use an online lua compiler, and do some tests

bright fog
spiral egret
#

return returns a result yes?

fleet bridge
#

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

vast pier
#

if you're adding a lot of weapons, would using a texture atlas be better or worse for performance? since it caches textures

spiral egret
#

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?

fleet bridge
#

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

spiral egret
#

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?

hexed timber
#

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

umbral raptor
#

it also has to be in textures, not in textures/worlditems

#

so for example

#

Item_M16SurvivalRifle

hexed timber
#

Yes @umbral raptor

#

the foam darts work ingame, as icon and texture

#

the gun doesnt

umbral raptor
#

send me the code

#

@hexed timber

hexed timber
#

should i dm?

umbral raptor
granite ginkgo
#

Why do I get mesh not found errors when the names and paths are right???

umbral raptor
#

or syntax error

granite ginkgo
#

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

granite ginkgo
#
  • some WIP
granite ginkgo
tranquil kindle
granite ginkgo
main pasture
tranquil kindle
#

Seems like ingame texture sits abit higher

#

Also, I would like to see UV maps, and texture of it in blender view

main pasture
#

This is what happens to my truck when scaling the texture...

tranquil kindle
#

Maybe thats the issue?

#

Also why would you use 1000x1000 instead of 1024x1024?

main pasture
#

Hmm. Scaling everything to 1000x1000 didn't fix it. Looks exactly the same

granite ginkgo
#

I see, my mask is also 1000x1000

main pasture
#

Wait. Not exactly same. The mask is now displaced the same way as the diffuse texture

granite ginkgo
#

Next time ill do 1024x1024, the only way to fix it is manually moving the UVs

main pasture
granite ginkgo
plush wraith
#

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

queen oasis
#

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
bright fog
#

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 ?

bronze yoke
#

yeah i couldn't really work out what this does from your description

bright fog
#

I'm happy I'm not the only one then πŸ˜…

queen oasis
#

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)
bronze yoke
#

so when you call the function, it lets the player select an area and then calls the callback with the area they selected?

queen oasis
#

same idea as what's in the video

bronze yoke
#

awesome, doing stuff with drag cursors is always a pain in the ass

queen oasis
#

it was. before I was triggering events for everything but it was just a mess.

#

at least now it compartmentalized

bronze yoke
#

the way you're supposed to make cursors on top of the building cursor, and manually disable all of the building functionality, is insane

queen oasis
#

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

queen oasis
bronze yoke
#

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

bright fog
#

We can link the video in the wiki page (it won't be embed but it'll show the thumbnail and link the video)

whole yoke
#

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.
bright fog
#

Hmm

#

Can you share your item script please ?

granite ginkgo
#

Thanks

#

I got some transparent model issues now but I guess it's just flipped normals

whole yoke
#

B41

whole yoke
whole yoke
# bright fog uuuuuuuuuuuuh
    {
        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

bright fog
#

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

whole yoke
bright fog
whole yoke
bright fog
#

Here's an example script

whole yoke
#

OHH

#

So do i just remove that part?

#

I was looking at how other mods did it, thats probably where I got confused

bright fog
#

If not then yes remove it

umbral raptor
whole yoke
#

sorry im also a bit lost on how bodylocations work with .txt scripts

#

😞

bright fog
#

I think you just put your custom bodylocation in the item script

whole yoke
#

just like here right?: BodyLocation = QuiverLK,

bright fog
#

In BodyLocation, which seems to be what you did

#

Yea

whole yoke
#

yeayyea

#

lemme see if it works now that i put off that option i had on in the script

bright fog
#

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

storm trench
whole yoke
storm trench
whole yoke
#

ALRIGHHTTT so IT WORKS! but.. it still overrides the slot the backpack uses, AKA i just want to be able to have a backpack on AND the quiver on.

#

im not sure how to go about that though..