#mod_development

1 messages Β· Page 124 of 1

thick karma
#

Afaik

ancient grail
#

My workaround has lots of things involved and would like to make it simplier

thick karma
#

I had to use commands to make Meditation MP compat doing this.

ancient grail
#

Yes

#

Thats what i did

#

Lua

#

Dhert made time action

thick karma
#

There may be a smarter way to fire the animations that automatically sends the animation update data to everyone but idk what it is

ancient grail
#

Both method works

#

Yes by doing timeaction

#

Or emote

#

But thats not applicable to stance

thick karma
#

I wouldn't say that's smarter necessarily, whether that works for you is context dependent.

ancient grail
#

Or moving

thick karma
#

He can't make a timed action for idling πŸ˜›

#

I can't make a timed action for sitting

#

I mean I guess I could but it's be more of a hassle.

hollow shadow
ancient grail
#

Ehat sitting is a time action isnt it

thick karma
#

No

ancient grail
hollow shadow
ancient grail
#

Adjust xml blend

thick karma
#

No he doesn't want it to go back to the upright position at all.

ancient grail
#

You can add blend out

hollow shadow
#

yeah it should be like this

ancient grail
#

We got away with not using time action . By using emote..

#

If you scroll up there are more vids i posted

thick karma
#

I'm not sure if you can play an emote while entering the sitting position.

#

maybe, but idk

#

I doubt it.

ancient grail
#

Does it have to be on the sit position really tho

#

You can just set the state maybe if it has too

dark wedge
# hollow shadow wtf, why is it doing this now :c

In your animation's action XML file, make sure to replace these too:

        <m_Target>aim_rifle</m_Target>
        <m_AnimName>Bob_IdleToAim_Rifle</m_AnimName>
    </m_Transitions>
    <m_Transitions>
        <m_Target>walkRifle</m_Target>
    </m_Transitions>
    <m_Transitions>
        <m_Target>runRifle</m_Target>
        <m_AnimName>Bob_IdleToRun_Rifle</m_AnimName>
    </m_Transitions>```
The animname should be replaced with your animation, as does different animations based on some conditions too
thick karma
#

Ahhhhh good catch @dark wedge

hollow shadow
ancient grail
thick karma
ancient grail
#

I see

thick karma
#

Maybe it could be done

ancient grail
#

Then your method is safe i bet

thick karma
#

I could possibly just emote into an animation loop

hollow shadow
thick karma
#

and then set the sit state manually

#

I just don't know how

dark wedge
#

Also, y'all should know that OnEquipPrimary and OnEquipSecondary events are synced in MP for all players. So, if all you need is to update a weapon on equip, can use these events. no need for a custom command. πŸ™‚

ancient grail
#

It breaks easily

#

So make backup

hollow shadow
ancient grail
#

Have y tried blend

thick karma
#

My bookmark is missing those 😦

hollow shadow
#

its suposed to stay at the modded idle. the one before it snaps back

thick karma
#

Oh nice @dark wedge

#

Actually those are listed... did you originally type OnPrimaryEquip?

dark wedge
thick karma
#

Thought I read it that way and searched for that

dark wedge
#
        <m_AnimName>Bob_Idle_HeavyBreathing_Rifle</m_AnimName>
    </m_2DBlends>```
#

its likely that one

hollow shadow
dark wedge
#

if you're running around and stuff

thick karma
#

When you save them

dark wedge
#

action files and animations should be refreshed automatically on external change

hollow shadow
#

i should have godmoded myself ughh

hollow shadow
thick karma
#

Yes

#

you'll notice a little skip when they do

#

Most likely

hollow shadow
#

what about animation fbx

dark wedge
thick karma
#

Not those

#

Maybe those? Idk

#

I thought I had to reboot if I updated my FBXs, I could be wrong

dark wedge
#

FBXs don't seem to reload automatically. .X do, but those kinda suck. xD

thick karma
#

I seeeeee

ancient grail
#

Yes i notice

#

Animation chat channel
When? AnimZed when?
Thank you

@ TIS
@ Spiffo

hollow shadow
hollow shadow
#

or should it be vanilla "IdleRifle"

ancient grail
#

Should be diffrent but idk which method youre doing my method or burry agas or dherts

hollow shadow
#

dhert

ancient grail
#

You cant combine em all ow ok

hollow shadow
#

and without burrys template i cant even start the animation

ancient grail
#

@dark wedge youre up hehe

#

Im using an adopted version of dislaiks method

thick karma
ancient grail
#

It would surely involve lua
Burry aga had his own method it also involves lua
Dhert uses timed action

thick karma
#

My template is for overriding nil focus general animations, one of which happens during a timed action, one of which does not.

#

A timed action is not a solution to this problem unfortunately.

#

That would be unwieldy a.f.

ancient grail
#

Feeling lazy.. but need to work... Almost finish with the entire queue list. Need to start looking for clients pretty soon

thick karma
#

You would have to design it to constantly be interrupted and then re-engage

dark wedge
thick karma
#

Just to stand correctly

#

You'd need to be in a timed action at all times

#

So idling via timed action imo is out @ancient grail

ancient grail
#

Sure

dark wedge
ancient grail
#

Idk how dhert actually uses that for hardcore hand

#

Brutal

#

Iment

thick karma
#

I also use a unique m_Name... though I was under the impression that it's just a label and not used to actually trigger anything? @dark wedge

hollow shadow
ancient grail
#

The mod should be adopted to vanilla

dark wedge
dark wedge
thick karma
#

Sure @hollow shadow That should be fine

thick karma
#

maybe that explains the behavior here

#

I thought just filename and animname and conditions needed to be unique

#

(I made my m_Name unique purely because it felt right)

dark wedge
#

I could be wrong. I've never made an animation replacer, just added my own animations/conditions so the name was unique for sure. ha

hollow shadow
ancient grail
#

Nope i use same xml name and mname only the animname is diff and we all know thats the animation file name too

thick karma
#

Wait

#

No

#

You Still have two vanilla Bobs

#

Idle to run?

#

Maybe that's an issue

hollow shadow
#

ok i managed to get it working again

thick karma
#

Idle to aim maybe nothing to be done about

hollow shadow
#

it resets to the modded idle after walking

thick karma
#

Vanilla weapons? @hollow shadow

hollow shadow
#

@dark wedge @thick karma thank you guys so much. i will be off to making an aiming animation and improving this one

#

OH wtf

#

he do the idle when i dont even have anything in hands aswell

thick karma
#

Lmfao

#

Sounds like perhaps my removal of the state is not registering on unequip somehow

#

@dark wedge Do you know if OnEquipPrimary fires when you remove weapons?

hollow shadow
#

yep

thick karma
#

getPlayer():clearVariable("YourVariable")

hollow shadow
thick karma
#

See if that makes you idle normally

hollow shadow
#

should i copy paste that into the command console

thick karma
#

You need to fix YourVariable

#

I forget your condition

#

ScrapGatlingEquipped

hollow shadow
#

im lost

#

getPlayer():clearVariable("ScrapGatlingEquipped")

thick karma
#

right

hollow shadow
#

i did that and now i hold it like vanilla

thick karma
#

Right

#

Unequip

#

that should confirm the issue is when we are adding / removing the condition

#

So once that's confirmed, gotta remove the condition at a better time

#

Also perhaps just add the condition OnEquipPrimary as dhert suggested

dark wedge
# hollow shadow <@255358282862952449> <@470376476445900801> thank you guys so much. i will be ...

My biggest recommendation would be to NOT do an override of the equip/unequip action. that is nuclear overkill for this.

local onPrimary = function(character, weapon) 
    if not character then return end
    if instanceof(weapon, "HandWeapon") and weapon:getFullType() == "Module.ItemName" and character:isItemInBothHands(weapon) then
        character:setVariable("ScrapGatlingEquipped", true)
    else
        character:clearVariable("ScrapGatlingEquipped")
    end
end

