#mod_development

1 messages ยท Page 321 of 1

slow marten
#

yeah ive looked at the source code a bunch. ive decided that getting the player's spotted list is the easiest way to get which zombies are visible, but im not sure if that's the best. a lot of the vision system seem to not have any lua api, are all done in a huge single function, or are in private functions.

#

yeah exactly. that's why i was wondering if there was a better way to do it. unfortunately i don't think they'll be adding an api for this anytime soon though.

mellow frigate
#

I wanna share with you a good one among steam workshop comments: this guy doesnt care for his subscribers hes not adding it to b42

silent zealot
#

Oh you monster

#

Have you not dedicated your life to keeping every mod you ever made up to date with every new patch???!?

broken kayak
thin swan
#

Hey sorry I really want to know what this means ๐Ÿ˜…

ancient grail
#

this works

#

but its for weapons

thin swan
#

Oh hmm I mean that actually is very interesting, because it accepts 3d models as sprites right? It's the same as just changing the WeaponSprite param in the item script?
Because if so I could just make another sprite where the wheels are rotated slightly and then just swap between them, as long as there's no lag or jitter etc of course

thin swan
sonic needle
#

that could probably work. with 2 tyre positions, on 2 identical bikes

#

it could be matched to the animation via changesprite bool/trigger?

thin swan
#

I was gonna try to play around with the AnimationPlayer because I saw it's involved in the dancing doors debug thing. So it must have a way to access the doors where the meshes are animated separately and somehow triggers their open/close animations

thin swan
sonic needle
#

either option seems do-able for the most part atm

thin swan
#

I could also use this as a method to spray paint the bike, just call the setWeaponSprite and change it to a different one that uses a different texture

ancient grail
ancient grail
thin swan
#

Yes will do!

ancient grail
#

btw i dont the sprite change is synced so you have to test

#

also you have to reset model next frame for it to render

thin swan
ancient grail
thin swan
small osprey
#

Your conversation made me chuckle. One of my early planned character "missions" is to go have a drink.

ornate basin
#

me when I have a drink at the (rooms)

thin swan
#

Is there a channel/thread for collaboration requests that I've missed? Like somewhere people go look to work on mods together?

small osprey
thin swan
mystic arrow
pearl prism
thin swan
frank elbow
#

(In case it wasn't obvious: spam link, don't click)

pearl prism
thin swan
ornate basin
#

where there's a turn rate, instead of turning instantly

#

then you can have smooth driving + be able to look around too

#

and shoot a handgun maybe

thin swan
# ornate basin why not have the same as car controls

It's just a lot more difficult to work with the vehicle system. I can still make a bigger turn radius by implementing more animations, with my method everything is controlled by the animations. So if I want to add acceleration I just do it in the animation.
I can also make it possible to go in one direction but look in a different one, I'm just gonna have to be smart with how I disable/restrict the movement

ornate basin
#

ah oke

#

and then I steal a car battery, attach it to the bike and I get an e-bike firEyes ?

#

oh nvm car batteries are 12V

#

that's not enough

silent zealot
ornate basin
#

that would be a pretty weak bike tho I think

#

like all the bikes I've seen are 36V or more

silent zealot
#

Voltage is one part of how much power an electrical system has, it's just an easy one to market.

#

How many amps?

ornate basin
#

I know how voltage and amps works

#

it's still relevant

#

like obviously you can't run an e-bike on 5 volts

#

or it would be weak af

#

you can't just have infinite amps

silent zealot
#

Not with motors designed for 36. But you can design motors for 12V.

ornate basin
#

yes but they are weaker motors than 36 volt motors

silent zealot
#

You can get 12V vehicles with 2HP motors; around ~1500watts.

ornate basin
#

I mean I've never seen that stuff

#

so I imagine it must be weaker or have some kind of big drawback

silent zealot
#

There will be a huge list of tradeoffs being made, including cost. But you can't dismiss things as being weaker just because the voltage is lower.

ornate basin
#

either way, most bikes are overwhelmingly above 12V so this doesn't even matter, you wouldn't be able to use a 12V battery for e-bikes becaus you would never find a 12V motorized wheel

silent zealot
#

Especailly when you're talking about a car battery, which is massive (compare dto ebike batteries) and heavy and has a peak current able to get a car engine turning over.

ornate basin
#

would a 5 volts bike be a thing

#

I feel like hell no

silent zealot
#

If you wanted to, yes.

#

But the marketing would fail even if they were better because "lower number!"

ornate basin
#

I mean

#

I studied engineering and was shown some motor tech sheets

#

but I was never explained like how they design them and like if there's drawbacks to voltages and stuff

#

but like

silent zealot
#

You see the same thing in powertools - a race to boast more volts in battery packs while wrting wattage and whattHours in tiny writing somewhere.

ornate basin
#

I feel like if every motor goes for a higher voltage surely it must be significantly better

#

I don't think engineers are stupid enough to ignore a good solution just because it's a smaller number so it's hard to market

silent zealot
#

If that was teh case why are they not using 72V? They just need to recondigre the way teh cells are connected in teh battery packs.

ornate basin
#

I'm not saying more voltage is purely better

silent zealot
ornate basin
#

but surely running less amps through a wire is more efficient

silent zealot
#

Back to what was being discussed - a car battery will easily move a small electric vehicle though if you have 36V motors you'll need to step up the voltage. Or just use three car batteries.

ornate basin
#

like in a resistance

#

P = I^2 * R

#

so like

#

more amps means more power loss

#

surely that's awful with 12 volts

silent zealot
#

And unless you want to add more variety with a mod, have "battery" abd "car battery"

sonic needle
#

fast burn, more torque,

or slow burn, longer range, lower speed

in simple terms

silent zealot
#

where "battery" is everything from an AA to a 9V to lantern battery.

ornate basin
#

just to program the chargers to work on it

#

I mean you could have lithium cells and like assemble it manually DIY

#

but that sounds like hell lmao

silent zealot
#

FAQ

Q: What voltage is a bike batery?

A: Yes.

silent zealot
ornate basin
#

did they have lithium ion batteries in the 90s even

silent zealot
#

Yes, but not cheap and widely available.

#

Lower power density as well

ornate basin
#

yeah

silent zealot
#

And modern electronics uses a lot less power as well.

ornate basin
#

ehh

silent zealot
#

Same with thinsg like LED lights.

ornate basin
#

I don't think that's true

#

not phones at least

silent zealot
#

Less power to do the same thing... which is lost by making our devices do 1000 times more lol

ornate basin
#

I dunno if that's true

#

like

#

software has definitely gotten way way more wasteful of system ressources

#

for the same operations

silent zealot
#

If you built a phone with 1990s capabilities you'd be able to get insane battery life nowdays - but that means voice calls, text SMS and if you're lucky snake.

ornate basin
#

ofc

#

and it would double up as a brick

silent zealot
#

you could make it a lot smaller.

#

mobiles got pretty small, before the iPhone and big screens became a thing.

ornate basin
queen oasis
#

my wife just looked at my screen and saw vscode open and said "you're an addict" as she was walking to the living room to watch the 100th episode of Gossip Girl this week

storm trench
queen oasis
storm trench
queen oasis
#

5 was okish but you could really feel the wheels starting to come off the rails

sonic needle
#

in Kentucky the Men Wear Dresses too

ancient grail
slim swan
tranquil kindle
#

Wait, you didnt parent it to Right prop bone?

thin swan
thin swan
ancient grail
thin swan
ancient grail
#

oooh theres a wall bump xml
might want to play with that too

#

perhaps make it dismount that will be sick !

shell geode
#

mod idea for you modders!!

what if the more zoomed in you are while aiming down you get an accuracy bonus when shooting with the gun #pz_b42_chat message

queen oasis
#

starting to get bloated. here we go again

grizzled fulcrum
#

ASS utils, must be important!

queen oasis
#

very much so, and really I thought more people would find a use for it

ornate basin
icy night
#

I'd like to delay this by 14 seconds: if TotalSoundRadius >= 1000 then traits:add("HardOfHearing") getSoundManager():PlaySound("Tinnitus", false, 0.5); print("Trait added: HardOfHearing") end How can I add such a timer to my script?

#

to clarify, I wanna delay the adding of the trait

#

so that the audio can finish playing first

topaz tangle
queen oasis
topaz tangle
#

does anyone know why the trunk on my vehicle wouldnt be working?
im trying to figure it out but im at a loss at this point

icy night
thin swan
#

Well hot damn, skateboard just hit 10k subs ๐Ÿคฏ

icy night
#

Timer worked perfectly

#

Just my sound isnt playing lol. Havent figured that part out yet

#

ty @queen oasis

thin swan
queen oasis
#

been there, done that, gave me a headache

craggy nacelle
#

Hey i know i asked this a bit before, but i still havnt figured it out. Can anyone tell me how to make a world item with a light effect? I dont want to actually have to spawn an IsoLight for it manually, its just a marker, and i want it to be visible even in the dark. ๐Ÿ˜•

craggy nacelle
#

You mean with the outline? No, no need for that. Just glowing around is ok for me. Heck, it doesnt even have to light up the surroundings, also that would be nice, but as long as the item is perfectly visible even during the night im fine with it.

#

Its meant to be a marker/beacon to be seen, so ofc id like it to be alight so it wont be overlooked in the dark.

thin swan
#

I feel like there's probably a way to do it using tile properties

craggy nacelle
#

Ive read something about a 'light is on texture' but coudnt quite find what thats meant to be.

craggy nacelle
queen oasis
#

world markers maybe? It adds a little highlight circle/arrow/whatever on the square

craggy nacelle
#

An old statue, meant to mark a location.

#

So once you see it you know youre in the right place. ^^

icy night
#

Sound works ๐Ÿ™‚

queen oasis
icy night
#

but I think my tinnitus sound effect is too high pitched

#

Might hurt peoples eardums. I can feel it in my ears when it plays lmao

queen oasis
#

you should hear the tinnitus in my ear

icy night
#

Here's the functions of my mod so far, lmk if yall think I should do more or change something: -- Shooting a gun tracks the weapon's sound radius and adds it to totalSoundRadius -- Aiming level reduces latest radius number by 5% per level -- Wearing Ear Protection negates the latest gunshot radius completely -- When the totalSoundRadius number hits the threshold, hard of hearing is added -- Tinnitus sfx plays the first time you get HOH -- Deaf is added when the number continues to climb after HOH is obtained. It lasts 3 hours -- Not shooting, or shooting with ear protection, reduces totalSoundRadius

craggy nacelle
# queen oasis you should hear the tinnitus in my ear

Thx, interesting idea, but if i go the lua route then i could also spawn an iso light on it. But that would require event listeners and stuff that i coudnt just remove since id need to remove the source too once the item is removed.
Id prefer to use no lua scripts in relation to the marker if possible. Ofc if i cant, ill still go that route, but id avoid that if possible.

craggy nacelle
icy night
#

Alr, I'll do that

#

Lemme check Rain's firearms and other mods with silencers and see how they alter things

icy night
#

compatability with supressor mods will be easy. Wont have to change much

#

Now what do you guys think the threshold for getting hard of hearing should be? The average gun radius is over 100 so maybe 500 shots? (50,000 total radius)

#

or should I add an element of randomness

#

I think maybe I'll make it like a 5% chance every 150 shots or so by default and allow players to change that number in sandbox

craggy nacelle
#

Since everyones hearing is different, randomness isnt wrong. Also i just remember, isnt there a positive hearing perk? In that case i think it should negative impact the one owning it, no? ๐Ÿ˜ˆ

icy night
#

Yeah, it removes keen hearing. Its gonna be a very punishing mod lmao

#

But I did make deaf only last a few hours so not too punishing

#

Hard of Hearing is permanent until I start working on updating the Hearing Aid mod from B41 (they gave me permission)

craggy nacelle
#

Is there a 'bad hearing' perk? Because accumulating noise wont do as much impact as say, staying besides a mortar while it fires without protection.