Events.OnEquipPrimary.Add(onPrimary)```
thick karma
hollow shadow
#

If i equip a different weapon tho, without unequiping the gatling, then it doesnt

thick karma
#

I see. In that case, consider what @dark wedge just offered.

#

technically weapon in the params is only known to be an item at first, just for your own awareness. @hollow shadow

#

instanceof is used to confirm that the item is actually a weapon.

dark wedge
thick karma
#

Really? When another player on my server equips a primary, my client fires this event on their character object???

dark wedge
#

But yes, it checks if the item is a weapon, if it matches your type (so replace "Module.ItemName" with your item's full name) and also checks if its in both hands. If so, it applies your anim; otherwise clears

thick karma
#

Dayum nice

dark wedge
#

was a thing i found when working on this Brutal Handwork update. will be refactoring both it and Fancy Handwork to use that instead of doing it myself.

hollow shadow
thick karma
#

And does this fire on unequip too? (Sorry if I missed your reply)

dark wedge
#

just be careful, it is called on someone in MP like...first. lol

hollow shadow
thick karma
#

You don't still have my code running do you?

hollow shadow
#

nope

#

i replaced yours with theirs πŸ˜‚

thick karma
#

hm

#

As you should have, just making sure.

hollow shadow
#

basicaly same issue as with your template. but it happens when i move a bit

thick karma
#

is if not character then return end really necessary @dark wedge? Can that function be fired with a nonexistent character object? And if so... why?

hollow shadow
#

also dropping it does the same thing :c

dark wedge
dark wedge
thick karma
#

In the second video it looks like he assumes his custom idle pose with a different item @dark wedge

hollow shadow
#

only if i "unequip" it by either pressing the button in the context menu, or by putting it onto my back. it fixes itself

hollow shadow
thick karma
#

Super odd

#

I would expect dhert's code to clear that for sure.

dark wedge
#

Did you make any changes to the base SGunsIdle.xml file?
Do other items get this animation if you equip them first?

hollow shadow
#

i didnt make any changes

#

just replaced the name

#

from when i first copy pasted it

#

wut

#

@dark wedge @thick karma just restarted my game and it doesnt work anymore

#

was i sitll using burrys template??

#

would mean that dherts thing didnt work at all tho

dark wedge
thick karma
#

The first time?

#

Or did you just edit, save, and reload file?

#

Because reloading file with my code deleted would not undo the things my code did

rose trail
#

Im trying to make a mod which lets you build oven but im not even sure is this possible

hollow shadow
rose trail
#

anyone got a template on how to add object to build menu?

drifting ore
#

okay so quick question for anyone who's familiar.. i have only tested on host with player connected. and in the hosts console. it's not an error or warning at all. but it starts spamming this like every in game min or so when a person that isn't the host starts doing anything with a lightswitch.

#

anyone familiar with this whatsoever? i'm chatting with glytch3r and some others but i'm stumped atm

#

it's not an error whatsoever either

rose trail
bronze yoke
#

is 10907,9993,0 the correct location? the error implies that square isn't loaded on the server, but if it's where the player is it really should be

drifting ore
#

yea and i tested it works perfectly also

#

like synced

#

i was flicking the switch and changing bulbs

bronze yoke
#

i would check the java for what actually prints this message

drifting ore
#

ah good call

#

receiveSyncCustomLightSettings lol

#

this has got to be some mp sync thing

#

can't be a cooincedence that it only happens when a user touches something that isn't the host

#
If the object at that index is an instance of IsoLightSwitch, the method calls the receiveSyncCustomizedSettings() method on that object, passing in the ByteBuffer var0 and the UdpConnection object var1 as parameters.
If the object at that index is not an instance of IsoLightSwitch, the method logs an error message to the DebugLog.```

this is where i think i'm stuck atm. i'm going to spend tomorrow figuring out how to do mp sync stuff. also gonna test in dedicated and see if it's a host thing or server or what
tame mulch
drifting ore
#

looking it up. i'm not super familiar with it

#
---@public
---@param arg0 UdpConnection
---@return void
function IsoLightSwitch:syncCustomizedSettings(arg0) end
``` ?
#

is this what you mean? sorry if i'm not quite there. the sync stuff is a little beyond me

#

oh maybe this...

---@public
---@return void
function IsoLightSwitch:addToWorld() end
#

well i guess it's going to be a fun homestretch for this one πŸ˜„ nice part is this is my final step

ancient grail
#

anyone knows why theres a letter s on the vanilla file

#

i have verified files and ask dhert if we have the same file and he said its the same so why is there an s ? does this do something

tame mulch
#

oh

#

Just mistake I think

ancient grail
#

ok then

thick karma
#

Did removing the 2 hand check work?

#

Dhert's last idea?

split basin
#

Does anyone know why the SkillRequirement for this item doesnt work? Ist the skill name wrong?

jaunty gate
split basin
split basin
#

Thank you so much ❀️

red tiger
#

Good morning. Still somewhat sad from yesterday having issues with vehicle template scripts. =/

pulsar heath
#

good morning

ancient grail
#

Ei whatsup buddy

#

Long time

red tiger
ancient grail
#

Dont be sad youl figure it out

thick karma
#

Noticed you got this working; nice work, congratulations. You might want to consider posting your controller-emulator solution for gamepad testing on the Wiki in the Pins.

red tiger
#

I'll need to separate my lexer code for vehicles. It shot up my lines of code from a couple hundred lines to a thousand.

thick karma
#

Ouch

ancient grail
#

Ouch

#

Lol

red tiger
#

The issue is that I fall out of sync with tokens when building them after a part in a template vehicle.

#

Me trying to reuse code caused it.

#

I'm going to statically build vehicle and template vehicle when I touch them again.

#

Redundant code, but can't be asked to build effective code for what I'd consider to be troublesome implementation for the game. =/

#

Besides syntax adjustments, everything in ZedScript is okay except the vehicles.

#

I'd literally need an application that gives me the ability to edit without being in script to work with vehicle scripts. Crazy stuff.

#

Not sure how @faint jewel does it.

#

Hoping that template is eventually used for other script content. This is a good idea that would help a lot of modders.

faint jewel
#

lol

#

alcohol and mdma.

#

i'm kidding.

pulsar heath
#

@faint jewel tends to pick projects that at the first glance look easy

#

but when you try to implement them... god damn it...

#

πŸ˜„

thick karma
faint jewel
#

hey i want to push the engine.

thick karma
#

Lmao

faint jewel
#

deliveing mail should NOT be that hard.

pulsar heath
#

it shouldnt but it is

faint jewel
#

PZ tells you it so freaking is.

split basin
#

Hey, sorry for the beginner questions but i'm kinda stuck. I want to remove the recipes for Disinfect Bandages and do my own. I tried the Overwrite tag but it will only overwrite one of the 4 recipes. Now i tried the "obsolete" tag but it does nothing. Any ideas?

faint jewel
#

you shouldn't have to do either.

#

as long as it is named the exact same, it should auto overwrite the default.

#

you will have to rewrite all 4 of the recipes if that is the issue.

split basin
#

I did that and changed the time to 10-13, but instead of overwriting it will add them as new recipes

#

So now there are 8 recipes

faint jewel
#

so it's not overwriting them.

#

i will admit that i have not overwritten recipes.

#

i have overwritten items.

#

so i'm going off what i know.

#

is there a mod out there that modified them already?

#

you could see what they are doing that you might be missing?

calm depot
#

you could iterate the existing recipes in Lua and use setIsHidden on them

split basin
#

It works for recipes with only one version, but "Disinfect Bandage" has 4. so its only overwritng the last one. I think its a bug

wheat kraken
thick karma
#

Pins are up here @wheat kraken

#

It's the 3rd symbol.

#

Which is called a thumbtack sometimes, or a "pin"

hidden tusk
#

Can I look in the source files of other mods to learn how they do certain things? ||im new||

calm depot
#

yes

hidden tusk
#

In order for that what should I do does the source file add itself to my computer when i subscribe to a mod or i can only look at the ones that are open for editing

calm depot
#

when you subscribe to the mod, it's downloaded to the Steam workshop folder, just like for any other game that uses Workshop

#

the ID of Project Zomboid is 108600

hidden tusk
#

Oh so i can look into every mod i subscribe on steam?

calm depot
#

yep

hidden tusk
#

Thanks, I diddnt know it I appreciate it

jaunty gate
split basin
split basin
sour island
#

recipes have some issues with that as they allow for the same name to occur

#

What you can do is parse through the vanilla recipes using lua instead

split basin
sour island
#

Should be on shared if I'm not mistaken as you need both host/connections server/client to match

#

I use OnGameBoot - but I think that may trigger anti-cheat if you let it run more than once

#

Recently started doing this for SP/MP

Events.OnLoad.Add(function)
if isServer() then Events.OnGameBoot.Add(function) end
#

Servers don't run OnLoad, and I check isServer to keep onBoot on MP

#

Trying to find my snippet for hiding recipes

#

But basically you use ScriptManager

scenic cradle
#

Man - where's @calm acorn so I can thank them again for CarWanna - so easy to add additional vehicles to the pinkslip system πŸ˜„

calm acorn
#

Lol

#

Np mate happy it helped out, btw there is a power shell script on my github to mass produce them

split basin
#

@sour island Thank you so much, i will try that!

scenic cradle
#

I know! We talked about it ages ago, you might not remember though

#

s'been some time.

calm acorn
#

Actually i think ive updated to the latest

#

Should have all of the flags for pinkslips that sort of went undocumented

scenic cradle
#

oh neat, might have to grab that then - I was just adding the Rhino Tow Truck in by hand as a request to one of the players on my server πŸ™‚

calm depot
#

pinkslips from the Marquee Printing Company? 😏

scenic cradle
#

I am going to need to produce a new list for nshops at some point - at which point I'll either be writing a new spreadsheet generator using your PS script - not sure which way I'll be going yet.

#

@calm depot not sure ... btw I love your icon/mask πŸ˜‰

calm depot
#

heh, it's from the original Crimefest announcement

scenic cradle
#

oh I know πŸ˜‰

faint jewel
#
        local obj = square2:getObjects():get(i);
                print(obj:getObjectName())
``` how the crap do i get hat print to show me the sprite name?  that just shows "IsoObject"
scenic cradle
#