icy night
#

I mean I could create my own trait.. but hard of hearing and deaf already exist so I dont wanna lol

craggy nacelle
#

ah, hard of hearing was what i meant, so something between deaf and normal

icy night
#

oh, yea

ornate basin
#

I don't feel like negative perks are that interesting because my criteria for picking bad perks is just "is it free to take" and if not then I don't xd

#

I wish there were more positive perks, especially with the "trait purchase shop" mod

#

I love that mod

#

I'm too lazy to learn zomboid modding so instead all I would ever do is dump a bunch of ideas xd

queen oasis
#

I'm having trouble figuring this one out. It works fine for Base.Logs. I'm sure I'm overlooking something.

local twigs = { "Base.LargeBranch", "Base.Sapling", "Base.TreeBranch2", "Base.Twigs", "Base.Splinters" }

for i = 0, wobs:size() - 1 do
    local o = wobs:get(i)
    if instanceof(o, "IsoWorldInventoryObject") then
        local fullType = o:getItem():getFullType()
        print(fullType) -- finds and prints out twig and branch names like a bawse
        if fullType == "Base.Log" then
            clickedFlags.logs = true
        elseif fullType == "Base.Plank" then
            clickedFlags.plank = true
        elseif twigs[fullType] then
            clickedFlags.twig = true -- doesn't find any damn twigs
        end
    end
end
craggy nacelle
#

Might be wrong, but i think ive read somewhere that lua tables start with 1? Again, correct me if im wrong, but get(i -> 0) should trhow an error? Or what problem do you have?

bronze yoke
#

that's not a lua table, they don't have a get()

craggy nacelle
#

Oh? Hm i see. ^^

#

Still a bit confusing or me honestly. ^^

queen oasis
#

it prints the full type fine but it just won't work with the elseif twigs[fullType] then

#
for _, twig in pairs(twigs) do
    if twig == fullType then
        clickedFlags.twig = true
    end
end

that works. maybe I should just check if twigs[fullType] ~= nil

bronze yoke
#

oh i see

#

twigs[fullType] looks for an entry in the table with the key fullType, but the types are values

#

the keys are just 1, 2, 3 etc

#

do```lua
local twigs = {
["Base.LargeBranch"] = true,
...
}

queen oasis
#

omg yea, I'm gonna slap my forehead for awhile

#

thank you

silent zealot
silent zealot
silent zealot
#

Once you have that we can help you work out what code you need to make. (or tell you that it's in the java so not viable ๐Ÿ˜ฆ )

#

The super simple starting point is make a mod that adds a trait that doesn't actually do anything. Then you starting adding little "if player has trait X do something" to the code at the relevant places.

icy night
craggy nacelle
silent zealot
craggy nacelle
#

skills, yeah sorry, since nimble is in the perkfactory and i was using perk... well there is that. XD

silent zealot
#

I'm not sure about skills over 10 - I've never looked at the code. I think there was a mod that let skills go over 10, bit it's also possible someone was talking about it and hadn't actually done any coding work yet.

craggy nacelle
#

Oh, ok i guess ill look if someone has an example mod out there for me then

silent zealot
#

It's possible the java side of thing will say "sorry, skill maxed" but even if it does you could have a mod that tracks extra levels and intercepts calls to check skill level (so if you have shooting level 10 + ShootingExtraLevels 2 when you say "give me the player's shooting skill" your code says "hold up, make that 12 before you return it")

#

...and then you probably break a lot of things that were not written for skills over 10. The other way woudl be wherever the skill being over 10 matters, you add code to use the skill+extra levels.

craggy nacelle
#

Ah, no i was hoping of dirty hacking the movement restriction and pump the level of nimble over 10, since thats would be the only way to make the speedscale for strafe higher then 1.2. ... Is it weird that i know things like that already but struggle with tables? ๐Ÿค”

silent zealot
#

No, I'm, pretty sure everyone struggles with tables in LUA when they start.

#

Because they get used in so any hackish ways.

#

Pro: Flexible. Con: AAAAAAAAARGHH WHAT THE $%^$@# IS HAPPENING HERE!

#

Honestly, creating an array in C when you had to manually code accessing the correct memory offset with no safety rails was easier to get my head around than lua tables.

craggy nacelle
#

Hmmm, one has to love reddit. So someone asks: is there a mod to uncapp skill levels -> and evereyone and their dog comes and tells him how bad an idea that is since grinding to 10 takes forever. XD

#

Its a whole different topic from his question, no?

full nest
#

See, you seem to expect common sense from reddit. That's your first mistake.

icy night
#

Are there any guides on how to make sandbox options?

craggy nacelle
#

not exactly tutorial, but gives you a start

icy night
#

Thats good enough, ty

ancient grail
craggy nacelle
#

PZ modding honestly starts to make me doubt myself on multple fronts. ๐Ÿ˜…

#

Here thats the one i was playing around with, but since i dont quite understand how those files work, no dice on that front too. ^^

silent zealot
#

@craggy nacelle Have you tried getPlayer():setPerkLevelDebug(Perks.Nimble,20) just to see what happens?

muted garnet
#

if I want the animation to be endless, but the beginning of the animation was different from the middle and the end, then I need 2 animations, 1 for the beginning of the animation with the PerformingAction condition, and the second animation for the middle and end of the animation, right? Also, please tell me what conditions there are for animations or where I can see them

broken kayak
#

Is the ISDropItemAction multiplayer compatible ?

topaz tangle
#

Working on the enclosed trailer again, still have no clue why it isnโ€™t letting me access the trunk

silent zealot
#

Are you using standard part names for the trunk, and what acess function are you using?

topaz tangle
gilded crescent
#

Anyone know if there is a certain way Body Locations have to be named? are they case sensitive in anyway? I added one and now I'm getting a world dictionary error with a new world

tranquil kindle
gilded crescent
tranquil kindle
#

I don't think it should cause issues as long as lua one and script one are the same

gilded crescent
#

that's what I thought as well but I've tried everything else I can think of, gonna mess with it some more before I head to bed, I'll try again tomorrow if I don't figure it out

tranquil kindle
#

Can you show your script and lua file?

gilded crescent
#

actually yeah, that isn't the issue some have multiple capitals

gilded crescent
#

how do I do code blocks again?

#

I can never remember

thin swan
# muted garnet if I want the animation to be endless, but the beginning of the animation was di...

For B42 (b41 has some difference in animsets) it depends a bit on the animation, because you could just make one long animation that has a different beginning, middle and end, and then just set that to loop.
If you need each part of the animation to trigger something in another animation or in Lua, like for example when you begin the animation it sets a variable to true which you're listening for in your Lua, and trigger a sound and spawns an object. Then when the animation ends it sets the variable to false which stops the sound and despawns the object. Then it's best to split it into two yes, or maybe even three, beginning, middle, end, if you need more control.

tranquil kindle
gilded crescent
#

thank you

thin swan
# muted garnet if I want the animation to be endless, but the beginning of the animation was di...

I'm not sure there's a list of known conditions, but you can make your conditions by using player:setVariable("YourCondition", "Your Value") , the value can be string, float, enum, or boolean. In your animset .xml you'd be able to get this variable by using <m_Conditions> <m_Name>YourCondition</m_Name> <m_Type>STRING</m_Type> <m_Value>Your Value</m_Value> </m_Conditions>
It can convert from string < > boolean, so if you do "true" it can still be found using m_Type BOOL.
If you need to get this variable in Lua you use the getter for that type, so for this one you'd use player:getVariableString("YourCondition")
You can see all the getters here

There are other variables set by the vanilla code that you can use as well, like <m_Conditions> <m_Name>PerformingAction</m_Name> <m_Type>STRING</m_Type> <m_StringValue>EquipItem</m_StringValue> </m_Conditions>
Or <m_Conditions> <m_Name>isMoving</m_Name> <m_Type>BOOL</m_Type> <m_Value>true</m_Value> </m_Conditions>
If you want to see which condition is triggered when, open anim viewer in debug mode and just leave variables ticked in, you can see which ones change and then use those in your custom animsets.

gilded crescent
#

that didn't work I might have done it wrong

thin swan
gilded crescent
#

oh yeah, it's the tilde key isn't it

thin swan
#

I have EU QWERTY layout and it's shift and then the key next to backspace for me

gilded crescent
#
module Base
{

    imports {
        Base
    }
        
    item EXO_Suit
        {
            Type = Clothing,
            DisplayName = Exoskeleton Suit w/ Vest,
            ClothingItem = EXO_Suit,
            BodyLocation = Exosuit,
            Weight    =    12,
            Icon    =    EXO_Suit,
            BloodLocation = ShirtNoSleeves;Trousers;Neck;Shoes,
            RunSpeedModifier = 0.93,
            CombatSpeedModifier = 0.95,
            Insulation = 0.65,
            WindResistance = 0.30,
            BiteDefense = 130,
            ScratchDefense = 130,
            BulletDefense = 130,
            NeckProtectionModifier = 0.5,
            Tooltip = Tooltip_Exoskeleton,
            ClothingItemExtra = EXO_Suit_ON,
            ClothingItemExtraOption = EXO_Suit_ON,
            clothingExtraSubmenu = EXO_Suit_Back,
            CanHaveHoles = false,
            WorldStaticModel= W_EXO_Suit,
        }


        item EXO_Suit_ON
        {
            Type = Clothing,
            DisplayName = Exoskeleton Suit,
            ClothingItem = EXO_Suit_ON,
            BodyLocation = Exosuit,
            Weight    =    12,
            Icon    =    EXO_Suit,
            BloodLocation = ShirtNoSleeves;Trousers;Neck;Shoes,
            RunSpeedModifier = 0.93,
            CombatSpeedModifier = 0.95,
            Insulation = 0.65,
            WindResistance = 0.30,
            BiteDefense = 150,
            ScratchDefense = 150,
            BulletDefense = 150,
            NeckProtectionModifier = 0.5,
            Tooltip = Tooltip_Exoskeleton,
            ClothingItemExtra = EXO_Suit,
            ClothingItemExtraOption = EXO_Suit,
            clothingExtraSubmenu = EXO_Suit_ON,
            CanHaveHoles = false,
            WorldStaticModel= W_EXO_Suit,
        }
    }
#

theres the item script it's brita's exo suits that I'm trying to make functional

#
local group = BodyLocations.getGroup("Human")
:getOrCreateLocation("Exosuit")
#

there's the BodyLocations.lua

#

Oh

#

I forgot a _ in a recipe for EXO_Suit_ON and instead typed EXO_SuitON

#

that would probably do it huh

#

that was 2 hours of time and such an easy solutoin if that's all it was, odd though considering I could of sworn I changed that before this issue started and it worked fine but maybe I just wasn't paying attention

muted garnet
#

@thin swan Thank you very much for the detailed explanation, please tell me, using conditions, can I start another animation right after this one, or do I need to handle all this through lua and the onTick event with a condition check?

#

I am creating my animation and I want to divide it into 3 stages as you suggested

thin swan
# muted garnet <@156534691283992587> Thank you very much for the detailed explanation, please t...

You can use conditions to trigger transitions! It's honestly a pretty good system once you get used to it.
All you need is something like this:

<m_Transitions>
        <m_Target>nameOfOtherAnim</m_Target>
        <m_AnimName>Bob_NameOfTransition_Anim</m_AnimName>
        <m_blendInTime>0.50</m_blendInTime>
        <m_blendOutTime>0.50</m_blendInTime>
        <m_SpeedScale>1.00</m_blendInTime>
        <m_Conditions>
            <m_Name>YourCondition</m_Name>
            <m_Type>BOOL</m_Type>
            <m_Value>true</m_Value>
        </m_Conditions>
    </m_Transitions>

This means that when your condition changes from false to true, it will transition to another anim, and it will use the animation set in AnimName to use while transitioning (can also be left empty to not use a transition animation).
The blendTimes and speedscale can be skipped if you're not using a transition animation

thin swan
muted garnet
#

thanks, I'll try it now!

muted garnet
#

@thin swan Please tell me what's wrong with this animation file?:

<?xml version="1.0" encoding="utf-8"?>
<animNode>
    <m_Name>StartPhase</m_Name>
    <m_AnimName>StartPhase</m_AnimName>
    <m_Looped>false</m_Looped>
    <m_SpeedScale>1.00</m_SpeedScale>
    <m_BlendTime>0.20</m_BlendTime>
    
    <m_Events>
        <m_EventName>SetVariable</m_EventName>
        <m_Time>End</m_Time>
        <m_ParameterValue>OnFirstPartFinished=true</m_ParameterValue>
    </m_Events>

    <m_Transitions>
        <m_Target>MediumPhase</m_Target>
        <m_AnimName>Bob_MediumPhase</m_AnimName>
        <m_Conditions>
            <m_Name>OnFirstPartFinished</m_Name>
            <m_Type>BOOL</m_Type>
            <m_Value>true</m_Value>
        </m_Conditions>
    </m_Transitions>
</animNode>

<animNode>
    <m_Name>MediumPhase</m_Name>
    <m_AnimName>MediumPhase</m_AnimName>
    <m_Looped>false</m_Looped>
    <m_SpeedScale>1.00</m_SpeedScale>
    <m_BlendTime>0.60</m_BlendTime>
    <m_Conditions>
            <m_Name>OnFirstPartFinished</m_Name>
            <m_Type>BOOL</m_Type>
            <m_Value>true</m_Value>
    </m_Conditions>
</animNode>
thin swan
# muted garnet <@156534691283992587> Please tell me what's wrong with this animation file?: ``...

You should only have one animNode per xml file, the MediumPhase would go in a separate one
If you're on B42 then you have to also place any custom animset in .\YourMod\media\AnimSets, but the files can be blank for these, they just have to have the same name as the xml files in your b42\media\AnimSets folder.
There's a bug causing the game to look for xml files in the b41 folder, but when it finds a file it actually reads them from your b42\media\AnimSets folder if they have the same name.

muted garnet
#

I'm making a mod for B41 so I don't think that's the problem

thin swan
#

I've noticed it also seems to help if you give your variables an inital value on game start, like this:

local initMyAnimVars = function()
    local player = getSpecificPlayer(0)
    player:setVariable("OnFirstPartFinished", false)
end

Events.OnGameStart.Add(initMyAnimVars);```
#

Ah, b41 works a bit different, so I'm not sure everything I've said will work there

muted garnet
#

now the start animation ends and that's it, there is no continuation

thin swan
thin swan
muted garnet
#

thanks!

gilded crescent
#

why am I like this

topaz tangle
broken kayak
#

I'm having trouble with the IsoPlayer:nullifyAiming function, could someone help me figure out how it works ?
Currently I'm trying to get results with the following code but I can still aim freely without any problems.

Events.OnTick.Add(function(tick)
    getPlayer():nullifyAiming();
end)
#

I'm working on B42, I would like to stop the player from aiming when certain criteria are met, is it even possible ?

craggy nacelle
#

@thin swan thanks for explaining those files that well, was exactly what i was looking for. Made a copy of it for a rainy day. ^^

gilded crescent
#

what part of an item script does getType return? it would be base."this" right? or am I completely wrong

silent zealot
#

Should be the type as listed in Type = Container, or Type = Clothing,, or Type = Food, etc

#

Things that change the java type of the item to a different class derived from InventoryItem

#

getFullType() is what you want if you want the "Base.MyItem" thingy

thin swan
ancient grail
muted garnet
# ancient grail you can do something like this if you want it triggered from the xml instead of ...

Transition calls the animation immediately after the current one right? Is this the correct option?:

<?xml version="1.0" encoding="utf-8"?>
<animNode>
    <m_Name>FirstAnim</m_Name>
    <m_AnimName>FirstAnim</m_AnimName>
    <m_Looped>false</m_Looped>
    <m_SpeedScale>1.00</m_SpeedScale>
    <m_BlendTime>0.20</m_BlendTime>
    
    <m_Transitions>
        <m_Target>SecondAnim</m_Target>
        <m_AnimName>Bob_SecondAnim</m_AnimName>
    </m_Transitions>
</animNode>

-- second anim's xml
<?xml version="1.0" encoding="utf-8"?>
<animNode>
    <m_Name>SecondAnim</m_Name>
    <m_AnimName>SecondAnim</m_AnimName>
    <m_Looped>false</m_Looped>
    <m_SpeedScale>1.00</m_SpeedScale>
    <m_BlendTime>0.60</m_BlendTime>
</animNode>
ancient grail
muted garnet
#

what do you mean about using emotes?

ancient grail
#
getPlayer():playEmote(' test')
    <m_Conditions>
        <m_Name>emote</m_Name>
        <m_Type>STRING</m_Type>
        <m_StringValue>test</m_StringValue>
    </m_Conditions>
red tiger
#

Working on adding a generic cheat-detection module for my anti-cheat. Hopefully that'll cast a broad net for common cheats, like enabling debug mode or forcing admin tools.

full nest
#

Can anyone point me where to look at the vanilla files for furniture like crates?

#

I found part of it in media/scripts/movables, but not the recipes

coarse sinew
#

media\scripts\entities\furniture\entity_carpentry_crate_lvl1.txt

full nest
#

yup, gracias

#

I looked at a couple of other b42 mods that built containers, and they are quite a bit different

coarse sinew
#

Depends on which ones you've seen. The recommended method is to use their new scripting method, like the one in that file

full nest
#

that's why I figured it was best to go to the source

icy night
#

Trying to make sandbox option for my mod but it's not creating a new page

#

I have the sandbox-options, I have the Sandbox_EN, and I tied it to my lua script. Am I missing anything?

bronze yoke
#

that's all you need

#

if the option doesn't show up at all the issue is definitely something to do with your sandbox-options.txt

icy night
#

alr

icy night
#

Got that fixed. It was just my formatting of the script

#

plus one of my translations was off

rich reef
#

Hello, I was wondering if it's possible to affect a playerObject from code/admin player client when they are not loaded in the admin's current area? Do I need to use a ping/pong server/client command to run the code from their client? Or can I say, adjust their getStats() from my end anywhere on the map?

#

Completely convulted question without context that I could probably word better..

But for example, can I run a getOnlinePlayers(), and then run through the index of that and to getStats():setPanic() for every online player from my current position, even if they are not loaded onto my screen? Or will that error out?

#

I'm wondering if this will run successfully when triggered from my admin client player using the function, or if I'll have to use a sendServerCommand() to every player to make it work.

oak gyro
#

I want to make a sonic model COS is there any way of reshaping the bones or changing their positions without breaking the entire game?

#

I don't want my sonic COS to be stretched

icy night
#

Making mods is so time consuming lol. Gotta test it every time I change something

#

But I'm nearly done

storm trench
gilded hawk
fallen knot
#

isnt really magic

#

but it does work and it is indeed safe

#

kinda messy to add but you'll manage to do it eventually

#

fought a horde with like 50 or 55 fps

thin swan
#

Anyone know an easy way to move a container to a different square?

I tried container:setSquare(newSq) where container is the IsoWorldInventoryObject but it only seems to move the world object model, and not the actual container (InventoryContainer), so visually it looks like it moved, but to access the inventory of the container I have to go back to where it first was teleported from

full nest
#

If I'm making changes to a lua file for a mod that's actively loaded in a game, do I need to completely restart the game to reflect those changes in game? (i.e. does pz cache mod lua files?)

thin swan
full nest
#

thanks.

silent zealot
#

You can also hit F11 and use the lower right section to reload a single lua file BUT that doesn't clean out the existing "lua soup", it just runs the file again. It can be helpful, but often will have wierd side effects.

silent zealot
#

e.g.: if you attach a function to an event, reloading just hat lua file won't unattach it - the old function is still attached but now you've defined a new MyEventFunction and have no wayto reference teh old one.

silent zealot
red tiger
#

use _G to store the old function and then check if not nil

#

Remove then Add

silent zealot
#

if you designed a file to be reloaded a lot it would be easy, but goingto main menu and hittting reload is easier lol

red tiger
#

I've done both.

#

Unfortunately loading in an entire framework of dynamically-built code requires me to both reboot my server and recycle my client's connection.

full nest
#

For crafting recipes, I see mode:destroy and mode:keep what's the default? my assumption (dangerous I know) would be that destroy is by default and unnecessary, and keep is required if you want to keep something say a tool. but I'm looking at a cooking recipe in a mod and it was duplicating meat (long term preservation) when you tried to cure meat, and someone recommended mode:destroy, and that seems to work. confusing.

silent zealot
#

Safest to pretend if you don't specify keep or destroy the behavior is unspecified.

#

I think it's supposed to relate to the item type, but I also think it does not choose reliably.

torpid snow
#

has anyone created a mod featuring the Standard Infantry Rifle from World War Z?

#

slow firing semiautomatic rifle designed for accuracy and lack of jamming

silent zealot
#

You can easily make a rifle that is semiautomatic, slow firing and doesn't jam.

#

I like Rain's Firearm's lever action .44 Magnum rifle for that sort of role.

noble fossil
#

Is there a place where I can find all the bodylocations for wearable items? Working on a mod that adds extra clothes to the character creator but I can't really find what clothes correspond to which bodylocation.

ancient grail
ancient grail
ancient grail
silent zealot
silent zealot
#

There are ways around that, but if you're typing them up on the lua console it's easier to quit to menu -> reload lua

ancient grail
gilded crescent
#

anyone know how I can make a clothing item increase run speed? preferably through lua

silent zealot
gilded crescent
#

atleast not yet

ancient grail
silent zealot
#

but... that won't get your character over 1.0 speed

#

Which is probably good, because the code has a few "If speedModifier =1.0" type checks to see if you're at sfull speed, and they won't work if your speed modifier is 1.1

gilded crescent
#

worst case I'll just try and make it revert back to as if you didn't have a backpack and clothes lowering your speed

silent zealot
#

I feel they should make you slower but tougher with no endurance loss for jogging/sprinting, but if you want to boost speed.. the speed framework Glytch3r mentioned woudl be good to check out.

gilded crescent
#

it's really cool

silent zealot
#

Fallout power armor works on videogame logic, not real world personal exoskeletion physics ๐Ÿ˜›

gilded crescent
silent zealot
#

Fair enough.

gilded crescent
#

but fallout power armor definitely works a little differently, I also use the power armor mod made by EtherealShigure

silent zealot
#

If the speed framework makes it easy to do so, make it a sandbox setting.

#

That way you make it with the defaults that you think are best, and everyone else adjusts to taste.

#

I also do this because it's easier than figuring out a balanced value.

#

"I dunno, 2 feels good... but set it anything from 0 to 100 I'm not the fun police"

gilded crescent
#

I probably won't be releasing this one public as it'll be a modification to an already released functional exoskeletons mod, but if I ever do choose to and I get permission I'll do that for sure

silent zealot
#

Ethereal is active here, so easy to ask about permissions for public release.

gilded crescent
#

it does everything I want it to except speed you up

#

I'll also be making it make you slowly lose endurance instead of not at all

silent zealot
#

Pretty sure that author will be OK with a patch mod being uploaded given they uploaded this:

gilded crescent
#

probably lol, and I'm not reuploading the entire mod, just the files that I need to change to add compatibility for the brita exoskeletons and file needed for runspeed

silent zealot
#

Actually that exoskeleton mod is a patch mod too. lol

gilded crescent
#

yeah, I just don't know if they asked for permission from the original author or not

silent zealot
#

Yeah, you can mod mods the same way you mod vanilla.

#

Just have your mod loaded after the original

gilded crescent
#

exactly, I'll just be overwriting what I need to

#