getTextureName I believe is what you want...

#

I haven't successfully used it yet in my own code, but @fast galleon slide that one my way the other day

#

Right from one of the game source files: local o = sq:getObjects():get(i):getTextureName();

calm depot
#

actually it's literally getSpriteName

faint jewel
#

texturename worked sprite name gave me nil

calm depot
#

then what you really wanted was the texture name πŸ™‚

scenic cradle
#

HEY I was useful for once LOL

#

gonna go crawl back in my hole now

faint jewel
#

they are actually the same thing though which is dumb.

#

cuz thems is sprite names.

calm depot
#

is the object you're dealing with a proper 3D model?

faint jewel
#

nope. mailboxes

calm depot
#

hmm, odd, maybe it doesn't use a tilesheet or something like that

faint jewel
#

it does.

#

street_decoration_01_19

split basin
#

@sour island Do you mean like this? Or did i missunderstood the start of the function?

red tiger
#

Lol I just realized that I have been so busy with ZedScript that I haven't been a broken record for mentioning PipeWrench in here for weeks. XD

sour island
#

:addRequiredSkill - use : for method calls

#

also - you'll need to fix those arguments/params

calm depot
#

also, when you have code to share, paste it as text inside 3 backticks, don't take screenshots

sour island
#

But that should work -- I'd only be concerned with how recipes handle translations

#

The naming conventions for scripts (being they're so old) can be a bit convoluted - so you should try to confirm getName gets the untranslated one

#

add a language after the first set

calm depot
#

yeah, you might want to use getOriginalname instead

sour island
#
lua function
#
java private
split basin
#

@sour island Thats it right?

local function changeRecipes()

    local recipes = getScriptManager():getAllRecipes()
    for i = 0, recipes:size() -1 do
        local recipe = recipes:get(i)
        if recipe:getOriginalname() == "Disinfect Bandage" then
            local perk = Perk("Doctor")
            recipe:addRequiredSkill(perk, 2)
        end
    end
    
end

Events.OnLoad.Add(changeRecipes())
if isServer() then Events.OnGameBoot.Add(changeRecipes()) end
red tiger
#

I think that should be a sticker for this Discord server. =P

split basin
#

Ahh you have to write lua at the beginning?

red tiger
#

If you want syntax highlighting support for Lua code, then yes.

frank elbow
#

The way you had it in the initial screenshot was fine, no call is necessary there. Just changeRecipes

ancient grail
scenic cradle
#

....so here's one folks - anyone have any experience with using LUA to mark a "safe area" the way an admin can on a server?

frank lintel
#

Is there any way to intentionally make a function stop the game and jump into debug, ie funct/method like raise/break/stop?

split basin
sour island
faint jewel
#

is it possible to remove a moddata. no empty it but remove it alltogether

#
local function onDoMail(player, obj)
    player:Say("Mail Time!")
    local mBox = obj:getModData();
    mBox.dDate = 1;
    mBox:transmitModData()
end

local function onNoMail(player, obj)
    player:Say("No Mail For You!!")
    local mBox2 = obj:getModData();
    mBox2.dDate = nil;
    mBox2:transmitModData()    
end

onDoMail works.
onNoMail fails.
i need to clear out the mod data for it to work.

frank lintel
#

you talking memory data or a physical one?

frank lintel
#

far as I understand it moment you said mBox2.dDate = nil its gone

faint jewel
#

nope.

#

it's there but set to nil.

#

i need to gone gone.

frank lintel
#

no I mean that statement just wiped out that value. it shouldnt even exist ie. unreachable.

faint jewel
#

well it do.

#

lol

frank lintel
#

then lua GC manual lying

#

maybe doesnt die cuz its part of a mbox2 only thing that would explain it.

sour island
#

So you should be able to use that for type checks and such as needed

#

I meant to ask but what's the purpose of the mod? Make bandaging wounds less easy?

faint jewel
#

okay what the hell man.

frank lintel
#

and judging by the silence there is no actual method/function that lets me intentionally open debug.

faint jewel
#

it's erroring. but it's working.

frank lintel
#

no not be able to open it I want to code open it so I have a manual mouse driven breakpoint

sour island
#

So you want the F11 error window?

#

I think there's a function to call it

#

Otherwise you can just do "if 1 ==false"

frank lintel
#

ie make an actual error

sour island
#

I know you can also use intelliJ to run the deconpiled java to make breakpoints in the IDE from selecting lines as such

faint jewel
#

mBox:transmitModData() and mBox2:transmitModData() are calling nil?

sour island
#

But that was a pain in the ass to get working

faint jewel
#

ERROR: General , 1677600876997> ExceptionLogger.logException> Exception thrown java.lang.RuntimeException: Object tried to call nil in onNoMail at KahluaUtil.fail line:82.

#

i am so confused

sour island
#

You can only transmit modData for something with a square

#

Found that out recently

frank lintel
#

yeah I wasnt even trying to get IntelliJ to interact with teh game, Im making a mod that will open debug and tell me exactly what code is runing for the UI based on what I clicked on

sour island
#

Wouldn't a simple print do the trick?

ancient grail
sour island
#

If the isoObject doesn't have a getSquare() result it doesn't do anything

#

I ran into this issue when using commands to transmit inventory items around

#

It loses the square but nothing else

#

I didn't check other uses

ancient grail
#

I see

split basin
#

Can you do damage to the overall health of a player or just the bodyparts?

sour island
#

Both

#

It's a bit weird from my experience

#

Damage to bodyparts sends changes to overall

#

But you can also directly set damage overall

ancient grail
#

Its not weird i think

frank lintel
#

part dmg jut goes to infection stuff ie local health of that part then overall just controls if ya die?

faint jewel
#

does adding moddata remove the square?

split basin
#

How much overall health does a player have? 100?

faint jewel
#

because other than the transnit it's working but i want it to work in MP.

frank lintel
#

yes overall health is 0-100

#

unless its some hidden scalar that I dont see

tame mulch
red tiger
#

@quasi geode Have any chance to attempt implementing support for vehicles?

#

I'll be trying to wrap up my implementation today.

quasi geode
red tiger
faint jewel
red tiger
#

I tried to dynamically unpackage the vehicle code and that was my first mistake. x)

#

Going to write a separate lexer TS file to contain lexer code for static objects.

quasi geode
#

it all parses fine, but i havent done any advanced transformation on them, or the child blocks

tame mulch
sinful vessel
#

@quasi geode I had a question since I started making vehicle mods does "offRoadEfficiency" not work at all? In my tests I didn't see any difference to offroad efficiency for car, If you had a look over it before

red tiger
#

When I'm done, I'll present my deconstructed design.

quasi geode
sour island
red tiger
#

It's a lot more work to deconstruct the way I'm doing it however I think it's going to help when implementing it for my future editor.

sour island
#

I know you can safely transmit isoPlayers and inventoryItems -- I could have sworn it was safe to transmit squares -- but maybe the reference of a square gets weird?

#

Would make sense that the references don't line up in MP tho

#

You might not ever see another player's loaded squares

frank lintel
#

server tracks that doesnt it?

faint jewel
# tame mulch Try do by square under mailbox and use transmitmoddata()
local function onDoMail(player, obj)
    player:Say("Mail Time!")
    local square = obj:getSquare();
    local mBox = square:getModData();
    mBox.dDate = 1;
    mBox:transmitModData()
end

local function onNoMail(player, obj)
    player:Say("No Mail For You!!")
    local square = obj:getSquare();
    local mBox2 = square:getModData();
    mBox2.dDate = nil;
    mBox2:transmitModData()    
end
``` same thing.
tame mulch
split basin
#

Does anyone know what setDamage expects as a argument?

function OnEat_Bloodbag(food, player, percent)
    player:Say("Ouch")
    player:setDamage(50.0)
end
faint jewel
tame mulch
faint jewel
#

yes that.

#

lol

tame mulch
#

d is lowercase need

faint jewel
#

yes i know.

#

oh wait

tame mulch
#

send error from console.txt

faint jewel
#

hmmmmm

#

opkay, with small d.

#

it does nothing lol.

#

wait it might be.

#

YAY!

#

so it now does it right

rustic garnet
#

Why does pz source code loop in pairs, rather then just looping through bodypart damaged rather then just looping normally?

 local bodyPartDamaged = ISInventoryPaneContextMenu.haveDamagePart(player);

  for i,v in ipairs(bodyPartDamaged) do
            subMenuBandage:addOption(BodyPartType.getDisplayName(v:getType()), items, ISInventoryPaneContextMenu.onApplyBandage, v, player);
        end
faint jewel
#

now to get the mailboxes container and add stuffs to it.

calm depot
rustic garnet
frank elbow
#

Are you asking why using ipairs is necessary, or why it declares both i and v when it only uses v?

rustic garnet
#

I suppose both would be nice!

frank elbow
#

Presumably bodyPartDamaged is a table, so without a __call metamethod your code example would not work. I think you're asking a deeper question about Lua, to which I'd recommend reading up on how for loops work in Lua

#

The short answer is that you can't use a table directly in a for loop

#

As for why it declares both, 🀷🏾. The code could very well use _, v to show that it's unused, but if you need to use the value you have to declare it like that when using ipairs or pairs, because it gives you both the index and value

rustic garnet
calm depot
#

ipairs/pairs are the standard way to iterate over a table, which one you use depends on whether it's sequential keys or not

frank elbow
#

Gotcha, yeah I'd recommend reading up on Lua a bit to understand how some stuff works. Definitely not 1:1 with c++ or c#

rustic garnet
#

so in that case, "i" is the index of the table and "v" the result I see

calm depot
#

Then in C++/C# you'd be familiar with a range-based for loop

#

E.g. for auto&& i : vec

#

Or in C#, foreach

rustic garnet
#

Yes exatly, so is a table treated more like a std::map, or a Dictionary in c#?

calm depot
#

In lua, a table can be a mixture of both

#

It can function as either an array or dict

#

One, or both at the same time

rustic garnet
#

But thanks to the both of you that really helps understanding how it works. Because I was thinking tables would just be a normal array so when it was looping in pairs I was a bit confused!

calm depot
#

pairs is for arbitrary keys, ipairs is for keys in the range 1 to N

rustic garnet
#

Yeah that makes a lot of sense!

calm depot
#

Pairs has no stable sequence either

#

If you add or remove a key, pairs might iterate in a completely different order

sour island
#

Only if the keys are non-numeric right?

faint jewel
#

is it possible to just CREATE some items in a container?

sour island
#

Yes

#

itemCont:addItem or addItems

calm depot
#

I.e. even if it's only sequential numeric keys, I think an implementation is allowed to have pairs do non-sequential order

#

I certainly wouldn't want to rely on it

#

(and indeed, why would you when ipairs exists)

sour island
#

ipairs removes keys in place of numbers doesnt it?

#

I don't think it retains any kind of order either way but I could be wrong

ancient grail
#
IsoRegions.isDebugLoadAllChunks()
#

what does this do

frank lintel
#

checks if the debug option loadall is on?

ancient grail
#

but it sounds like it has potential to do stuff

frank lintel
#

and your debug setting for that is off?

#
      return DEBUG_LOAD_ALL_CHUNKS;
   } ``` so there a flag if or what actually uses it no clue.
#

likely debug scenarios ie 'tiny maps?' only Im not sure loading all chunks on the whole world would be wise.

calm depot
#

Given a table of 1 to N and other arbitrary keys, the others will be ignored

faint jewel
#

hmmmmm

#

now all i need is how to add an item to a player and i believe i might have the initial version of my mod ready to beta.

deft falcon
#

but who tf would do that instead of just

#

for i,v in ipairs lmao

bronze yoke
#

i've heard that ipairs runs worse

#