actually might not be able to add compatibility with brita's as easily as I thought so that'll be for another day

silent zealot
#

Or to be more concise: Mods modders mod modify modder's mods.

gilded crescent
#

pretty much lol

silent zealot
#

Remember you don't have to replace entire files, or even entire item definitions.

gilded crescent
#

wait is there a way to replace specific functions?

silent zealot
#

DoParam() lets you adjust an items stats one line at a time. And for lua you want your file to have a unique name, and just touch the functions you want to change; prefix/post patches where those are viable, then replace speciic functions entirely

silent zealot
gilded crescent
#

sweet and the path would just be media/lua/client/file right?

silent zealot
#

Then you can wrap code around a function like:

NepOG_someFunction=FunctionToReplace
function FunctionToRepalce(arg1, arg2)
  <do stuff>
  local retvalue = NepOG_someFunction(arg1, arg2)
  <do stuff>
  return retvalue
end
#

(if there is no return value you can skip that)

silent zealot
gilded crescent
#

okay, I'll definitely do it that way, and just import my new function and anything I replace that way instead

gilded crescent
silent zealot
#

So ProjectZomboid\media\lua\client\Camping\CCampfireSystem.lua would be require "Camping\CCampfireSystem" (no .lua in the require)

gilded crescent
#

okay perfect, I'm gonna be using that system a lot more from now on

silent zealot
#

Syntax will be a bit confusing if the function name is part of an object.

#

Tip: SortOfAnObject:SomeFunction(arg1, arg2) is shorthand for SortOfAnObject.SomeFunction(self, arg1, arg2)

gilded crescent
#

I'm gonna be honest I'm so new to lua, I have no idea how to read what you just typed lol

silent zealot
#

And I've have best results be keeping the renamed original in the same object

eg: ```lua
SortOfAnObject.NepOG_SomeFunction=SortOfAnObject.SomeFunction
SortOfAnObject:SomeFunction(arg1)
<prefix stuff>
SortOfAnObject:NepOG_SomeFunction(arg1)
Mpostfix stuff>
end

gilded crescent
#

I can read code when it's written with item names and everything well enough to understand what it does but when it's written with examples it break me lol

silent zealot
#

how about:

ISMicrowaveUI.NepOG_addKnobValues = ISMicrowaveUI.addKnobValues
function ISMicrowaveUI:addKnobValues()
  ISMicrowaveUI.NepOG_addKnobValues()
  self.timerKnob:addValue(306, 120);
end
#

Now your microwaves has a 2 hour option.

gilded crescent
#

that one I can understand mostly, the 120 would be the hours

silent zealot
#

Original function looks like:

gilded crescent
#

okay yeah I get that one now

silent zealot
#

the args are "degrees around the dial" and "minutes" in this case.

gilded crescent
#

yeah the moment actual words are written in like microwave and knob values I can piece it together well enough for trial and error to work

silent zealot
#

youc an also replace an entire function just by rewriting it:

function ISMicrowaveUI:addKnobValues()
    self.tempKnob:addValue(0, 90);
[...]
    self.timerKnob:addValue(270, 45);
    self.timerKnob:addValue(288, 60);
    self.timerKnob:addValue(306, 120);
end
gilded crescent
silent zealot
#

But if you do that and the original function is updated, your mod replaced that update

#

And if two mods do that to the same function they overwrite each other

gilded crescent
#

yeah I'd rather just import it directly instead of replacing entirely

#

seems way more compatible

silent zealot
#

Sometimes there is no practical way to do that, so you just replace a function and accept you may need to update the mod when the game updates... which for zomboid may never happen for anything that isn't part of what they are working on.

gilded crescent
#

Yeah, sometimes it's unavoidable I know that with the other stuff I've worked on

#

it says to "call the code" how would I do that in the new function?

#

would it just be by typing that into it instead of just setplayerspeed(player, speedmodifier)

silent zealot
#

Likely SpeedFramework is a global table, so you can just do
SpeedFramework.SetPlayerSpeed(playerObject, 1.2)

#

or whatever the units are it used for speedModifier

gilded crescent
#

so something like this should work?

#

I might be forgettting to add an else or an if actually but

#

as a base until I fix that

silent zealot
#

where is exoSuit defined?

gilded crescent
#

it should be defined in ExoSTMain

#

I can double check that though

#

unless I need to define it here as well

silent zealot
#

I don't think that check is what you actually want, you want to know if a player is wearin an exosuit

gilded crescent
silent zealot
#

the then at the end of the line doe not correpond to an if

#

And.. I'm not clear what you're doing

gilded crescent
#

yeah I have no idea either, the top half was the original code that's working in the original mod

silent zealot
#

it's going to take the exoSuit variable, get it's dplayanme, see if that has "exo" in it.

#

that looks like it belongs in a loop going through all worn items

gilded crescent
#

unless I grabbed the wrong one, actually, I have two subscribed because one doesn't work

silent zealot
#

Or since you knwo whcih body slot the exosuit isn in just get the item work in that slot, if it's not nil check getFullType()

#

which will be the base.SuperExoSuit or whatever the item is called, not the Display Name.

#

Mainly because then you have no worries about translations.

gilded crescent
#

I don't want to have to type it out for each item which is what the display name string was for

silent zealot
#

do they all have items with "exo" in the name, and will that give false positives?

#

If you're doing this for B42 Tags are the better way to go

gilded crescent
#

they do, they all have Exoskeleton, and I'm on b41

silent zealot
#

I'm not sure if B41 has tags on items, I can't rmember

#

Then item:hasTag("Exoskeleton")

gilded crescent
#

I should probably make it search for Exoskeleton instead of just exo though if I did go this route

gilded crescent
silent zealot
#

Can add it with DoParam()

gilded crescent
#

okay, I've never worked this far into lua so I'll have to look into how to do that

silent zealot
#

If you're lucky the items already have a tag you can use

gilded crescent
#

they do not sadly

silent zealot
#

if the original dev used a tag on the item for their code.

gilded crescent
#

yeah the original dev did it the same way I'm doing it

#

which is why I went this route originally

silent zealot
#

You can do the same, esepcially if there is existing code to copy

#

but what you copied looks like a check that is meant to be in a loop of "(for each piece of equipped clothing (is it an exosuit?))"

gilded crescent
#

thats what I did with this section, it's just copied over

#

it's pulled out of this, I was adjusting the endurance to speed modifier

silent zealot
#

that relies on exoSuit being set somewhere else.

gilded crescent
#

Would I just have to require the file it's specified in then?

silent zealot
#

that is better, you can see wornItems is "get the item equipped in the ExoSkeleton slot"

#

if that in nil, exit.

#

no ise what ExoState is, I guess "powered on"

gilded crescent
#

Yeah it's used for the power on or off function later the that file

#

In that file*

silent zealot
#

and then if there is "Mk3" in the displayname it setFallTime(0)'s the player

#

it's confusing because wornItems will only get a singular object.

gilded crescent
#

Yeah it only needs to get the suit I'm wearing in that moment

#

But it needs all of the different exosuits to be detected depending on which one is worn

silent zealot
#

Use the RunExoFallEffect as your template

gilded crescent
#

I think it has syntax issues because of something on my end, that's the only thing written in thag file right now, the exofalleffect was my template

silent zealot
#

where it checks for "Mk3" in teh name, check for "exo" or "Exo" (whichever is used)

gilded crescent
silent zealot
#

but... you don't even need that... Can you just assume that any clothing equppd in the Exoskeleton custom clothing location is an exoskeleton?

gilded crescent
#

You could but it needs to check that it's powered on, plus a couple fo the exosuits don't have the custom location because their from Britas

#

So by doing the string for the display name it should pick those up as well, atleast I thought

silent zealot
#

Figure out the appropriate checks then - and for brita's getWornItem("Exoskeleton") will return nil if they don;t use that

#

suggestion: make it work for one mod first

gilded crescent
#

They do, it has exoskeleton in it, but you're right I should focus on one at a time

gilded crescent
silent zealot
#

What is this?

#

you've just pasted the broken code next to good code lol

#

copy the good code and change what it does

gilded crescent
#

I didn't even notice that lol, my sleep deprived ass is struggling

silent zealot
#

Also, youre creating EXST_SunSpeedEffect() but... are you actually having that called from somewhere?

gilded crescent
#

wait wrong image

#

there we go

#

fuck I forgot to remove the endurance stuff when I copied it

#

2 am coding

muted garnet
#

Please tell me why the transition between animations doesn't work, after the first animation the second one doesn't start?:

<?xml version="1.0" encoding="utf-8"?>
<animNode>
    <m_Name>firstAnim</m_Name>
    <m_AnimName>Bob_First_Anim</m_AnimName>
    <m_Looped>false</m_Looped>
    <m_SpeedScale>1.00</m_SpeedScale>
    <m_BlendTime>0.15</m_BlendTime>
    <m_Conditions>
        <m_Name>PerformingAction</m_Name>
        <m_Type>STRING</m_Type>
        <m_StringValue>firstAnim</m_StringValue>
    </m_Conditions>
    <m_Transitions>
        <m_Target>secondAnim</m_Target>
        <m_blendInTime>0.3</m_blendInTime>
        <m_blendOutTime>0.3</m_blendOutTime>
        <m_speedScale>1.0</m_speedScale>
    </m_Transitions>
</animNode>

-- second anim
<?xml version="1.0" encoding="utf-8"?>
<animNode>
    <m_Name>secondAnim</m_Name>
    <m_AnimName>Bob_Second_Anim</m_AnimName>
    <m_Looped>true</m_Looped>
    <m_SpeedScale>1.00</m_SpeedScale>
    <m_BlendTime>0.60</m_BlendTime>
    <m_Conditions>
        <m_Name>PerformingAction</m_Name>
        <m_Type>STRING</m_Type>
        <m_StringValue>secondAnim</m_StringValue>
    </m_Conditions>
</animNode>

-- Timed Action:

self:setActionAnim("firstAnim")
silent zealot
#

And have it reset the player speed if they are NOT wearing an exoskeleton

#

And also call it every time the exoskeleton powers up/down

gilded crescent
#

that would make the most sense to do, I just don't know how to go about that, I'll look at the doc but I struggle to read those sometimes

#

oh wait

#

I've done events before

#

this is all I need right?

muted garnet
#

How to add animation to the lower part of the character's body?

brave bone
#

anyone know how do i trigger light rain in solo debug mode? lol.

small osprey
small osprey
small osprey
small osprey
ancient grail
small osprey
small osprey
# silent zealot But if you do that and the original function is updated, your mod replaced that ...

Which is why for patching it is better (in all cases?) to first store the original function, then overwrite with your function, then call the original function from within your fresh overwrite and then do your stuff.

example that I learned from Draw On The Map Mod:

-- first time map opens in the player session
ISWorldMap.createChildren_prepatch = ISWorldMap.createChildren;

ISWorldMap.createChildren = function(self)
    self:createChildren_prepatch();
    . . .
    <do your stuff here>
    . . .
end

In this case it's not just for modding but to keep the vanilla function alive ๐Ÿ˜ฌ but I would think the pattern is transferable?

#

Good Morning by the way. Commenting to older threads feels like setting a bunch of GOTO (yey Lua 5.1 doesn't even know these). Hope its alright for our overall readability here ๐Ÿ˜‰

ancient grail
silent zealot
silent zealot
#
$JAVAC="C:\Program Files\Java\jdk-17\bin\javac"
$DEP="D:\pz\42.7\output\dependencies"
$CLASSPATH="C:\Games\Steam\steamapps\common\ProjectZomboid"
$WORKDIR="C:\Users\dougs\Zomboid\Workshop\Nep High Beams 2\Contents\mods\Nep High Beams 2\42\Java"
$JAVAFILE="VehiclePart.java"
$CLASSFILE="VehiclePart.class"
$DESTFOLDER="C:\Games\Steam\steamapps\common\ProjectZomboid\zombie\vehicles\"

echo +-------------------------------------------+
pushd $WORKDIR
& $JAVAC -cp $DEP -classpath $CLASSPATH $JAVAFILE -Xlint:none
copy .\$CLASSFILE $DESTFOLDER
popd
echo +-------------------------------------------+

That's my super ugly powershell build script, to compile one file and copy it into the game directory.

#

D:\pz\42.7\output\dependencies is from ZomboidDecompler

#

It annoys me that that I couldn't get the powershell syntax for a single variable used as both ${JAVAFILE).java and ${JAVAFILE}.class

#

But it was 1am and this worked.

#

Also worth noting - I'm not treating the .java file as being part of a java project with all the proper checking in the IDE etc, it's just a file on it's own copied from the decompiled source tree.

#

Not every decompiled file will work immediately; VehiclePart.java compiles as-is with some warnings that can be ignored, IsoGenerator only worked after I got rid of an reference to a compare function that wouldn't resolve (who cares if the list of powered objects is sorted incorrectly? Just gimme more geneator range!) and when I tried one of the rendering functions it utterly rejected me because it's missing every OpenGL reference the code makes.

ancient grail
silent zealot
#

This is from a B42 plumbing fix by Lightja, to start a massive storm:

local function lightja_createtropicalstormtest()
    if isClient() then
        getClimateManager():transmitStopWeather();
    else
        getClimateManager():stopWeatherAndThunder()
    end
    local clim = getWorld():getClimateManager();
    if clim then
        clim:triggerCustomWeatherStage(8,48);
    end
end
small osprey
#

Talking about handy, whats your favorite home-made small debug functions to save time?

here's a stupid simple one:

    local square = player:getCurrentSquare()
    local vehicle = addVehicleDebug("Base.SUV", IsoDirections.N, nil, square)

    if not vehicle then
        print("โŒ Failed to spawn vehicle.")
        return
    end

    -- Fill gas tank
    local tank = vehicle:getPartById("GasTank")
    if tank then
        tank:getModData().fuel = 50.0
        tank:setContainerContentAmount(50.0)
        tank:setCondition(100)
        vehicle:transmitPartModData(tank)
    else
        print("โš ๏ธ No GasTank part found on vehicle.")
    end

    -- Add key to player inventory
    local key = vehicle:createVehicleKey()
    if key then
        player:getInventory():AddItem(key)
    else
        print("Failed to create vehicle key.")
    end

    print("SUV spawned with 50 fuel and key given to player.")
    return vehicle
end```