you don't need the if #table > 0 then check, it's redundant, so at that point```lua
for i=1, #t do
local v = t[i]
end

faint jewel
#

TAKE THIS MONEY YOU BASTARD. sfdpoghadfpoihadfp[o\

bronze yoke
#

apparently ipairs takes roughly twice as much processing time so it easily seems worthwhile to me

faint jewel
#

so how do i give a player "Base.Money"

#

he wont take this crap when i try to put it in his inventory like i do that mailboxes.

frank elbow
#

Nonetheless good detail to include

deft falcon
barren junco
#

hey guys
does anybody know if a java method can be patched?
trying to patch IsoGameCharacter:getHungerMultiplier

frank elbow
#

That means something in your function was causing the error

deft falcon
#

yea but when i added the check it stopped erroring so

bronze yoke
#

the check is not needed

deft falcon
#

actually wait if #t is 0 then i=1 > 0 by default

bronze yoke
#

yeah exactly, the check is already part of the loop

deft falcon
#

then idfk why it errored lmfao

frank elbow
#

And the even more full answer is yes with Java modding, but I know little about that

barren junco
#

yeah im not planning to get into java modding

#

im a workshop mf

deft falcon
#

ok so

#

is there a way

#

to check if helicopter event is active

barren junco
#

ah nvm this might not work

deft falcon
#

lmaooooo

#

also shouldnt it be getHungerMultiplier()

#

and not getHungerMultiplier alone

barren junco
#

im trying to get a method reference

#

not a call actually

#

maybe i can patch the metatable

deft falcon
#

ic...

barren junco
#

ill try that

#

so i accidentally used : instead of .

deft falcon
#

yea now that makes sense

hollow shadow
#

@thick karma Seems to still do nothing as if it didnt work

thick karma
#

Oof, sorry. I will try to help more later. Busy atm

hollow shadow
#

all good lol you dont owe me anything

drifting ore
# tame mulch Try create IsoLightSwitch on serverside

when you said this, were you referring to creating another instance on top of the current instances on the tile on just the server side? i was really tired when i read this, but these are coming from switches that are currently in world on map creation. only change i made really besides making a wall attached moveable, was giving it Light properties in tiledef

#

i really would like to figure out the sync thing if i can, but i did notice that when player and host are near each other, there is no desync at all

wispy mesa
#

hi guys, is there a way to create a zombie tree > which this tree spawn zombie and attack the player base, player can destroy this tressssss

#

by chopping it

#

good for events

drifting ore
#

and the log (no error, just a general log) shows on the host side only, which i assume is why you said create on server, but any insight at all would be massive appreciation if you have an idea

#

if anyone else has a suggestion also, i'm open to trying just about anything. i can use the constructor to create a new isolightswitch but just not seeing how it would benefit me, or how i would implement it when they already exist as a static spawn in world as normal

bronze yoke
#

i don't think creating an object would help, your error specifically means the square isn't found

drifting ore
#

yea i didn't think so... i'm dying inside over this lol... it's got to be me sending some sync message or something to server from client when interacting with em right? at least best guess?

bronze yoke
#

i had a look and it seems like basically every method to do with messing with lights sends the sync

humble oriole
#

What's the best way to log something? Just a simple print? Is there a way to log to a new log file that we define ourselves?

twilit onyx
#

guys
i'am trying to make a trait from a Insurgent mod to be Mutual Exclusive to another trait from more traits mod

EmotionlessTrait.name = "Emotionless"
EmotionlessTrait.insurgentExclusive = true
EmotionlessTrait.mutualExclusions = {"NervesOfSteel", "CombatAnxiety", "Cowardly", "Brave","NervousWreck","Melancholic"}

the NervousWreck and Melancholic are from more traits mod (i think), the problem is the Emotionless trait now is mutual Exclusions to vanila traits and Insurgent traits but not to NervousWreck or Melancholic

bronze yoke
#

if it were a critical error it would always print, surely

drifting ore
#

i wondered. i did see that it was from debug.log

#

god i am going to hate myself if it's literally only a debug thing

bronze yoke
#

i didn't realise this was a client log

drifting ore
#

it's only on the host console

#

no clients at all

#

and in debug

bronze yoke
#

the coop-console or the console?

#

or is it dedicated?

drifting ore
#

hosted

#

i will try dedicated

#

it only happens when hosted and another player uses em

bronze yoke
#

is the host the only player in debug?

drifting ore
#

yes

bronze yoke
#

that's it then

#

it's trying to update a lightswitch that the client doesn't have

drifting ore
#

lol so im literally worrying about nothing

bronze yoke
#

but it doesn't matter because it'll load that stuff from the server when the player gets there, so it's only printed in debug

drifting ore
#

ahh explains why it s a general log and not error

#

THANK YOU

#

releasing today in this case lol

faint jewel
#

now i just need payment!

#

woooooo

humble oriole
drifting ore
faint jewel
#

lol

drifting ore
#

finally releasing the mod also! your beautiful lightswitch model will finally see the light of day

#

πŸ’‘

twilit onyx
faint jewel
#
                       local md = square:getModData()
                        if not md.dDate then 
                            local dateCheck = true;
                        else
                            local dateCheck = os.difftime(md.dDate , os.time()) < 0;
                        end 
                        print(dateCheck)

why would it be printing nil

bronze yoke
#

not in scope

faint jewel
#

?

bronze yoke
#
                       local md = square:getModData()
                       local dateCheck
                        if not md.dDate then 
                            dateCheck = true;
                        else
                            dateCheck = os.difftime(md.dDate , os.time()) < 0;
                        end 
                        print(dateCheck)
#

your dateChecks are in the scope of the if/else statement, the print is outside of that scope

faint jewel
#

LOL

#

i hate doing the dumbs.

drifting ore
#

lol dont even get me started on that talk

#

πŸ˜„

faint jewel
#

so if i can get the "give dude a money" thing working i am set!

hollow shadow
faint jewel
#

did you make the model for the flash or is it a default zomboid one?

hollow shadow
faint jewel
#

hmmm maybe it's scaled via the script.

hollow shadow
#

it worked fine for my scrap guns. but for this weapon itdoesnt work atall

faint jewel
#

is there any kind of scaling being done in the script at all?

hollow shadow
#

i tried to use scale but it doesnt work

#

does this still work?

nimble spoke
#

I don't know if scale should work in there, never tried that

tame mulch
drifting ore
#

it seems my error is only a debug log

#

it doesn't show when not in ddebug

#

and it's not an error so i shouldnt even use that term

#

it's just a general debug log

#

i will do thorough testing via players and see if i need to end up fixing it. i just realized it's only a log for debug mode though

#

doesn't print if not debug

tame mulch
hollow shadow
drifting ore
vivid linden
#

Hey guys how can I modify a container's properties? Like the capacity and such? Trying to modify a bag but it seems changing it in the items script breaks the game.

vivid linden
hollow shadow
#

so you are trying to change the capacity of vanilla backpacks

vivid linden
#

the numbers that got changed were capacity and run speed

hollow shadow
vivid linden
#

I will dm a snip of the modified part

hollow shadow
#

oke

cunning canyon
limpid lantern
#

Gentlemen, I am extremely new to the modding scene. Listen all I wanted to do was change the vans texture into the Amazon delivery truck. How would one even go and about and access the vehicle texture files? TYSM in advanced

tame mulch
limpid lantern
vivid linden
#
ERROR: General     , 1677624050418> DebugLogStream.printException> Stack trace:
java.lang.NullPointerException: Cannot invoke "String.equals(Object)" because the return value of "zombie.inventory.InventoryItem.getDisplayName()" is null
    at zombie.inventory.InventoryItem.getActualWeight(InventoryItem.java:1927)
    at zombie.inventory.InventoryItem.getUnequippedWeight(InventoryItem.java:2633)
    at zombie.inventory.ItemContainer.getContentsWeight(ItemContainer.java:2681)
    at zombie.inventory.ItemContainer.getCapacityWeight(ItemContainer.java:2711)
    at zombie.inventory.ItemContainer.hasRoomFor(ItemContainer.java:198)
    at zombie.inventory.ItemPickerJava.tryAddItemToContainer(ItemPickerJava.java:522)
    at zombie.inventory.ItemPickerJava.doRollItem(ItemPickerJava.java:759)
    at zombie.inventory.ItemPickerJava.rollProceduralItem(ItemPickerJava.java:649)
    at zombie.inventory.ItemPickerJava.rollItem(ItemPickerJava.java:715)
    at zombie.inventory.ItemPickerJava.fillContainerType(ItemPickerJava.java:508)
    at zombie.inventory.ItemPickerJava.fillContainer(ItemPickerJava.java:459)
    at zombie.LoadGridsquarePerformanceWorkaround$ItemPicker.checkObject(LoadGridsquarePerformanceWorkaround.java:83)

Modified the values on a bag and now this happens

limpid lantern
#

Hey I just wanted to show you guys my progress, I need to re-center the actual logo and also make it look like it wasn't drawn by a 5-year old. I like how the text turned out and then I'm going to attempt to add little details like detailing doors. The reason I am doing this is because I just finished working at Amazon and I figured there would still be a couple of Amazon delivery vans roaming around Kentucky when the apocalypse hit. This is literally my first attempt at any retexture/modding ever.

drifting ore
#

item doesn't exist?

vivid linden
#

I dont understand why it would do this

drifting ore
#

check for spelling or something

#

maybe you fat fingered

vivid linden
#

all i did was change a numerical value

drifting ore
#

this is a script right

vivid linden
#

yeah

#

changed the capacity of a bag

drifting ore
#

yea you need to double check you didnt accidentally change a value

#

or miss a comma

vivid linden
#

and the game is like super mad about it

drifting ore
#

yep it cant update the value of something that doesn't exist

#

thats prolly why its mad

vivid linden
#

i will send you the side by side from original to modified

drifting ore
#

just use diffchecker or something

#

i dont have time to go thru your 700 line script

#

feel free to post it still. someone may notice something

fast galleon
#

This kind of works, one test done. Using global object system instead of LoadGridsquare

ancient grail
#

looks like people are going to want to use your mod as requirement.. did made it so that its to use as a framework?

modern hamlet
#

I'm looking for documentation for Foraging System. Is there any place that has information on how the "spawnFuncs = { doGenericItemSpawn, doWildFoodSpawn, doRandomAgeSpawn .... }" section works?

dark wedge
drifting ore
#

unless it's made for only females or i was missing something

fast galleon
modern hamlet
humble oriole
#

Is there a way to get the recipe name from an OnCreate?

#

For logging purposes?

fast galleon
humble oriole
#

eeeh, idk if it matters that much lol

#

we're just trying to log who and what people are buying from our server's admin shop.
print("APA ATM Transaction -- Player: " .. player:getUsername() .. " -- Recieved: " .. result:getType())

#

wish we could put it in it's own log, but I couldn't find any code referencing a way to do that

#

unless we wrote to Lua, but that seems unnecessary too

hot patrol
#

It's making me realize just how much I want proper animations for the katana

upbeat spindle
#

Any idea where to find the lua (if such exists) that is behind heating elements such as the wooden stove and the fireplace?

#

Tried looking from \ProjectZomboid\media\lua and the subfolders, didn't find :c

#

Thanks in advance! <3

spring zephyr
#

is there anyone who is able to do tile editing?
i have one question about tile and it's urgent

honest vector
#

hello, I watched a modding tutorial and viewed some of the files in vs code and found that the problem I'm originally trying to fix is probably in the code of the game, found a forum where explains how to decompile the java code but I'm wondering if you can make a mod that touches that code or something like that legally for a server. My problem (the reason I'm entering modding) is because there is actually a bug where VOIP is for default muted for each player unless you approach them in voice range, then it activates (for example, if you never saw a player, the players tab will only show "Unmute VOIP" but can't press it. When meeting the player, they are unmuted and can mute or unmmute them until the session ends). This is problematic for me because unless I meet each player when I log in a server, I can't talk to them with radio/hams and I REALLY want to roleplay a radio station. Does anything of what I'm saying makes sense?

#

I know codding, never modded and can understand global coding things

fast galleon
ancient grail
#

I thought throttle kitty was her on mod chat wheb i saw TK lol mybad

drifting ore
ancient grail
frank lintel
#

you know what exactly would be the bug in that case?

honest vector
#

I have clues that point towards the voip mute system, muting by default (or a variable not set, being a fake 'false') until someone gets close and then unmuting them or creating the variable. Then the UI button actually works for the player that was close to you, instead of the other players never met, where the button doesn't work

#

But I need to look into the java code for this

frank lintel
#

yeah but any idea where Im thinking the same thing already got java set up more then lua when it comes to docs _

honest vector
#

the VoiceManager class I think

#

the UI button calls VoiceManager:playerGetMute and is getting a "is muted" equivalent, and when pressing the button and calling VoiceManager:playerSetMute it does nothing

frank lintel
#

yeah found it zombie.core.raknet

cunning canyon
frank lintel
#

dang that raknet code so clean I feel dirty just looking at it

honest vector
#

did u found something?

#

I need to research how to set up the java code to search for myself but I'm a little busy rn

frank lintel
#

nah just looking thru source if anything errorless in all senses so far

#

VADmode?

honest vector
#

ok tomorrow I will try to learn how to setup the java code so if my theory is true, make a mod that idk makes magic and lets me make a radio station

honest vector
frank lintel
#

dunno an odd flag setting

honest vector
#

can you send the VoiceManager class in a txt file?

frank lintel
#

if you got an IDE set up its in the external lib files

#

as for sharing the class files cant do that not gonna test morality/legalities, sorry.

#

but if you setup an IDE to make mods you get all that yourself

honest vector
#

dang okey thanks tomorrow I will setup that

frank lintel
#

just like MC, dont share source since ya should be extracting it from your own install... sorry couldnt help more that flag seems to be related to either being Voice activated or PTT but then there another mode where both are off? which makes no sense unless maybe thats controller related stuff?

#

trying to find the actual client side interaction part this all seems like server side code and starting the channel server etc

#

but its def a starting point to look at

sand dragon
#

hello, so im a new to modding with PZ and im trying upload a texture for a mod im making but its doesnt seem to be working. its an item texture but just shows up as a question mark/ missing texture. im stuck trying think of ways to fix it, does it need be a certain size or is there a special way to make textures for the game?

sand dragon
#

I havnt been able find anything on online that rlly helps with item textures. kind stuck tho and cant rlly move forward

drifting ore
#

are you talking about an icon?

#

or on the ground it shows at ?

#

i can post the guide for setting this up

wheat kraken
#

does somebody know an existing vanilla sprite of puddle or liquid on floor or similar to?

i found Steam/steamapps/common/ProjectZomboid/media/textures/puddles_hm.png

sand dragon
glass basalt
#

if it's an item icon, it has to be item_yourItemType

#

example

sand dragon
drifting ore
#

also you icon i think is 22x22 or something around there. pan might be able to confirm there

#

off the top of my head so not 100%

sand dragon
#

it says 32x32 and mine was 32x23 but i changed it to 32x32 and still wasnt loading

drifting ore
#

ahh maybe that is the right size there

glass basalt
#

my icon is 32x32

drifting ore
#

yea 32x32

#

there you go

sand dragon
#

here is the code

item SpiffoCard1
{
DisplayName=Spiffo Trading Card #001 - Spiffo,
Icon=Item_SpiffoCard_back,
Weight=0.01,
Type=Normal,
WorldStaticModel=SpiffoCard1,
}

#

here is the texture

#

i feel like im doing it right but idk why its not loading in game

drifting ore
#

where is that icon located? in textures?

sand dragon
#

yea

drifting ore
#

you are setting your module also?

sand dragon
#

no i havnt set those up yet, was just trying get the item texture to show up first

#

do i need do that?

drifting ore
#

just for now use Base module

#

yea

#

module Base {

#

} at end

#

good to go

#

you can use your own also

#

like module mymodule

#

setting your module will use that prefix when someone calls the items outside of the scope of your mod itself without importing your module first

#

if you set Base you dont need to import it

#

if you dont and you want to use without prefix then you import it after you set your module name

#
{
    imports
    {
        Base,
}```
#

before i forget. if anyone out there with more sprite knowledge than myself (so pretty much everyone) i am trying to find if i can select a sprite for context menu without it grabbing the entire square all the way to the ceiling. i assumed it wasn't my sprite causing the issue but wasn't 100%. is there another way to grab it without grabbing the entire square?

#

i can be clicking WAY off from the sprite itself even though the condition is the sprite specifically, and it still grabs the entire square

sand dragon
#

im still having trouble getting this mod to work. my code looks right and everything works like its suppose to. my world item textures are loading find but my item icon textures just wont load.

#

if someone can give me some tips or point me in the right direction where you guys size your icons or what i could be doing wrong.

little kraken
#

hello does anybody know how to get item's weight in Lua? If the item's weight is overridden by other scripts, I need to get the latest weight...

#

And I also need setter of item weight

wet sandal
#

@little kraken

function SusceptibleUtil.setWeightChange(item, key, amount)
    local data = SusceptibleUtil.getItemModData(item);

    local change = amount;
    if data.weights[key] then
        change = amount - data.weights[key];
    end

    data.weights[key] = amount;

    -- UPDATE THE ITEMS WEIGHT
    item:setActualWeight(item:getActualWeight() + change);
    item:setCustomWeight(true);
end

Code from one of my mods that changes an items weight. Looks like ActualWeight is the one you're looking for.
.

#

Finally got an equipment UI working in Inventory Tetris
Still pretty raw, but it works and should scale well enough for the insane number of equipment slots in the game spiffo
https://imgur.com/S88oiRn

drifting ore
#

dude thats crazy good

#

i'm seriously looking forward to this

latent shore
#

Someone make a mod that lets you get on top of cars, The picture of the game is a guy on top of a car lol

little kraken
#

btw thanks for the info

hollow shadow
spring zephyr
#

anyone has idea how to add sound while performing recipe action?
should i put code on recipe file? or something below server folder? or someting below clinet folder??

ancient grail
#

I recall you mentioned mockup before but this looks like yhe real deal

ancient grail
#

The txt file

spring zephyr
ancient grail
#

Im currently afk iwll have to get back to you

spring zephyr
#

just one last question at the moment, is any way to get "what day is it today in game"??

#

i mean in perspective of code. not watching your digital clock..

#