And I am about to write one that lets me long distance "teleport" in singleplayer to a not yet loaded chunk by stutter-stepping 100 squares or so until at destination ๐Ÿซ  

Though I wonder how the working vehicle interiors author did it for teleporting into those "virtual rooms" ๐Ÿค”
muted garnet
ancient grail
silent zealot
thin swan
# muted garnet can you pls describe how to do it?

You can target which bones you want to be affected by your animation by setting a weight for the bones.
So for example to disable all bones you'd do this:

        <boneName>Bip01</boneName>
        <weight>0.00</weight>
    </m_SubStateBoneWeights>```
Bip01 is the parent to the other bones, so setting it to 0 disables all of them.

Then you can go and target the ones you want to animate, so for the legs you'd want to add:
```<m_SubStateBoneWeights>
        <boneName>Bip01_R_Thigh</boneName>
    <weight>1.00</weight></m_SubStateBoneWeights>
    <m_SubStateBoneWeights>
        <boneName>Bip01_L_Thigh</boneName>
    <weight>1.00</weight></m_SubStateBoneWeights>```

So now those bones will be used in the animation but none of the other ones
silent zealot
#

I do car spawing via debug menu, it includes fully repair car" (fills up tank) and "give key"

thin swan
silent zealot
#

It is the opposite of easy,

#

as in "stupidly hard"

thin swan
#

Haha dang, I figured it probably would be

ancient grail
silent zealot
#

Cars are physics opbjects, so to relocate them it's somewhere in the Bullet physics library

ancient grail
thin swan
#

Well then that idea is out the window! I'm trying to figure out how to make attachable containers for the bike, since the weaponpart that goes on it can't be an actual container, and the bike can't be a container either, has to be a weapon

silent zealot
#

You set set orientation easily (which also forces the car speed to zero) with setAngles(). But teleporting... nope.

thin swan
#

I was tinkering with something like this, where the bike spawns a container when it finds an attachment, and then when the player is on the bike, the container is teleported to the same square.

I could then make the container invisible, but still have it show up in the world loot menu.

silent zealot
#

Might be possible with the right transformation, but that isn't complex; it's hypercomplex, because it invoves quaternions

thin swan
silent zealot
#

you can probably ignore the quaternion and just keep rotation, except there is this whole weird allocate system and.... ugh

silent zealot
thin swan
#

My idea in the video would work I think, but it's only moving the visual object, not the actual container, so when you stop and try to access the container it's not actually there

silent zealot
#

What item type is the bike?

thin swan
#

Which is honestly pretty interesting, because it's treated as a melee weapon, but attachments works just fine out of the box.
Which means any melee weapon could have attachments

silent zealot
#

If only mod data could store arbitary object types ๐Ÿ˜ฆ

thin swan
#

I abandoned the idea of serializing the inventory on mount/dismount as well lol

silent zealot
#

yeah, I don't see that working reliably

#

although...

#

and

#

this is an utterly crazy idea...

#

What if the save method was used to get a serialized object, that was base64 encoded to a string, and stored in a string in moddata?

bronze yoke
#

if you're in build 41 you can use starlit's serialisation module to save and load items

silent zealot
#

At this point you're making a library for storing anything in anything

#

No starlit serialization for B42?

bronze yoke
#

i didn't port it to 42 since it's too difficult to update (no way to determine what has changed without doing literally all of the work again) and it's likely to break in future updates and cause issues

silent zealot
#

Also I don't thing Kahlua will let you make a "bytebufffer" from lua if it doens; thave some mapping defined somewhere in teh java side

grizzled fulcrum
#

I wanted to come back to this chat and say whoever got affected by my rant the other day about the the "Living" part of iso character hierarchy, im stupid and i just found out why its named like that. there is in fact a reason

silent zealot
#

Of and fun fact: I learned that Lua has a thing called "userdata"

#

It might look like a number

#

it might print like a number

#

it might compare to other numbers like a number

#

but do anything else and it explodes

grizzled fulcrum
#

isnt userdata only used with C dll to lua interfacing?

bronze yoke
#

userdata is literally user defined data

silent zealot
#

== works but not <=, =>

bronze yoke
#

it's any type that isn't a lua type basically

silent zealot
#

I couldn't get it to convert back to a number

bronze yoke
#

for example all java types in pz are userdata

silent zealot
#

by kahlua magic makes them work.

#

Adding a new static field to a class does not!

#

So VehiclePart.NepVerion is accessible as a public static field but it's always userData

#

a public static int getNepVersion() function works.

bronze yoke
#

was the field an int or Integer?

#

the latter should be userdata but the former should be number

#

iirc you call something like :intValue() to convert

silent zealot
#

I also couldn't make static functions that took arguments, even thouugh adding new non-static functions worked...so I ended up making some thing that shoudl be static non-static so you need a VehiclePart to set a static variable

silent zealot
silent zealot
small osprey
silent zealot
#

You want a trailer

#

I want this

#

I'll settle for this, but I really want the tricycle and bowler hat.

small osprey
# silent zealot

Zomboid mad max but it takes place in The Netherlands. I'd go watch that movie.

silent zealot
#

bike mounted machine guns are not utterly rediculous in a post apocalyptic setting

small osprey
#

and it's a weapon attachment already.

silent zealot
#

most fuel a will be dead after a year, bikes will keep going. Need only basic maintenance tools, can handle small paths

#

and can carry a heavy wepon and also provide a tripod that can be deployed in seconds.

small osprey
#

animal:addAttachment

silent zealot
#

hahahaha

#

Reminder that animals can do everything players can.

small osprey
#

we should make a betting pool on what functions get implemented from vanilla.

grizzled fulcrum
# silent zealot

I wonder if that means animals can get in vehicle as passenger lol

silent zealot
#

Bessie, MAN THE GUNS!

#

Java modding must seem like magic to players ๐Ÿคฃ

main pasture
# thin swan Have you worked much with vehicles? Is it easy to teleport a car from one square...

The helicopter mods work by teleporting the vehicle around. This is from the "warthunder vehicle library": ```
local wTransformFieldNum = nil
local function getJavaFieldNum(object, fieldName)
for i = 0, getNumClassFields(object) - 1 do
local javaField = getClassField(object, i)
if luautils.stringEnds(tostring(javaField), '.' .. fieldName) then
return i
end
end
end