like in excel = today() something like this

ancient grail
sand dragon
#

yess thank you! Nippytime was able help me figure it out

wet sandal
dull moss
#

Can anyone remind me if I can require a client lua in server lua?

wooden lodge
#

Does someone here have experience with items giving someone a level up for a certain skill?
Let's say you create an implant item and want someone to be able to consume it for +1 Level of something. Please DM me I would greatly appreciate it.

dull moss
#

cant you just hook onto oneat function, there should be something like that

dull moss
#

Actually, scratch my last question, I got a better one.

#

I use ModOptions for my mod, and it's confined in client/ETWModOptions.lua. It stores all options in a table, right EvolvingTraitsWorld.settings = EvolvingTraitsWorld.SETTINGS or {};. Now, there's an option GatherDebug ( EvolvingTraitsWorld.settings.GatherDebug ) that I use to gather additional data if needed in bug reports. I have require in all other of my client/**.lua, require "ETWModOptions"; to make sure it runs first so it doesnt throw errors that options don't exist cuz the lua haven't ran yet. Now, I also have 1 lua in server/ folder, 'cuz I need to hook onto OnEat_Cigarettes, and inside of there I got following

local debug = function() return EvolvingTraitsWorld.settings.GatherDebug end

local original_oneat_cigarettes = OnEat_Cigarettes;
function OnEat_Cigarettes(food, character, percent)
    if debug() then print("ETW Logger: detected smoking") end
    local modData = character:getModData().EvolvingTraitsWorld;
        -- rest of stuff

Now, I'm getting reports that it throws error when sm1 tries to smoke, error itself is that debug() tries to access null table.

#

I dont really have access to dedicated server to test this shit

#

So need some help

#

if anyone can

wet sandal
#

Path of least resistance: remove the debug statement

dull moss
#

I mean yea

#

But I'd prefer to properly fix the problem

wet sandal
#

Can't offer much else, dont have the loading details of client/server/shared memorized properly

#

Oh, wait.

#

Move your mod options file to shared

dull moss
#

The settings table is global

#

why would it matter if its made in client or shared

wet sandal
#

Because I don't think the server loads anything from the client folder

dull moss
#

hm

#

but it's a global table

wet sandal
#

The server and the client do not share lua state.

dull moss
#

so if i move my modoptions lua to shared it should be fine?

wet sandal
#

You should be able to test it from the host option on the main menu. You don't need a dedicated server in my experience. Never saw any differences in testing with either.

dull moss
#

how do I require it in my client then?
atm I have require "ETWModOptions";, if I move it to shared, should it be require "shared/ETWModOptions";?

dull moss
#

If i host

#

while people send me error logs

wet sandal
#

Require path doesn't change

#

Weird, maybe self host does share client/server state.

dull moss
#

ok, so

#

Moving mod options to shared fixed the settings error, however now it throws error that SmokeSystem of non-table: null doesnt exist

local original_oneat_cigarettes = OnEat_Cigarettes;
function OnEat_Cigarettes(food, character, percent)
    if debug() then print("ETW Logger: detected smoking") end
    local modData = character:getModData().EvolvingTraitsWorld;
    local smokerModData = modData.SmokeSystem; -- ON THIS LINE
    local timeSinceLastSmoke = character:getTimeSinceLastSmoke() * 60;
    if debug() then print("ETW Logger: timeSinceLastSmoke: "..timeSinceLastSmoke) end
    if debug() then print("ETW Logger: modData.MinutesSinceLastSmoke: "..smokerModData.MinutesSinceLastSmoke) end
    local stress = character:getStats():getStress(); -- stress is 0-1
    local panic = character:getStats():getPanic(); -- 0-100
    local addictionGain = SBvars.SmokingAddictionMultiplier * (1 + stress) * (1 + panic / 100) * 1000 / (math.max(timeSinceLastSmoke, smokerModData.MinutesSinceLastSmoke) + 100);
    if SBvars.AffinitySystem and modData.StartingTraits.Smoker then
        addictionGain = addictionGain * SBvars.AffinitySystemGainMultiplier;
    end
    smokerModData.SmokingAddiction = math.min(SBvars.SmokerCounter * 2, smokerModData.SmokingAddiction + addictionGain);
    if debug() then print("ETW Logger: addictionGain: "..addictionGain) end
    if debug() then print("ETW Logger: modData.SmokingAddiction: "..smokerModData.SmokingAddiction) end
    smokerModData.MinutesSinceLastSmoke = 0;
    original_oneat_cigarettes(food, character, percent);
end```
#

BUT

#

it correctly updates all the values?

#

like what

#

how the hell does it correctly update the values

#

if it throws error

#

which should interrupt the scope it's in

#

???

thick karma
#

So it looks like moving that to shared changed your load order in a way that prevents your character's mod data from being initialized before OnEat_Cigarettes gets called.

dull moss
#

but it updates all the values

#

correctly

#

it increased addiction counter

#

it reset timer

#

it done everything

thick karma
#

You're saying OnEat_Cigarettes both works AND throws an exception?

dull moss
#

yes

thick karma
#

Only explanation for that is it's being called twice, from two different places, one of which is valid, one of which isn't.

#

A function cannot finish running if it hits an exception.

dull moss
#

that's why im in confusion of da highest orda

#

hm

#

imma make new server just in case

thick karma
#

Probably not gonna help. What mod has OnEat_Cigarettes originally?

dull moss
#

vanilla game

thick karma
#

Oh

dull moss
#

lmao

#

it literally runs full scope

#

and throws error inside of it at same time

#

dafuq

#

yea ok idfk

thick karma
#

How do you eat a cigarette? Lol is that the smoke function???

dull moss
#

ye

thick karma
#

sigh

#

Hmm I am actually not throwing errors when I smoke. Let me make sure I added ETW. I wonder if I need a certain trait to throw the errors.

dull moss
#

check coop console, error is there

#

not in console.txt

thick karma
#

ooof... lol but when I died

dull moss
#

that is if you're hosting locally

thick karma
#

(I was looking at your original, not the update)

#

The version mentioned in #mod_support did not generate the nonexistent mod option exception for me

dull moss
#

well ye

#

cuz you stopped calling it

thick karma
#

But when I died

#

CTD

dull moss
thick karma
#

ohhhhhhhhhhhh I need Killcount

#

I don't have that dependency

#

Alright round 3

wooden lodge
dull moss
#

to actually level up skill idk, there should be some function to add exp to a skill

thick karma
#

@dull moss Okay

#

It's the same problem

#

haha

#

😭

#

Events.OnCreatePlayer.Add(createModData);

#
local function createModData(playerIndex, player)
    player:getModData().EvolvingTraitsWorld = player:getModData().EvolvingTraitsWorld or {};
    local modData = player:getModData().EvolvingTraitsWorld
#

Server file does not know you initialized that mod data on my character

#

Because you only did it clientside.

dull moss
#

then how does it update the values correctly

thick karma
#

Hmmm

#

Maybe the client AND the server call OnEat

#

In order to match the inventory on client and server

#

So it only fails serverside

#

But the client one works

#

Because mod data exists there.

dull moss
thick karma
#

That would explain things.

dull moss
#

ye but this piece of code doesnt exist in client folder

thick karma
#

You can call server code from client

#

Just not vice versa

#

So, yeah... I would try this:

function OnEat_Cigarettes(food, character, percent)
    if isClient() then
        if debug() then print("ETW Logger: detected smoking") end
        local modData = character:getModData().EvolvingTraitsWorld;
        local smokerModData = modData.SmokeSystem; -- SmokingAddiction MinutesSinceLastSmoke
        local timeSinceLastSmoke = character:getTimeSinceLastSmoke() * 60;
        if debug() then print("ETW Logger: timeSinceLastSmoke: "..timeSinceLastSmoke) end
        if debug() then print("ETW Logger: modData.MinutesSinceLastSmoke: "..smokerModData.MinutesSinceLastSmoke) end
        local stress = character:getStats():getStress(); -- stress is 0-1
        local panic = character:getStats():getPanic(); -- 0-100
        local addictionGain = SBvars.SmokingAddictionMultiplier * (1 + stress) * (1 + panic / 100) * 1000 / (math.max(timeSinceLastSmoke, smokerModData.MinutesSinceLastSmoke) + 100);
        if SBvars.AffinitySystem and modData.StartingTraits.Smoker then
            addictionGain = addictionGain * SBvars.AffinitySystemGainMultiplier;
        end
        smokerModData.SmokingAddiction = math.min(SBvars.SmokerCounter * 2, smokerModData.SmokingAddiction + addictionGain);
        if debug() then print("ETW Logger: addictionGain: "..addictionGain) end
        if debug() then print("ETW Logger: modData.SmokingAddiction: "..smokerModData.SmokingAddiction) end
        smokerModData.MinutesSinceLastSmoke = 0;
    end
    original_oneat_cigarettes(food, character, percent);
end
#

And then just update the server with your new mod data using transmitModData from clientside if that's even necessary.

#

But server may not even need to know that, idk.

split basin
#

Anyone an idea why the text is so far right for the recipe?

sand dragon
#

i just finished my first mod!

thick karma
thick karma
#

Link us!

sand dragon
thick karma
#

What'd ya do?

sand dragon
#

it def needs some fixes im going do tomorrow, its a trading card mod and i only been able find one other on the workshop and was a PKMN one

thick karma
#

@dull moss In fact, that code should fix both problems.

sand dragon
#

two big things need fix are the spawning and the names for the item cards 2-5

thick karma
#

You could leave Mod Options in client if that's the only place you tried accessing it from the server.

#
local SBvars = SandboxVars.EvolvingTraitsWorld;

local debug = function() return EvolvingTraitsWorld.settings.GatherDebug end

local original_oneat_cigarettes = OnEat_Cigarettes;

function OnEat_Cigarettes(food, character, percent)
    if isClient() then
        if debug() then print("ETW Logger: detected smoking") end
        local modData = character:getModData().EvolvingTraitsWorld;
        local smokerModData = modData.SmokeSystem; -- SmokingAddiction MinutesSinceLastSmoke
        local timeSinceLastSmoke = character:getTimeSinceLastSmoke() * 60;
        if debug() then print("ETW Logger: timeSinceLastSmoke: "..timeSinceLastSmoke) end
        if debug() then print("ETW Logger: modData.MinutesSinceLastSmoke: "..smokerModData.MinutesSinceLastSmoke) end
        local stress = character:getStats():getStress(); -- stress is 0-1
        local panic = character:getStats():getPanic(); -- 0-100
        local addictionGain = SBvars.SmokingAddictionMultiplier * (1 + stress) * (1 + panic / 100) * 1000 / (math.max(timeSinceLastSmoke, smokerModData.MinutesSinceLastSmoke) + 100);
        if SBvars.AffinitySystem and modData.StartingTraits.Smoker then
            addictionGain = addictionGain * SBvars.AffinitySystemGainMultiplier;
        end
        smokerModData.SmokingAddiction = math.min(SBvars.SmokerCounter * 2, smokerModData.SmokingAddiction + addictionGain);
        if debug() then print("ETW Logger: addictionGain: "..addictionGain) end
        if debug() then print("ETW Logger: modData.SmokingAddiction: "..smokerModData.SmokingAddiction) end
        smokerModData.MinutesSinceLastSmoke = 0;
    end
    
    original_oneat_cigarettes(food, character, percent);
end

This version should work with mod options in client afaik.

#

Because then it won't try accessing EvolvingTraitsWorld.settings from server side.

hollow shadow
#

@dark wedge thoughts on a shield mod?

thick karma
#

@hollow shadow Hey did you ever solve that weird animation issue?

hollow shadow
#

Nope

thick karma
#

Damn, just keeps looping wrong huh?

#

If you zip it to me I can try to take a look locally.

#

Might not get to it immediately, but if you're stuck I can give it a shot

hollow shadow
#

Main issue is that the animation only gets disabled when the gun is unequiped

thick karma
#

So that's the only problem now?

hollow shadow
#

Ye

#

I’m not at home rn so I can’t do anything

thick karma
#

No worries.

hollow shadow
#

Also the code from dhert seems to do nothing

thick karma
#

Hmmm, clearly there is a way unequip is being triggered without firing the right event.

thick karma
#

I would have to try things on my end to make sense of that most likely

#

Maybe in addition to listening for weapon equip / unequips you could try the OnClothingUpdated event. It gets fired right before you unequip stuff in the timed action for unequipping stuff. Alternitively, you could decorate various functions that show up in other situations where your item becomes unequipped in an unusual way, e.g., ISInventoryTransferAction.GetDropItemOffset gets called when you drop an item.

#

If all else fails you could check the player's weapons periodically... Probably wouldn't be terribly time-consuming or noticeable for users, though obv that's not optimal.

thick karma
#

I do some (very light) fancy stuff to get the rate purely because I wanted to let players customize that. Not required.

#

The rate should be a number from 0 - 100 afaik.

#

I'm guessing it represents probability of finding that item each time items get generated in that container on normal loot spawns or something close to that

#

And I think items get rolled 4 times for most containers.

thick karma
dull moss
#

Will in a bit

thick karma
#

Btw... @dull moss

#

As far as I can tell... these:

#

Are not showing here:

#

Sooooo not sure they are useful for your non-debug users

#

But I could be mistaken

#

I have been wrong... many times before.

chrome egret
#

Does anyone know how to access the friendly name of a container? container:getType() returns something decidedly user-unfriendly, but the loot panel when selecting objects uses a friendly name. I'm wondering about how to get ahold of that friendly version.

thick karma
#

@flat cipher Would you mind if I patched these requirements out of your mod?

#

I can send you the code if you are still actively playing / updating mods.

flat cipher
thick karma
#

You can make the numbers relatIve to each other.

#

Such that 25 25 25 25 and 100 100 100 100 do the same thing

flat cipher
#

Yes and you wouldn’t catch someone setting 50 instead of 5

#

And people inputting random numbers

thick karma
#

If they set 50 instead of 5, they would generate far more zombies than they intended, but they wouldn't blackscreen and crash and think they need mod support.

dull moss
thick karma
#

They would just get overwhelmed by way more of that zombie than expected.

flat cipher
#

That’s not true, the number of zombies doesn’t change

thick karma
#

I mean this proportionally.

#

They would experience a higher proportion of zombies in that category.

#

And therefore if they experienced 100 zombies, yes, they would see more of the zombie they overgenerated.

dull moss
#

also

#

your fix seems to be working

#

cheers

thick karma
#

Yay for fewer bugs!

dull moss
#

very Kpog indeed

thick karma
dull moss
#

huh

thick karma
#

I will check more

#

Idk

dull moss
#

It works for me both in debug in without debug mode

thick karma
#

Weird

#

I'll check into it further.

dull moss
#

i'm talking about PZ debug mode

thick karma
#

Me too

dull moss
#

oh

#

ye

#

lel

thick karma
#

You can see the file I'm searching in my screenshot

#

I'm clearly searching console.txt from Zomboid for the right string

#

Just... isn't showing up

dull moss
#

kek

#

weird

thick karma
#

But yeah no worries at all on my end

#

I don't need that feature

#

I am just trying to squash bugs

#

And reduce crashing

#

haha

dull moss
#

bug squasher

thick karma
#

I try

#

Yeah, @flat cipher, ultimately it's a subjective and personal decision whether you would prefer misconfiguration to lead to a crash or an unexpected user experience in-game.

flat cipher
thick karma
#

No pressure, just figured it would be something you would want to fix.

flat cipher
#

It’s not a crash, it’s an error with a message

thick karma
#

So, you may not be seeing issues, but I see many.

flat cipher
#

Why would they come to you?

thick karma
#

It's an instinct many users have

#

Instead of waiting for help from authors.

#

Haha

#

But yeah if this is the outcome you prefer, no worries.

flat cipher
#

I mean, there’s an FAQ and troubleshooting section in the mod description. Silencing the error does not make the root cause go away

thick karma
#

I... figured it was just because you didn't know how to make it stop people from crashing. Clearly I was mistaken.