local function moveVehicle(vehicle, x_delta, y_delta, z_delta)
if wTransformFieldNum == nil then
wTransformFieldNum = getJavaFieldNum(vehicle, "jniTransform")
end
if wTransformFieldNum then
local tmpTransform = getClassFieldVal(vehicle, getClassField(vehicle, wTransformFieldNum))
local wTranform = vehicle:getWorldTransform(tmpTransform)
local origin = getClassFieldVal(wTranform, getClassField(wTranform, 1))
origin:set(origin:x() + x_delta, origin:y() + y_delta, origin:z() + z_delta)
vehicle:setWorldTransform(wTranform)
end
end```

#

Just set the origin to whatever and it should work

silent zealot
#

Thanks! Ctrl-C/Ctrl-V's it for his notebook

#

wat the frick is it doing

#

It does some stuff that presumably finds this part of BaseVehicle:

grizzled fulcrum
#

what are you looking at/for

silent zealot
#

Madness.

#

I'm looking at madness.

#

This is the code that slumbers in the void between languages.

#

I wonder if the bullet physics library is documented in a way that would help make sense of this

#

Namely what is getting done with transform objects.

grizzled fulcrum
#

I thought bullet was their own implementation written in C

#

well the lighting code is at least

silent zealot
#

There are bullet java clases, though they may just link to C libraries

#

The lighting engine is their own as far as I can tell, I was trying to figure out if teh built in night vision could be made useful

grizzled fulcrum
#

I found what you mean, I think. they might use it, idk.

silent zealot
#

When you activate it you get the perfect effect for a split second, then it does something and everything just washed out

grizzled fulcrum
silent zealot
#

(not confirmed that is what they are using)

grizzled fulcrum
#

yep I stumbled upon that too

silent zealot
#

getPlayer():setWearingNightVisionGoggles(true)

#

I even tried commenting out bits of code in java to see if I could figure out what it was doing to ruin it, because it worked in B41 (Eris bnightvision/Chucked night vision used it) and it was vastly superior to "green filter and a fake torch"

#

But I can't recompile the rendering files unless I work out how to reference OpenGL stuff (I think that's the issue)

silent zealot
#

(with a bayonet, which an exceprt I read talks up like it's a genius innovation and not a variation on "spear" which has been around since humans figured out how to tie rocks to sticks)

muted garnet
#

@thin swan @ancient grail thanks guys!

ancient grail
muted garnet
#

I will test it a bit later but thank you for your time

thin swan
small osprey
#

Anybody knows what square:isFree(false) the boolean parameter does? It's required

I gotta decompile Java instead of annoying you guys soon probably ..

edit: solved if chatGPT checking JavaDocs from god knows where is correct: "The ignoreActors flag controls whether to consider moving/standing players, zombies, etc."

small osprey
#

Yeah that confirms it. thank you. Anything moves in there, and we don't want to run it over, return false. Great for full-self-driving mod ๐Ÿ˜„

thin swan
main pasture
small osprey
#

So, not for debug-spawning but regular mod purpose I want to identify the best suited 3x3 squares to safely and dynamically spawn cars (in a limited radius in the loaded chunk, of course).

I am thinking to adopt a "scoring model" as this can never be black-and-white I think.
And yeah I am aware of runtime performance implications, I can handle "throttled async search" ๐Ÿ˜…

So I am thinking:

  • preferably on parking spot or alternatively a road
  • it should be free (sq:isFree(false))
  • hard-exclude indoor tiles e.g. via sq:isInARoom
  • Considering hasNaturalFloor as another negative to avoid
  • avoid sq:hasSlopedSurface
  • avoid sq:isWaterSquare
  • avoid sq:HasTree

Q1 to you folks: What do you think about the approach and criteria? Have you seen similar function in the wild somewhere?
Q2: what do you think about sq:isSolidFloor, sq:getOpenAir, sq:hasRainBlockingTile, sq:hasFloor, sq:isNotBlocked or other square functions?

I might additionally iterate over objects in a tile anyway (isFree reports true for non blocking objects it seems) and try to avoid very loaded squares via scoring maulus.

thin swan
mellow frigate
hexed stirrup
#

Does the modding in this game require coding knowledge

small osprey
small osprey
mellow frigate
hexed stirrup
#

I got you

#

You need technical know how

#

Which i like to think i have, as ive worked on other games before like red alert 2

small osprey
# hexed stirrup You need technical know how

All technical know how is built by banging your brain against something and enduring the pain until enough learning sets in. So yes that is true for this modding here regardless of coding or not :D. You want something hard enough you'll get there!

small osprey
hexed stirrup
#

Where models are stored, sounds, textures what format theyre in, what program opens them etc etc

mellow frigate
small osprey
# hexed stirrup Is there some kinda documentation that explains fhe file structure and organizat...

I have not come across an end-2-end complete modding guide, especially as the upcoming build42 has changed many things, the documentation out there has to be consumed carefuly check that it says "for b42" or something.

https://pzwiki.net/wiki/File_structure lists things. The rest is distributed on that wiki but more based on topic and you have to get lucky.

If you want to code stuff ask for more.
I would advise you install a simple mod that changes things similar to what you want to change and then look at its file structure.

The steam worshop mods will show up on your disk in a place like steam/steamapps/workshop/content/108600/

small osprey
coarse sinew
#

I have an unreleased mod on this

hexed stirrup
small osprey
small osprey
# coarse sinew You can spawn them in vehicle zones defined by the world. Then you can always ma...

Sounds very interesting. It is a comprehensive framework if I read the description correctly. I would not want to take a sledgehammer to a knife fight so .. the question would be if there are (any or enough) pre-defined vehicle spawn areas coming along-side this or are getting "identified on the fly or in the background" so that I can rely on a "good enough" vehicle location to be available within, say, 40 squares. (yes we can exclude deep forrests etc haha)

icy night
#

Trying to add Moodles to my mod. They trigger successfully but I thought that resetting the value to 0.0 afterwards would make them disappear and it doesnt. They're good when theyre supposed to be bad and they're bad when they're supposed to be gone lol

mellow frigate
winter bolt
oak gyro
#

what if I use the apply all transforms option?

#

wouldn't that fix the bone stuff?

icy night
#

I thought setting the value to 0.0 made the moodle disappear but idk if thats so

icy night
#

tyvm

thin swan
#

If you were using my bicycle, would you accept a somewhat messy workaround like this to be able to attach saddlebags to it and put stuff in it?

It basically first checks to see if a saddlebag is attached (which is not an actual container), and if it is, it will spawn an invisible container (currently the ammo box in the video) that gets transferred from/to user inventory when getting on/off.
The container can not be transferred/equipped, so it's basically stuck in the same square as the bike.

I can easily make it so if the bike is picked up into inventory or put in a car trunk then the container gets transferred along with it.

small osprey
thin swan
compact portal
#

What's the closest anyones come to bringing horses into the game?

thin swan
compact portal
#

nice

#

Trying to work on a wild west 1800's map

#

Imma see if I can contact them later IF they're not busy

small osprey
#

stupid work-flow question: how to exit current game while in lua error screen without unticking "break on error" first? Background: I want to simply refresh lua and then try again but the game remembers the "break on error" untick, which is not what I want/

storm trench
#

Has anyone made a good mod for realistic alcohol & hangovers?

small osprey
#

finally someone asking the right questions!

mellow frigate
craggy nacelle
thin swan
# craggy nacelle Since its cloth, maybe you could look into the patches for an attachment? Just a...

That's not a bad idea, but we had to move away from using the bike as clothing, it's now just a full on weapon.

But I think I'm on to something with this method!
Now it doesn't render the invisible container as a world object, nor as an inventory item, but it still exists, items can be transferred from/to it and the container itself is transferred from/to player when getting on/off bike but doesn't show in inventory, and doesn't weigh you down. And I can get the content weight to use as a speed/endurance modifier

craggy nacelle
small osprey
small osprey
#

3x3 "good car spawns near player" - More blue intensity means higher score, red squares are hard no for their respective 9-grid. You can occassional make out the 3-length strip-scanning via Tchernolib MovePlayer.isBlockedTo @mellow frigate .
FYI @coarse sinew

edit: should probably check for other cars already placed . . .

storm trench
red tiger
#

Even more cheaters are about to be salty with my updated anti-cheat. drunk

thin swan
storm trench
thin swan
#

I'm gonna make all the parts craftable as well, so with enough mechanics, metalworking and welding, you can build a bike from scratch, and then add more and more upgrades

plush wraith
mellow frigate
storm trench
# plush wraith Thought about building my nicotine system into a substance framework to simulate...

Honestly not a terrible idea, and unfortunately: same. Besides I'm not even done with the ZuperCarts fork yet anyway. But I've had a chance to play today and alcohol kinda... ruins my immersion. I wanted to do a nun character who became an alcoholic during the apocalypse but you stay drunk for like 2 hours in game (lolll) and no hangovers. Maybe I'll add it to my list of future ideas if I don't see it done.

sonic needle
#

Princess ZeldAva

ancient grail
icy night
#

Y'all play PZ only to play Zelda lmao

ancient grail
thin swan
ancient grail
#

oh ok then i thought you wre still figuring out what to do

my bad

thin swan
muted garnet
#

@thin swan that is, in order for all bones to be animated, I need to write each bone according to this example?:

<m_SubStateBoneWeights>
        <boneName>Bip01_R_Thigh</boneName>
        <weight>1.00</weight>
</m_SubStateBoneWeights>
thin swan
muted garnet
#

@ancient grail your method unfortunately didn't work or i did something wrong

ancient grail
icy night
#

Just checked the chat and I see discussions about child bones ๐Ÿ˜”

muted garnet
#

yep, thats works, thanks!

#

โ˜บ๏ธ

ancient grail
muted garnet
thin swan
ancient grail
#

ok

so for example
i have an animation that makes the character do jumping jacks

without the deffered y then the character will remain in its y axis and will not move

it wont go up

thin swan
ancient grail
#

i guess we have different answers lol we could both be correct tho

muted garnet
#

that is, when animating the lower part of the body, it is better to add xml <m_deferredBoneAxis>Y</m_deferredBoneAxis>, did I understand correctly?

thin swan
#

I have noticed it can make the character have the wrong rotation if set to the wrong axis, but it could also have been that I did two things wrong lol

thin swan
ancient grail
#

@muted garnet i suggest looking at an animation that makes the player falldown or maybe the sitdown animation
(always refer to the default file, cuz some animation has parents)

#

parents btw are defined by using the extend

thin swan
ancient grail
#

some functions can be used yo recycle already existing animations

such as the reverse
this makes it so that you dont have to make the x/fbx twice

#

what i want to understand is how the flashlight thing works
if we can replicate that then we can combine animations
maybe we wont need to make all them strafe animset files
cuz thats tedious

muted garnet
#

@thin swan @ancient grail thank you very much, please tell me what I did wrong in transitions? The first animation ends and the second does not start, although both animations work separately, the transition does not work either with vanilla animations. After the first animation, the character simply immediately returns to the original pose without animations:

<?xml version="1.0" encoding="utf-8"?>
<animNode>
    <m_Name>CustomAnim</m_Name>
    <m_AnimName>Bob_CustomAnim</m_AnimName>
    <m_deferredBoneAxis>Y</m_deferredBoneAxis>
    <m_Looped>false</m_Looped>
    <m_SpeedScale>0.10</m_SpeedScale>
    <m_BlendTime>2</m_BlendTime>
    <m_SubStateBoneWeights>
        <boneName>Bip01</boneName>
        <weight>1.00</weight>
    </m_SubStateBoneWeights>
    <m_Conditions>
        <m_Name>PerformingAction</m_Name>
        <m_Type>STRING</m_Type>
        <m_StringValue>CustomAnim</m_StringValue>
    </m_Conditions>
    <m_Transitions>
      <m_Target>DrinkBottle</m_Target>
      <m_blendInTime>0.3</m_blendInTime>
      <m_blendOutTime>0.3</m_blendOutTime>
      <m_speedScale>1.00</m_speedScale>
    </m_Transitions>
</animNode>
thin swan
# muted garnet <@156534691283992587> <@591976049592631298> thank you very much, please tell me ...

I'm still not 100% how it all works, but from having messed around with it, it seems that there's more to transitions than just setting a target because from my experience it seems that the animset you're targeting has to actually be triggered in order for transition to work.

So if by the end of your animation there's nothing that makes your character drink from a bottle, then it won't actually play the DrinkBottle animset, so you trying to target that animset won't do anything.

What you'd want is to either check which animset is triggered after your CustomAnim, and then you use that as your target, and in your transition you specify an animation you want to play when going from CustomAnim to whatever other anim (likely going to be idle)

#

So if it's currently going from CustomAnim to Idle, you'd want to do this:

<animNode>
    <m_Name>CustomAnim</m_Name>
    <m_AnimName>Bob_CustomAnim</m_AnimName>
    <m_deferredBoneAxis>Y</m_deferredBoneAxis>
    <m_Looped>false</m_Looped>
    <m_SpeedScale>0.10</m_SpeedScale>
    <m_BlendTime>2</m_BlendTime>
    <m_SubStateBoneWeights>
        <boneName>Bip01</boneName>
        <weight>1.00</weight>
    </m_SubStateBoneWeights>
    <m_Conditions>
        <m_Name>PerformingAction</m_Name>
        <m_Type>STRING</m_Type>
        <m_StringValue>CustomAnim</m_StringValue>
    </m_Conditions>
    <m_Transitions>
      <m_Target>Idle</m_Target> <--- Change this
      <m_AnimName>Bob_CustomAnimTransition</m_AnimName> <--- Add this
      <m_blendInTime>0.3</m_blendInTime>
      <m_blendOutTime>0.3</m_blendOutTime>
      <m_speedScale>1.00</m_speedScale>
    </m_Transitions>
</animNode>
#

Or you could have another custom animset which has a condition that is triggered when your first anim stops, because then it will work when you target it.

muted garnet
#

Now it's clearer to me, thank you very much!

thin swan
# muted garnet Now it's clearer to me, thank you very much!

The blend times and speedscale of anims and transitions also plays a big role, so try tweaking those a bit as well if you're not getting the expected results.
Having speedscale at 1.0 and blendTime/in/out at 0.5, and then tweak with like 0.1/0.2 increments until it looks right.
I think the blend times that are set at the top of the animset takes priority over the ones in a transition, but there also seems to be exceptions to this or I just misunderstand something

muted garnet
#

๐Ÿ‘

storm trench
thin swan
thin swan
storm trench
thin swan
storm trench
thin swan
brave bone
gilded crescent
#

Hey, I need to add a event trigger to something, I was having issues with OnClothingUpdated where sometimes it just stopped working, I don't want it to be performance heavy like OnEveryMinute would be since this is on a heavily modded server but I need it to trigger soon enough so that it changes roughly when you take the clothing off so EveryTenMinutes won't be fast enough

#

the codes working fine with EveryTenMinutes so I'm unsure why OnClothingUpdated made it just stop for no reason

bright fog
#

OnClothingUpdated could just not be triggered in some rare cases possibly, could be a mistake by devs or other reasons

#

It's not something like OnTick or what

gilded crescent
bright fog
#

Events need to be manually triggered by code (by the game) so if they forgot to trigger it somewhere, could cause issues possibly

gilded crescent
#

yeah it worked everyonce in a while but then sometimes it either wasn't triggering or just stopped working after it triggered

gilded crescent
# bronze yoke what are you actually doing?

Making the Exoskeletons from stalker and Brita's make you run faster, I got the code working using Speed Framework with Shoes Speed as a base, however now I need to make sure it triggers

#

so I'm not sure hooking the timed action will be able to know it's the exoskeleton specifically

#

actually that shouldn't matter now that I think about it, it checks for that on another line

bright fog
#

You have access to the item in the instance of the timed action equipping the clothing item

#

So you can check that the item is in fact the item you should be doing shit on

gilded crescent
#

how would I write the timed action check? I've got a rough idea but I don't know anything about lua and have no idea which timedaction I'm checking for

#

preferably in simple terms so that I can learn it and try to remember it for future projects instead of having to ask others

bright fog
#

You can find Timed actions as Lua files in folders named Timed action

gilded crescent
#

ah I found it thank you

brave bone
# silent zealot This is from a B42 plumbing fix by Lightja, to start a massive storm: ```lua loc...

@ancient grail tried local mgr = getClimateManager() mgr:transmitServerStartRain(0.1); mgr:transmitGenerateWeather(0.1, 1)
it is kinda being accepted but nothing is happening.

although I can stop the weather by: local mgr = getClimateManager(); if isClient() then mgr:transmitStopWeather(); else mgr:stopWeatherAndThunder(); end
there are some triggers but, this seems to be directly commands from the climate debuggers ui:
transmitTriggerStorm
transmitTriggerTropical
transmitTriggerBlizzard

but this piece of code works in debug input thingy where you can directly input itensity and hours.
local function lightja_createtropicalstormtest() if isClient() then getClimateManager():transmitStopWeather(); else getClimateManager():stopWeatherAndThunder() end local clim = getWorld():getClimateManager(); if clim then clim:triggerCustomWeatherStage(1,48); end end; lightja_createtropicalstormtest()

clim:triggerCustomWeatherStage(**intensity**,**hours**)

ancient grail
brave bone
ancient grail
brave bone
rich reef
#

There seems to be a discrepancy in checking for getAccessLevel() == "admin", and getAccessLevel() == "Admin". Does anyone know why, or which is the correct method?

fleet bridge
#

It's case sensitive

bronze yoke
#

i don't have a copy of b41 easily accessible to check it's the same there, but in b42 it will always be capitalised like Admin

#

that is an area that's had a major overhaul, and an overhaul that obviously isn't even done yet since multiplayer isn't out, so it's not that unlikely it could have changed

#

but they kept getAccessLevel() even though they don't call it that anymore presumably for backwards compatibility so i imagine the names must be the same or else there wouldn't be any point to that

ancient grail
rich reef
#

For instance. I am using this in two different spots, and get two different results.

function testFunction(_keyPressed)
     local key = _keyPressed
    
     if getAccessLevel() == "admin" then       
         if key == 77 then
             ISChat.instance.servermsgTimer = 3000            
             ISChat.instance.servermsg = "Testing..."
         end        
     end
 end

This works to make sure that the button only works for an admin character.

But when I do this function, using getOnlinePlayers(), I get a different result with my if>then check

function AnotherFunction()       

    local onlineUsers = getOnlinePlayers()
            
            for i=0, onlineUsers:size()-1 do

                local player = onlineUsers:get(i)   
             
                if player:getAccessLevel() ~= "admin" then 

                    print (player:getUsername() .. " is not an admin")   
                else
                    print (player:getUsername() .. " is an admin")   
                end
            end
end 

This function will show that the user, myself, is NOT an admin, even though I am. If I then change the If>Then check to

if player:getAccessLevel() ~= "Admin" then ...

it then works as intended.

Does anybody know why?

bronze yoke
#

because it's case sensitive

#

Admin is not equal to admin

rich reef
#

Alright. Then why does the testFunction with the keybind work as intended with checking getAccessLevel() == "admin" then? If it is suppossed to be "Admin"?

bronze yoke
#

my best guess is that getAccessLevel() and player:getAccessLevel() must actually return different capitalisations like that

ancient grail
#
string.lower(getPlayer():getAccessLevel()) == "admin" 
bronze yoke
#

i'll go dig up my b41 source and see if that makes sense

rich reef
#

I was guessing the same, but wasn't sure. I'm guessing since the Event Function runs getAccessLevel() on it's own, from the client side, that it may give a different result than getting the player list from the Online Users, and that may give a different result.

bronze yoke
#

ok yeah it's stupid

clever depot
#

What you normally do, if the game says tiles missing but you got all dependencies?

bronze yoke
#

the global getAccessLevel() is always lowercase, the IsoPlayer getAccessLevel() is always capitalised

#

it's stored internally in full lowercase, for some reason the isoplayer one capitalises it before returning it, but the global one doesn't

rich reef
#

Okay, that's definitely odd. lol One of those weird things to throw a stick in the spokes. hah

#

Where did you find this information, if you wouldn't mind me asking? The java docs?

bronze yoke
#

i just looked through the source code

rich reef
#

Alright. I decompiled the code a while back, but haven't poked around too much yet.

#

I appreciate the confirmation though. This would have left me wondering constantly if something was working/broken and just hoping it was right.

bronze yoke
#

it is at least fixed in b42

rich reef
#

I can only imagine how many small bits of code had to be changed for this adjustment throughout B42's changes, and all the mods that were ported over. No wonder their bug fix list is miles long each patch they come out with.

#

Thanks again @bronze yoke . Always there with an answer! ๐Ÿ˜‰

#

Also, would it be better to check the keystroke first, and then check for admin? Or admin> keystroke? Which would be more performant? I'm assuming keystroke>admin?

bronze yoke
#

keystroke first, yeah

rich reef
#

thank you

bronze yoke
#

general rule is that calling functions is insanely expensive

#

something like comparing a number is basically free in comparison

rich reef
#

Yeah, especially in this case the keystroke is already passed. It's just a simple check.

Wasn't noticing this until I posted it.

#

Do you by chance know of any simple functions/routines that could be used to test performance of your functions, like a profiler in other IDEs?

icy night
#

I thought I had my shot tracker fixed but I just realized it's still counting shove attacks: ``` if not player or player:isDead() then return end

local weapon = getPlayer():getPrimaryHandItem()
if not weapon then return end
if not instanceof(weapon, "HandWeapon") then return end
if not weapon:isRanged() then return end
if player:isDoShove() then return end

local latestRadius = weapon:getSoundRadius()``` It counts the shots correctly, but if Im holding the gun in-hand, it'll still count the shove the same way
bronze yoke
#

doing it in zomboid is always awkward but the easiest way is to do something like this:```lua
local start = os.time()
for i = 1, 1000000 do
-- the code you want to profile here
end
print(os.time() - start) -- how long it took in seconds

rich reef
#

Awesome, thanks!

brave bone
#

What does os.time do? Is it like gametime?

thin swan
brave bone
#

Thank you.

nimble yew
#

Hello! I'm new to PZ and modding. I'm trying to create a mod to modify the required tools to uninstall/install parts in a vehicle. I'm trying to override VehiclePart.getTable() but I'm not being able to get a break inside my function.

nimble yew
#

Well, it seems I'm not able to override a Java method. That's a bummer. Do you know any other way I could alter the parts' table? I'm trying to make a functional car lift mod.

nimble yew
#

Of course I cant override canUninstallPart either ๐Ÿ˜ข

craggy nacelle
#

Not that im doing anything with cars, but im curious. Can someone tell me why it is that when multiple people drive their cars on a server, the server performance drastically declines? Again, just curious.

#

I mean, its not like players running around have the same effect, so its a bit strange.

ancient grail
ornate basin
ornate basin
silent zealot
#

Have muliple people drive in little circles to confirm, because I agress it's likely map loading.

#

Especially new chunks that need erosion applied.

silent zealot
#

But you want to make sure whatever you're doing lets the original function call through if whatever special conditions your mod cares about do not apply, or you will break vanilla use of the functions. That also avoid disaster if another mod also changes the function; you can have as many prefix/postfix patches on a function as you want but one modder replacing the whole function breaks it for everyone else. Sometimes that has to be done, but always try to think of a way to avoid it if you can.

#

Is your goal to change the required tools when a vehicle lift is nearby?

silent zealot
#

ISReloadWeaponAction.lua, under the "shoot shoot bang bang"

icy night
#

If weapon:haveChamber ?

silent zealot
#

Chamber seperate to the magazine.

icy night
#

Ah. So just isRackAfterShoot

silent zealot
#

like putting 7+1 rounds in a 1911

#

it does more than just that, but also - it just gets called like this:

#

Events.OnWeaponSwingHitPoint.Add(ISReloadWeaponAction.onShoot);

#

Presumably the parameters to that event don't send the gun as weapon if you shove

icy night
#

Alr

topaz tangle
#

Also, started on the next vehicle in my mod!!

ornate basin
#

btw I noticed that

#

honking is louder than gunshots

#

what's up with that lmao

#

eh maybe that's better in terms of balance

silent zealot
#

Depends on the gun I think

#

louder guns are 200 tiles.

#

I think house alarms are 500 or something insane.

#

Vanilla noisemakers are so much of a let down.

broken kayak
#

So as the Events.OnMouseUp only fires when the mouse is not on any UI element, is there some sort of opposite for running code when the mouse goes up on any piece of UI ?

#

I was running code from the InventoryPane:OnMouseUp and InventoryPane:OnMouseUpOutside to detect when a click was inside or outside any UI element, but when the inventory is closed, that code is no longer running, is there an UI element that can never be disabled from which I can run my code ? Or is there a better solution that I missed ?

thin swan
# broken kayak I was running code from the InventoryPane:OnMouseUp and InventoryPane:OnMouseUpO...

You can make your own onMouseDown function fully if you want, you'd just do something like:

function CustomMouseDown(x, y)
    -- Your code here
end

And then add this to trigger on MouseDown events:
Events.OnMouseDown.Add(CustomMouseDown);
This will not run if you do mouse down in a UI element though, for that you'd want to hook the onMouseDown/Up methods of the UI element you want to run your custom code on.

#

Wait sorry I think I misread

broken kayak
#

Well I need to trigger an event when the mouse does something on any UI element

thin swan
#

Yeah I was reading a bit too fast, my bad

broken kayak
#

No problem xd

#

I'm starting to wonder if creating an invisible UI element would be the way to go.

sour island
#

There's mouse events for over and off of the UI

#

But tapping into the parent-UI in a case of off-of would fire for every element.

broken kayak
#

Well if the child class do not call the super function then my event will not trigger will it not ?

#

I've already tried using ISUIElement and ISPanel mouse events function to no avail

#

But maybe I did something wrong

#

Well I guess I did do something wrong as overriding ISPanel:onMouseUp did work, I'll see what I can do with that thanks !

thin swan
thin swan
#

God having to code for work is so fucking boring now, I just want to make mods ๐Ÿ˜ญ

thin swan
topaz tangle
neon bronze
#

does DoParam for items do nothing?

thin swan
neon bronze
# thin swan It should, how are you using it?

im using both

junkLauncher:DoParam("AmmoType = " .. junkLauncher:getAmmoType() .. "/Base.Pot,")
junkLauncher:setAmmoType(junkLauncher:getAmmoType() .. ammo)

but only the last one actually does stuff, DoParam causes the item to error out the ToolTip

ancient grail
#

b42 i think(or maybe its cuz its solo mode)
doesnt refresh the clothing in game when i update the fbx file
this is a huge problem
i will have to restart everytime i do some changes

anyone knows how to force reload clothing items

thin swan
neon bronze
#

i am getting the item through the ScriptManager:getItem but i believe it returns an Inventory Item

thin swan
# neon bronze i am getting the item through the ScriptManager:getItem but i believe it returns...

Hmm, the ScriptManager should return the scripting object item over the inventory item.
At least according to https://demiurgequantified.github.io/ProjectZomboidJavaDocs/zombie/scripting/ScriptManager.html#getItem(java.lang.String)
If it actually is returning an inventory item for some reason, then try junkLauncher:getScriptItem():DoParam("AmmoType = " .. junkLauncher:getAmmoType() .. "/Base.Pot,")

neon bronze
#

and the setAmmoType

nimble yew
# ornate basin Overriding is not good practice in mods, since other mods may want behavior on i...

I totally get that. But I think something like this would be harmless

function VehiclePart:getTable(name)
    local tbl = old_getTable(self, name)

    --- check for Jack requirement. if the Car Lift is near, remove Jack from table

    return tbl
end```

This will prevent the check for the Jack along the way, like taking it from inventory and equipping it. 

The only mod I looked deep into it's code is Auto Mechanics, and it uses getTable and canUninstallPart. Looks like it would be compatible
ornate basin
#

which seems to be what you've done so

nimble yew
nimble yew
# ornate basin which seems to be what you've done so

The thing is I'm not getting a break when I place a breakpoint in there. That's why I thought I couldn't override a Java method. I have 0 experience with PZ mods. I'm looking on other mod's code and reading the Wiki, reference and, won't gonna lie, some ChatGPT

ornate basin
#

idk I don't debug with breakpoints

#

I'm a savage, I'm a print debugger for life

#

always and forever

nimble yew
#

lol, I totally print too. Didn't get any results there either. The lua is in the client folder of the mod.

nimble yew
#

I don't know about Java to Java. Maybe canUninstallPart will and I'm fucked then

queen oasis
craggy nacelle
nimble yew
# queen oasis you can't override java functions like that, and you shouldn't have to for this....

ISVehicleMechanics has my first challenge on ISVehicleMechanics:doPartContextMenu:

  option = self.context:addOption(getText("IGUI_Uninstall"), playerObj, ISVehiclePartMenu.onUninstallPart, part)
  self:doMenuTooltip(part, option, "uninstall");
  if not ISVehicleMechanics.cheat and not part:getVehicle():canUninstallPart(playerObj, part) then
    option.notAvailable = true;
  end
end```

If canUninstallPart fails, then the Context Menu option will be disabled. So canUninstallPart is a problem too. If it relays on getTable and I could override it, it would be good. But You all told me I may be able to override Java to Lua, but not Java to Java. So there is my first issue.

Also, inside `doMenuTooltip` there is also a check for displaying the missing tools. It won't block the operation but it doesn't look right to have the missing Jack in red.

Then on `ISVehiclePartMenu.onUninstallPart` (and onInstallPart too) I have the tool inventory transfer and tool equipment code:

```if not ISVehicleMechanics.cheat then
  if playerObj:getVehicle() then
    ISVehicleMenu.onExit(playerObj)
  end
  local tbl = part:getTable("uninstall")
  ISVehiclePartMenu.transferRequiredItems(playerObj, part, tbl)

  local area = tbl.area or part:getArea()
  ISTimedActionQueue.add(ISPathFindAction:pathToVehicleArea(playerObj, part:getVehicle(), area))

  ISVehiclePartMenu.equipRequiredItems(playerObj, part, tbl)
end```
#

So even though I could rewrite all those functions and make it work in Vanilla, all other mods using getTable and canUninstallPart (like Auto Mechanics) won't be compatible

#

Better Car Physics requires to replace Java files manually. It's a nasty thing, but maybe the only way?

queen oasis
#

you can catch the context menu, check for a lift and remove the jack requirement before it gets anywhere else?
Lemme dig around a little myself. Ironically(or unironically) the only time I've messed with VehicleParts is overriding a lua call to a java function

queen oasis
#
function Vehicles.UninstallTest.Default(vehicle, part, chr)
-- and
function Vehicles.InstallTest.Default(vehicle, part, chr)
queen oasis
#

you could even narrow it down to

function VehicleUtils.testItems(chr, items, typeToItem, tagToItem)

if it's looking for a jack, check for your lift, remove the jack requirement from the script if there's a lift so you don't get the red option
Then put it back when you're done - which is simpler since there is an OnMechanicActionDone event

#

Is there no formatting Mod Options? The text is all over the place

queen oasis
#

I was hoping for text formatting, <center> specifically

queen oasis
#

I tried <CENTRE> and no dice but I'll mess around. thanks!

bright fog
#

Hmm

#

You could always hack in the UI object LMAO

#

What do you want to center exactly ?

#

Like the menu options to be aligned with the line that separates your option text and object ?

queen oasis
#

yea even if the title could be centered, I'd be able to live with myself

bright fog
#

I see what you mean lol

queen oasis
#

hmm, might have to get creative with spaces

nimble yew
bright fog
#

You can always modify the UI object but eh

bright fog
queen oasis
#

idk why I can't just be happy with way things are. I start with something simple, and then make it 10 times more difficult

bright fog
#

The thing is that the issue here is the UI element being missplaced basically not the text itself

coarse sinew
queen oasis
#

if you can't beat it, delete it

bright fog
#

Yea like I said you can just go on and modify the UI object itself haha

queen oasis
#

seriously, right underneath it is addDescription and guess what it is?

bright fog
queen oasis
#

made it worse

bright fog
#

lol

queen oasis
#

I can live with this. Thanks!

bright fog
#

What did you change lol ?

queen oasis
#

got rid of the title text and just descriptions with H1 and H2

#

gonna play around with it more but this is usable

bright fog
#

Wait so you nuked a vanilla title ?

#

Is that title forced ?

#

Menu Options is forced ?

queen oasis
#
local options = PZAPI.ModOptions:create("JBLoggingModOptions", "")

options:addDescription("<H1><LEFT> JB's Auto Logging Menu Options")
options:addDescription("<H2><LEFT> Menu options for JB's Auto Logging")
options:addSeparator()

The space is still there for it I think, but just an empty string

bright fog
#

Isn't that an object you add manually ?

#

I'm kind of confused here

honest lodge
#

Where can I change the Desert eagle clip size? I changed max ammo, but that didn't work

queen oasis
bright fog
#

Surprising that this is forced

queen oasis
#

meeee toooo

bright fog
#

I don't remember such an annoying thing being present

queen oasis
#

I might get around to changing the rest to ISRichTextPanel some day

bright fog
#

Is that something which will apply to every mods ?

#

Aaah so that's the title basically the issue if I understood that right

queen oasis
#

I didn't do anything except pass an empty string to create

bright fog
#

I'm so confused, that must be new because this here is an old screenshot of it

#

That extra title is kind of fucked

queen oasis
#

local options = PZAPI.ModOptions:create("modOptionsID", "")
instead of
local options = PZAPI.ModOptions:create("modOptionsID", "Example options")
and then I just used addDescription for the title

#
local function JBLoggingOptions()
    
    local config = {
        checkBox = nil,
        colorPicker = nil,
    }

    local options = PZAPI.ModOptions:create("JBLoggingModOptions", "")

    options:addDescription("<H1><LEFT><ORANGE> JB's Auto Logging Menu Options")
    options:addDescription("<H2><LEFT> Menu options for JB's Auto Logging")
    options:addSeparator()

    config.checkBox = options:addTickBox("Always_Show_Menu", getText("UI_options_JBLogging_Always_Show_Menu"), true)
    config.checkBox = options:addTickBox("Keep_Menu_At_Top", getText("UI_options_JBLogging_Keep_Menu_At_Top"), false)
    config.colorPicker = options:addColorPicker("Select_Color", getText("UI_options_JBLogging_Select_Color"), 0.2, 0.5, 0.7, 0)

end

return JBLoggingOptions()

that's the whole of the code I used

bright fog
#

Yea yea but that title wasn't there before

#

Like in the screenshot I sent

queen oasis
#

ohh

bright fog
#

Which is the 42.0.2 version

queen oasis
#

hell I thought it was always there

bright fog
#

Yeah no that's why I was confused about this title and thought that you simply added a title object

#

I don't get why they'd add that tho that's so stupid

#

Like there's ALREADY the mod section title on the left, why double it lol

#

I'd have to check wtf they are doing here and what adds it

#

That could be fixed

queen oasis
#

maybe this in MainOptions

for _, options in ipairs(PZAPI.ModOptions.Data) do
  self:addHorizontalLine(y, getText(options.name))
  for _, option in ipairs(options.data) do
    if option.type == "title" then
    self:addTitle(splitpoint, y, getText(option.name))
    ...```
adds the 'options.name' twice
```lua
function MainOptions:addHorizontalLine(y, text)
  ...
  local label = ISLabel:new(100, self.addY + y + UI_BORDER_SPACING, FONT_HGT_MEDIUM, text, 1, 1, 1, 1, UIFont.Medium)```
bright fog
#

Bruh

#

I wonder when that change happened

#

Tho I don't expect anything from that channel anymore to be achieved

queen oasis
#

idk, they fixed the 'can't use walk-to while dragging a zombie' and I didn't think they would fix that

bright fog
#

Idk man there's been some major problems to some insanely important aspects of modding imo

#

And to my knowledge none of these were fixed lol

#
  • AnimSets needing to be in B41 folder to be loaded
  • Mod IDs being improperly loaded, bloating the console with constant spam that the game did not find the workshop ID or some shit like that
  • Mod IDs supposedly needing the workshop ID in front of the mod ID (which causes its own set of problems) and is the reason you need \ in front of every mod ID for required in mod.info and identifying if a mod is present in the player save
  • Posters not being loaded from content folder at all, even if you put the mod.info in the content folder (that one I guess is less important)
#

And I just checked they still haven't even fixed the battery removal issue even tho that's literally a request I had made which they implemented but it actually won't even work because of that
#1318920979581501502 message

frank elbow
#

Personally, I'm holding on to hope that they'll get to them eventuallyโ€”modding stuff is prob just lower priority and there's a lot to sift through in that channel

#

As long as the major stuff is addressed before stable we'll survive (otherwise, we will all perish)

bright fog
#

I agree BUT imo this causes multiple major problem:

  • issues (and requests) end up pilling up in that channel
  • this will take ages to sift through and it will get worse the more and more you wait
  • modders end up not using that channel anymore because we just barely ever see any changes happening. This personally gave me the feeling that any issues I get are just not worth reporting there because imo it just looks like none of it will ever get fixed
  • a lot of these issues are such tiny issues that wouldn't even take that long to fix imo (like the battery thing I mentioned is literally just adding a single tag check)
  • some of these issues are actually major issues that REALLY need fixing like I mentioned and they end up getting lost between many many many various smaller issues

So at this point I'm unsure what the motivation was. If it was about trusting modders that tend to touch a lot of technical stuff and end up finding issues players wouldn't even be able to notice simply by skimming through the code, not much is happening.

Same applies for requests where some requests are quite legitimate and could help improve the modding of the game (like my battery electronic tag I had suggested which was introduced but not tested and thus doesn't work)

#

God the day they change/fix the mod ID system to what it's supposed to be or simply completely change it, it's going to be ABSOLUTE hell for every modders and players about not a single mod working anymore lol

nimble yew
#

I still have the BHS color message saying the tool is missing, though

#

and then ISVehiclePartMenu.transferRequiredItems() throws an exception for not having the item. I might need to override that too along with ISVehiclePartMenu.equipRequiredItems()

queen oasis
#

can you get the script item and remove the jack from the install/uninstall items table? Might be easier to get it from the Vehicles.InstallTest.Default & Vehicles.UninstallTest.Default though since the part is passed to those

nimble yew
#

how come? like editing the template_tire.txt file? or is there a way to override it? that would solve eeeeeverything

#

it would be like overriding getTable()