#mod_development

1 messages · Page 61 of 1

sour island
#

If I start up a community patch idk if I'd include broader tags into that - kind of a tricky thing being vanilla might implement their own soon. I think the less specific the better though. Being you can move gravel/cement/plaster (if I'm not wrong) - I'd probably ditch "solid" and use "empty container" - if it's a container it should be able to hold it. The only caveats would apply for liquids.

#

Another edge case might be something that has holes in it I suppose

#

Is there a term for a solid you can strain or pour?

fast galleon
#

Well solid/liquid/gas containers should be separate?

sour island
#

They should overlap though

#

"container" "canHoldLiquid" "sealable" and maybe another one for gas but I don't know if that would be widely used given the apocalypse

#

With the liquid mixing previewed I kind of hope they're doing away with the "filledWithX" items

#

I feel like having dirt/granular solids remain as items inside containers that can be added onto would serve better

#

I.e. if you put a dirt item inside of a container with another granular item (even more dirt) they mix to add weight.

#

Could even apply an effect on any other items inside

#

That probably goes too far into the pure sandbox realm of things

sour island
#

Same to mugs of water

fast galleon
#

immersive cement mod, mix things for quality cement 😂

sour island
#

Yeah that could be a thing

#

Could also make dyeing clothes not be a massive clusterfuck of items

#

Would be nice to use the liquid overhaul for that

#

Making stuff occur on the fly would go against the recipe system as the established norm tho

#

Hmm maybe we could use the recipe system to work out what can happen in real time - would give players the ability to see what they can do.

#

Two systems in one

#

In any case, I don't plan to expand tags personally - but I do want to slap together a repo for a community patch

#

I have to be efficient with time/energy with my job 😦

#

Can't do all nighters anymore

vast nacelle
#

How do I add a specific amount of bullets to an inventory?
Since bullets have a Count property, AddItem and AddItems add in multiples of the Count property.
Like AddItem gives [5] 9mm Bullets while AddItems(item, num) will give [5 x num] bullets.
But how would I add say [6] bullets?

fast galleon
vast nacelle
#

Thanks

winter thunder
#

If I wanna mess with UI elements, who’d be the best person here to ask ab that?

calm depot
#

ask your question and if someone is interested/bothered to answer, they will

winter thunder
# thick karma Everyone.

Fair- 😂 I saw your name mentioned a lot when I was searching for old UI discussions.

But basically, curious on the limits of UI because I wanna do some goofy stuff with it. Like, would it be possible to make a UI element move on its own? Both as in it being animated or moving around the screen on its own

sour island
#

Yes

winter thunder
#

I am planning on making a bunch of various effects for psychedelics in a mod I’m working on. And I want there to be some weird things that can happen on the screen- so it also messes with the player a little too

#

I’m just very unfamiliar with the UI coding

sour island
#

Are you familiar with the derive stuff for UI? To create new instances?

verbal meadow
winter thunder
sour island
#

For an effect over time you'd need an event like ontick - and a way to reference the UI element

#

You should be able to grab most UI from the elements own 'instance' field

drifting stump
#

Render already runs on every ui tick no need for anything else

winter thunder
#

What would be the most effective way to animate something using that? just have it flip between the different images on tick to mimic the effect?

thick karma
# winter thunder What would be the most effective way to animate something using that? just have ...

If you're talking about animating old Lucy, I would probably consider adding a dozen or so elements (ISPanel elements filled with textures, i.e. pictures) across the screen, make sure they stay in the background so you can still click on everything else (if you want that), and in each box I would loop through variations on the image texture such that the edges move around and the shape swells and shrinks, while still remaining in the same general location on screen and ultimately returning to its original shape periodically. Would make the images mostly transparent to give the feel that what your looking at is itself unstable, rather than having anything substantial that isn't really there be visible.

#

Different psychedelics are different, so, you know, do your "research" (muahaha)

#

When hallucinating stuff doesn't really appear out of nowhere or move to new places... Wood grains seem to wriggle in place e.g., clouds grow and shrink and move

#

It's not like the cartoons

#

You would probably need a lot of images to get the flow rate right

winter thunder
#

Of course haha, the idea is to have a series of different effects. Some just overlays and stuff, others to actually mess with the players a little too.

Depending on the type of psychedelic you take, it will pull different effects at random

#

Not true random- idea is to have a chance for a good trip or a bad one

thick karma
#

Sounds really cool though, I would love to see a compelling psych mod with good effects

#

I would 100% run that mod

winter thunder
#

I’ll post some of our current models from my 3d modeling guy

thick karma
#

The render function of an ISPanel could be used but you might have more predictable results OnTick because some people adjust their UI render rate for performance.

#

I would experiment with different UI refresh rates and see what feels subjectively good

winter thunder
#

I will let you know how it goes! And like I said, if you wanna help with UI or anything just lmk! We have like 3-4 people rn working on different things

drifting stump
#

vanilla does this for fades

thick karma
winter thunder
fast galleon
#

hm, add visual effects that change based on the music for player

thick karma
bronze yoke
#

make sure to accommodate epileptic players

thick karma
bronze yoke
#

you don't want to be the first pz mod to kill someone

thick karma
#

Let players enable via Mod Options maybe

winter thunder
#

And yeah, I don’t think I’d even really wanna do anything super flashy. Just add some interesting ways to mess with the perception of the player. Other drugs have some direct gameplay benefit that players choose to abuse them for- but imo psychedelics should want to be taken because of their effect on the players experience, as opposed to the character. Like- having interesting effects and some goofy things that make them worth taking

thick karma
#

Definitely proper psychedelics should be about the experience and not numerical game mechanics.

winter thunder
#

For sure, though I was thinking of making a lasting effect for taking them. Basically- if you have a good trip, it would function similar to anti-depressants as a lasting protective factor against depression. But if you have a bad trip, it could function as the opposite for some time, causing sadness and stuff

thick karma
#

Still, I imagine adjustments to fear or "unhappyness" [sic] could make sense

winter thunder
#

Nothing super impactful, but representative of the psychological impacts

thick karma
#

👍

winter thunder
#

Yup haha

thick karma
#

I still can't believe they pushed so many variables with the spelling "yness"

#

Jesus whose job was that to check

winter thunder
#

Oh god yeah, iirc there is a typo in the name of one of the traits too

thick karma
#

It's all over the place, I've seen it many places

timber river
#

I wonder if anyone is working on an update or looking to pick up the mod manager mods from noctis... He disappeared in feb2022 (he's russian) (timing, right?) and hasn't been heard from since 😦

bronze yoke
#

i'd patch it if something broke, but it's working fine isn't it?

bronze yoke
#

i remember being interested in adding something to it... but i forgot what it was unhappy

timber river
bronze yoke
#

oooh yeah that might have been it

timber river
#

That's really the main thing it needs. I think Noctis was working on it but ya know.. things

steel mantle
#

I subscribed to. Mod from the workshop but I don’t see the mod in the game?

thick karma
#

Maybe resubscribe or relaunch the game... Or check the end of the Workshop item list because upper and lowercase mod names are sorted separately

dark arch
#

heres a question, would it be helpful if there was a tag system that was instanced to each object?

bronze yoke
#

wouldn't you just use moddata at that point?

dark arch
#

i didn't know that was a thing

bronze yoke
#

mod data is a lua table you can write to attached to a lot of objects, including inventory items

winter thunder
dark arch
bronze yoke
#

yeah, tags exist on the item script, not the inventory item, the related functions just grab them from the script

dark arch
#

but mod data can record changes to an individual item?

bronze yoke
#

you can put anything you want in there

dark arch
#

thats great

bronze yoke
#

most importantly it's saved to the save file

#

well you can't put objects or functions in there, but you really shouldn't need to

winter thunder
#

Item tags can already be unique to the item, like Albion said. So, if you wanted, you could add unique tags to each item

bronze yoke
#

that's not what i meant

winter thunder
#

oh

bronze yoke
#

all items of a type share a script

#

since tags only exist on the script, instances can't have different tags

winter thunder
#

Oh- Like each instance of an item gets a unique identifier- I understand

#

sorry

#

lol

#

Yeah, mod data would probably be your bff for that. Probably some goofy ways you could do it otherwise, but that seems the most straight forward

dark arch
#

well i did have a quick java mod to do it, but thats a much better solution lol

ancient grail
bronze yoke
#

it's for drugs...

ancient grail
bronze yoke
#

i meant in real life U_U

dark arch
winter thunder
winter thunder
ancient grail
ancient grail
#

The overlay stuff is still buggy. I dont know much of ui
Burryaga helped me learn it but i could only go so far . Esp cuz this isnt the project im working on

dark arch
bronze yoke
#

the mod data belongs to the item

#

i.e. InventoryItem:getModData() is a table

dark arch
#

ohh, so like each individual item has its own table?

bronze yoke
#

yeah!

#

there is also global mod data which works mostly similarly, but it's not used nearly as much

dark arch
#

that was going to be my next question, but that clears it up nicely!

bronze yoke
#

people like to complicate moddata, but it's really as simple as a normal lua table

dark arch
#

is there a good tutorial about it? the modding guide only mentions global mod data

bronze yoke
#

you really don't need a tutorial, it's just a table

#

where item is an instance of InventoryItem

local modData = item:getModData()
modData.key = value
dark arch
#

nice

bronze yoke
#

you don't need to do anything special to store it or anything, just grab the table from the item and you're good

winter thunder
heady sparrow
#

Is there a mod that removes the "100% reverse" part of Speed Demon?

thick karma
#

Is there a simple command in vanilla for unequipping things from primary and secondary (i.e. things in your hands)?

heady sparrow
thick karma
#

I meant programmatically.

#

In Lua

vast nacelle
#

Not a single command but this is already pretty condensed
if (self.gun:isTwoHandWeapon() or self.gun:isRequiresEquippedBothHands()) and self.gun == self.character:getSecondaryHandItem() then self.character:setSecondaryHandItem(nil); end self.character:setPrimaryHandItem(nil);

thick karma
vast nacelle
#

Yes, it should be safe

thick karma
#

Lit, will try those commands, tysm

winter thunder
#

@thick karma From what I am seeing, the only two commands are the setSecondaryHandItem() and the setPrimaryHandItem() codes. Those seem to be the only two 'set' options related to equipping something- So yeah, should be set with the example CosmicB gave

#

This is where they are referenced in the javadocs

#

While I am here- Anyone have a good way of decompiling the game for vscode? if that is possible at least- Because I would really like to have access to the suggestions/autocompletion aspects

thick karma
#

This:

ISTimedActionQueue.add(ISUnequipAction:new(getPlayer(), getPlayer():getSecondaryHandItem(), 50));

Fails.

#

So not the right kind of item object getting returned I assume

bronze yoke
#

you can add the vanilla lua as a library but you can't get much more than a spellcheck for java

blazing pagoda
#

Does anyone here know how PZ does stairs, so that I can make custom stairs and ramps?

#

I want to make Villa Savoye in PZ

thick karma
winter thunder
winter thunder
thick karma
#

The set function unequips them instantly instead

#

Not completely unacceptable but not preferred

winter thunder
#

So, is there a reason you dont just call the default unequip action?

#

Like, there is a lua function written out for it under \lua\client\TimedActions

thick karma
#

I just don't know how to call unequip on the returned item when I use getPrimaryHandItem, that's all.

#

I don't know the easiest way to access that context function.

#

I would like to use the timed event if possible, rather than having equipped stuff magically disappear... But magic disappearance is acceptable failing that

winter thunder
#

I see, you are using the ISEquippedAction:new() function

vast nacelle
thick karma
#

Whaaaaa

#

Hmm let me triple check for typos

#

Thanks for finding that

#

ISTimedActionQueue.add(ISUnequipAction:new(getPlayer(), getPlayer():getPrimaryHandItem(), 50))

winter thunder
#

Maybe its down to the method of checking the player

#

if that is for some reason acting weird

thick karma
#

Oh shit I must have had a typo somewhere thanks again Cosmic... worked fine just now

winter thunder
#

wait, in your first test- did you have an item in your primary or secondary hand?

thick karma
#

I THOUGHT I did, but it's possible I misequipped it @winter thunder

#

I was thinking that myself

#

Both*

#

I thought I had it equipped in both hands.

winter thunder
thick karma
#

Clearly something I thought was wrong

winter thunder
#

that might have been the issue

blazing pagoda
#

I don't see where I might modify height or slope

winter thunder
blazing pagoda
#

dang, so no way to make a low slope ramp or a tight switchback stair?

winter thunder
#

But, you could try to make a set of stairs that was natively wider? Otherwise, I dont think the slope is something you can really mess with. You might be able to, but you'd have to fiddle with it- Because I have never seen a staircase that was != 3

blazing pagoda
#

where is StairStyle defined?

#

maybe if its possible to make something like RampStyle...

winter thunder
#

Maybe, but it would likely mean fiddling with the main code- otherwise I dont know if there is a clean way to pull something like this off :(

blazing pagoda
#

dang

#

is there somewhere for feature request? I guess Villa Savoye will have to wait for now...

thick karma
#

Hmmm... so the unequipping is sort of working but has an odd behavior I'm trying to understand if anyone has any brilliant insight... Vanilla Lua tells player to sit on the ground using this command, rather than adding a timed event to the queue:
player:reportEvent("EventSitOnGround");
This does not seem to add anything to any action queues on the Java side, either... Java seems to do this:

       . . . 
       case EventSitOnGround:
          var1.actionContext.reportEvent("EventSitOnGround");
          var2 = true;
          break;
       . . . 

Problem being: no matter when I queue the unequip event, it interrupts the sitting animation... character just sort of plops down into the sitting loop almost instantly, and then begins removing the hand items while sitting on the ground.

I suppose I need to wait for my unequip events to finish before proceeding to trigger the sit command if I want to avoid this behavior, but I'm not sure how... Should I decorate the vanilla unequip event so that when it finishes I trigger the sitting action (in the event that a sitting action triggered the unequip)? Is there an easier way?

patent violet
#

Guys when i create modified gunfighter server settings template on workshop. It downloads it in an infinite loop from workshop. It is unable to finish the download and just spams a short error messsage (Missing installed files) in red.

trail lotus
winter thunder
vast nacelle
# thick karma Hmmm... so the unequipping is sort of working but has an odd behavior I'm trying...

Maybe use addAfter to queue multiple actions.
local step1 = ISApplyBandage:new(self.character, self.character, bandage, bodyPart, true); ISTimedActionQueue.addAfter(self, step1); local step2 = ISApplyBandage:new(self.character, self.character, nil, bodyPart, false); ISTimedActionQueue.addAfter(step1, step2); ISTimedActionQueue.addAfter(step2, ISFSBandageAction:new(self.character, bandage, false));

winter thunder
#

issue is that sitting isnt a timed action, afaiu

#

So the second it comes up, it bricks anything else in the order

bronze yoke
#

yeah, you need to add it to the timed actions or something, it won't just work in the queue

young orchid
trail lotus
#

it was good rp. apparently is was an assassinations' attempt.

vast veldt
#

Before I go too far down the rabbit hole... is there any reason the "AddXPNoMultiplier" function doesn't actually apply the amount of XP supplied. I'm currently calculating how much I actually need to send into the function by applying 1xp, seeing what it really does, then adjusting my inputs... but it feels kinda hacky. Where "delta" is my target change:

        local initial = player:getXp():getXP(perk);
        --Add "1" XP
        player:getXp():AddXPNoMultiplier(perk,1);
        --Measure Adjusted State
        local adjusted = player:getXp():getXP(perk);
        --Calculate Adjustment Factor
        local factor = 1 / (adjusted - initial);

        print("Adding 1 XP to perk gave actual diff" .. adjusted - initial);
        print("Adjustment factor: " .. factor);
        print("Actual Delta: " .. (delta * factor));

        --Add XP
        player:getXp():AddXPNoMultiplier(perk,delta * factor);```
bronze yoke
#

all it does is remove the player's xp multiplier from books

#

it doesn't change the default behaviour in any other way

#

in most cases, it'll give a quarter of the value you put in

vast veldt
#

i.e. So the amount of effect from the players own class etc still applies?

bronze yoke
#

yes, only the book multiplier is affected

#

in the code, it literally just removes the relevant book xp multiplier from your character, calls the normal AddXP, and then adds the multiplier back again

vast veldt
#

Ok. So indeed, I'll need to do what I'm doing in order to arrive at a given target exact amount of XP? (Is there any way to know what amount it will apply without needing to "give one" - i.e. can I get that factor value via a method rather than my "test and see" type approach... which could accidentally given 1 extra XP if my delta is low... although that's super rare and not disastrous, just want to write as cleanly as I can rather than just what works.

winter thunder
#

Couldnt you get the current xp value in a skill, and then set the xp value to (currentValue + yourChange)

bronze yoke
#

it looks like AddXP(perk, amount, true, false, false) will do what you want

vast veldt
# winter thunder Couldnt you get the current xp value in a skill, and then set the xp value to (c...

That's what I'd originally attempted to do, then realised the amount it was arriving at wasn't correct - so if I calculated I wanted 100 xp, had 70xp, so needed to change by +30, I was calling to ask for 30, but it was instead giving anywhere between 10 and sometimes as much as 100 🙂

    local player = getPlayer();
    
    --Calulate Delta
    local delta = tonumber(xp) - player:getXp():getXP(perk);
    
    --Check Delta
    if delta > 0 then```
bronze yoke
vast veldt
bronze yoke
#

yeah

#

specifically the arguments are:
type: the perk
amount: the base amount of xp
callLua: whether to call the AddXP event
doXPBoost: whether to apply xp multipliers (other than strength/fitness protein boost)
remote: if false, send a packet to the server describing the xp change (too annoying to tell what this actually does)

vast veldt
#

For context, my method is essentially doing a "reload perks" operation, so I want it to faithfully replicate the exact XP the player had at the time the snapshot was captured.

#

Testing with the 5 parameter call to AddXP now..

#

Yes, that call tends to fall much closer. I'll check it still plays nice with books etc now

fast galleon
#

I really don't understand why all people who make sit animation force unequip of items. Do they always drop everything in hands in real life?

gilded crescent
#

Is there a way i can blacklist certain items from being called when using something like item:getSubCategory()

vast veldt
bronze yoke
#

you should just revert the protein bonus manually, it's pretty consistent

#

if proteins lie within a certain range, divide by 1.5, otherwise don't

#

oh, specifically: above 50 and below 300, xp is multiplied by 1.5, below -300, xp is multiplied by 0.7

vast veldt
#

Ok cool

#

Finally, is there any way to remove XP?

bronze yoke
#

you can just add negative xp

#

it doesn't look like there's any handling for leveling down though

fast galleon
#

no, you need to call level down yourself

vast veldt
#

But it can be done?

bronze yoke
#

it might be simplest to calculate the resulting xp beforehand and start from level 0

vast veldt
#

Yes, going to Zero and back up is fine

bronze yoke
#

otherwise it'd be annoying to calculate overflow and stuff

winter thunder
#

@vast veldt there is also the get/setTotalXp()

vast veldt
#

Is there any method that does it by perk or do I have to completely flush the player to zero then add all skills back one by one?

winter thunder
#

Look at the methods in that link

bronze yoke
#

totalxp is something else

vast veldt
bronze yoke
#

it's a removed feature from b40

vast veldt
#

Ok. I've got it deducting XP... the "remove level" thing... any clues on that?

winter thunder
bronze yoke
#

it is up to date, the function just still exists

#

notice that it doesn't even take a perk argument

#

i'm unsure if it still tracks what you put into it but it's not used anymore

winter thunder
vast veldt
#

But I do need to do more than just call AddXP with a negative amount - i.e. if that goes below a level, I need to make additional calls to have that take full effect?

winter thunder
#

I personally don’t know

#

Never messed with -xp

vast veldt
#

i.e. I'm at 110xp. Level boundary is 100xp. I apply -20xp. will it remove the level? (Wont' take long to set up and test so will confirm in a min!)

winter thunder
#

But setting levels will work if it doesn’t account for it

bronze yoke
#

it doesn't

winter thunder
bronze yoke
#

there's no handling for level down

winter thunder
#

Oh, rip 🪦

#

Ok

vast veldt
#

No handling and/or no method possible at all?

bronze yoke
#

it would be easiest to calculate the resulting xp, level 0 and add xp

vast veldt
#

Yeah, I have that data... setting up a test now.

bronze yoke
#

otherwise you'd have to remove xp, check how much xp you actually lost, level down, remove more xp, check that they don't need to level down again, etc

#

unless it doesn't cap at zero i suppose

#

it'd still be easier to level 0 first thoug

vast veldt
#

Hmmm... but which call to use to reach level zero. SetXPToLevel doesn't seem to go lower than the next level (i.e. it can level up, but not down?) and setLevel() - not sure which perk if any that applies to (calling it doesn't fail, but it doesn't do anything either).

bronze yoke
#

just use level0()

drifting stump
#

god i still have ptsd dealing with xp

#

you cant avoid some multipliers when adding xp

#
getPlayer():getXp():AddXP(Perks[row.target], row.quantity, true, false, false)

is the best you can do to avoid multipliers but still does not cover all

#

think it was strength

bronze yoke
#

strength and fitness have protein boosts

#

but we discussed how to avoid that already

vast veldt
vast veldt
vast veldt
#

Thanks very much guys, got the add and remove XP code working exactly as expected now, precision results each time 😎

lavish arch
#

Is there a way I can make a book with something already written in a mod?

winter thunder
balmy pike
#

does anyone know if you can alter the player damage modifier that pain uses?

astral dune
#

Anyone know how to draw a marker at a specific spot on the ground? I've been using WorldMarkers.DirectionArrow and WorldMarkers.HomingPoint but they automatically adjust to point to the center of a grid square instead of the specific coords you give them

lavish arch
hollow current
#

Is there a way to detect if a square has sunlight falling on it? Probably not but thought I'd ask anyways

#

Detecting whether a square is Indoors or Outdoors may be way more viable but less efficient I guess. I believe build 42 may have that option with all the dynamic lighting stuff

bronze yoke
#

if indoors or outdoors is just as viable, IsoGridSquare:isOutside()

wet sandal
#

Finally working on my dream mod, and it's coming together nicely.
Huge Todo list remains though 🥴

winter thunder
#

But on literature, you can set info of the custom pages

#

These are the lua for everything related to literature, the get/set custom pages, get/setName, and the ability to edit it can all be tweaked

drifting ore
#

Made a server that's based on silent hill and the mist, highly dense fog that obscures all visibility, reduced zombie counts, all zombies are replaced with sprinters with max speed, and all loot is a 0.05 spawn chance making everything rare. But for some reason I cant share it or make a thread. So I have to play alone :/

rancid panther
#

u can put the settings in a shared folder

drifting stump
#

call the addxp event

buoyant mortar
#

Hi guys. I wanna make a mod that would make some zombies to attack environments randomly. I found a mod that changes zombie's behaviors (random zombies) which is similar to what I want to do. I checked mod's lua file and a little bit confused of what's going on here. Like where all those global variables come from and what's this topmost Lib variable declaration which is assigned to ModName object.

Where can I find some kind of documentation for this kind of things?

merry quail
#

does anyone knows how to make zombie wear my custom clothing? i am looking for someone to help me

ruby urchin
merry quail
ruby urchin
hollow current
kind galleon
#

Is PipeWrench a good alternative to Lua? I've been using TS for a long time, and only really used Lua for building stuff for the Minecraft mod ComputerCraft, so limited experience

#

Or is it just going to introduce more headaches while learning the Zomboid API?

sour island
#

Ive not used TS due to being used to Lua, but they both work off the same principles/API -- if you're more familiar with TS I think it makes more sense to try PipeWrench.

#

Also for direct Lua stuff I'd recommend using PZ libraries and an IDE so you can have auto-complete and lookup. I think PipeWrench hanldes this for you but with TS as the user-end.

#

If I understand correctly it converts the TS into Lua.

sour island
kind galleon
#

Thanks Chuck!

umbral latch
#

What is everybody's must have mod when they start a new playthrough

gilded hawk
sour island
ancient grail
#

anyone here knows how to use OnEquipPrimary() ??
i just want to add moddata to guns as soon as it is held by a player via equipping it

ancient grail
#

so thats why it didnt work

#

lol

lavish arch
balmy pike
# buoyant mortar Hi guys. I wanna make a mod that would make **some** zombies to attack environme...

watch this video if you dont have a clue on how to use lua much more useful than this server and its boundless help it offers to people with funny green plants next to their name -_-

https://youtu.be/ikRcbRHc45k

#

it really helped me with understanding the fundamentals of lua code he also links really good resources you can use for modding in project zomboid

rough grotto
#

does pz support fbx files or only directx

balmy pike
#

on a side note seems you cant change what the pain moodles stats do a.k.a you cant remove the global damage reduction that affects guns?????? nor can you change the damage the player does without recalculating all the damage you can do with a weapon and then adding damage to offset the damage reduction aka compatibility nightmare unless you do it by category which will make guns as a category do more damage... its a hassle so i just ended up removing pain altogether the only other way to remove the pain damage debuff is to remake it by seeing what body part is affected by what affliction then adding "pain" based on the time its been their and then start removing the ability to do things like sleep and add a random chance to trip thats technically equal to 5% and above

bronze yoke
rough grotto
#

so it supports

#

nice

ancient grail
#

U cant do animations with fbx tho. Thats the limitation

ancient grail
balmy pike
#

go on?

ancient grail
#

It doesnt put holes on clothing tho

#

And doesnt consider the armor anymore

balmy pike
#

i thought it might have but i didnt think it was possible

ancient grail
#

Which makes armors for zed only

bronze yoke
#

well of course you can get around hardcoded parts of a system if you rewrite the entire thing

balmy pike
#

is that what the mad lad did?

ancient grail
#

The author uses lots of math . Ive seen their tank mod. Havent actually checked advance trajectory tho. Its just something that a friend modder told me

balmy pike
#

huh

#

i think ill look into it but im pretty sure its only for on hit damage for guns or in this case his bullets? i could see if its affected by player damage modifiers by getting severe pain and then shooting a zed

#

i dont really know what i would be looking for

rough grotto
#

Shouldn't be a problem right?

ancient grail
#

not sure but i dont think theeres fbx models for characters.. try looking at the files for ideas

#

and you might get better luck when you ask your questions over here >>>>> #modeling

#

goodluck

winter thunder
winter thunder
sour island
#

I'm still getting people not finding skill recovery journal's crafting recipe because:

  1. The mod is translated into their language and they are typing "bound journal" in English.

  2. They are expecting the main menu to also add the mod onto an on-going save.

Not sure how to address either issue lol

winter thunder
#

Chuck saw the mention of EHE and immediately started typing lmao 👀

sour island
#

Hm?

winter thunder
#

No it was just funny, you worked in ehe right?

sour island
#

Yeah, Shark worked on the models with Cytts help I think.

#

I mostly do 2D art and programing

winter thunder
#

Haha yeah- I just meant I typed ehe and then immediately saw you start typing haha

#

No worries tho

sour island
#

Some sound design too

#

It's funny, no worries

winter thunder
sour island
#

There's a pinned discussion on the issue. I don't think most people read sadly.

winter thunder
sour island
#

Would be nice to have a pop-up when you've installed mods when loading games but that'd have to be it's own mod or implemented by devs.

vast nacelle
#

Imagine a mod that enabled itself just from being subscribed on the Workshop.
That'd be a bit worrying to be honest. lol

sour island
#

I think the issue with the loaded games is because the mod caters to new users.

sour island
#

Imagine thinking mods are broken cause you're not actually using them. 😅

winter thunder
#

Modders should just collectively make some simple pop up mod that is a mandatory requirement 😂 it just tells people that they have to enable the mods for old saves separately

sour island
#

I think the load screen shouldn't have the mods button behind something else tbh

#

If I recall you have to select "More"

bronze yoke
#

yeah it's pretty well hidden

sour island
#

The mods list should also be profiled like sandbox setups

#

Make it more obvious your changing 1 profile

#

I think mod manager does that pretty well

#

Star is the author for that right?

winter thunder
#

Yeah, would be nice for those to be core features of the game

bronze yoke
#

mod manager isn't star

#

not sure who it is but it's not star

sour island
#

Ah shit, it's Noctis

#

:/

#

He's been MIA last I heard - since the invasion of Ukraine

bronze yoke
#

yeah someone was talking about them the other day

sour island
#

Hopefully it's just a coincidence, or just money troubles, and not anything worse

jagged ingot
#

PipeWrench is generated typings of PZ's API in Typescript. It is generated by in-house transpilers for the Java API and most of the Lua API for PZ.

#

People use it.

sour island
#

Is he around? I tried reaching out

jagged ingot
#

He's too busy IRL to update things. I have access to his repositories for PZPW.

sour island
#

Ah

#

I wanted to know if he'd be on board with using CAPI for a community Lua patch/branch

#

If you have a more direct line, I'd appreciate it

jagged ingot
#

You're a veteran here so I'd think he'd contact you.

drifting stump
#

ive thought multiple times of making a community api

#

theres so much stuff that could be supplied to modders and vanilla fixes/improvements

jagged ingot
#

I'm thinking about a few things, one being UI creation templates.

drifting stump
#

yeah thats one of my major motivations

jagged ingot
#

PipeWrench is literally the same energy as what you're saying.

drifting stump
#

rewrite uis as performant versions and provide more templates

sour island
#

Well we have a platform for it - we have a stand-in account on steam which allows us to update from GitHub actions

jagged ingot
#

I'll need to download an offline copy of the official JDocs for PZ and bake the documentation in with PW.

sour island
#

There was a few APIs in the works but as modders are using their free time to work - things tend to fall through

#

I think starting with a Lua patch for some vanilla "issues" would be a good start

drifting stump
#

yeah not like i had multiple ideas and projects going when i stopped

jagged ingot
#

This is from an old API back in 2016:

sour island
#

That's pretty slick

jagged ingot
#

Custom UI and child element setup.

drifting stump
#

which tbf was a lot because of motivation when the game doesnt let me do what i want

sour island
#

The other issue is Steam's refusal to let co-authors also upload

jagged ingot
#

You can do a lot with the game already.

drifting stump
#

not when you want to have server sided stuff but its all client sided

#

like inventories

#

soon™️

jagged ingot
sour island
#

You can, but alot of people go through the same steps, and reinvent the wheel

#

Hence why some us got together for CAPI

#

Just needs some rethought

drifting stump
#

think that was before i even knew about this game

#

wasnt that like november 2021

drifting ore
#

Anyone knows why my mod doesnt show in the modlist? Here are the files for it, also im subbed to it on steam workshop.

sour island
#

Last time I spoke to Konijima we agreed it probably needs to be separate mods to avoid constant downloads

#

Initially its a giant suite of APIs

jagged ingot
drifting stump
#

could take a modular approach

jagged ingot
#

Server-side Lua NEEDS to be refurbished at some point.

sour island
#

Server side is wildly unwieldy

drifting stump
#

or simply only release updates when a lot of changes have pilled up

sour island
#

Most things are handled via commands, unless the devs added their own transmit

drifting stump
#

commands are fine

jagged ingot
sour island
#

Yeah but it feels off

jagged ingot
#

Shows the meat of having to get around things not populated on the server vs client.

sour island
#

I have to refactor my shops mod soon

drifting stump
#

what bothers me is that i cant have server authority to validate inventories

sour island
#

Right now I have commands sending the entire table of all shops and ivnetories

jagged ingot
#

Your community API seems like a nice idea.

drifting stump
#

also for example zombie kills

#

sure i could have a client send the info that they killed a zombie

sour island
#

Hence I'm hesitant to take it in a slightly different direction

drifting stump
#

but then anyone could send that info and "cheat"

jagged ingot
#

The bane of leading a project is when you have to leave it be.

#

Even PipeWrench stalled out for a minute.

drifting stump
#

one major project is was working on was a crafting menu revamp and a lot of the ui work would be perfect to provide in an api

#

server/client communication would also be a good api for people not familiar with it

jagged ingot
#

I'm about to update my extra commands patch for twitch users to make their own commands in Lua for both single and multiplayer.

jagged ingot
drifting stump
#

wish i had some art skills to design the ui tho

#

am simple programmer monkey

jagged ingot
#

You could even build a texture cache for drawing UI parts as textures, then load them in like a mod does.

drifting stump
#

did you see aiterons atm mod?

jagged ingot
#

Nope.

drifting stump
jagged ingot
#

Oh wait yeah I did.

drifting stump
#

art was by skizot

#

programming by aiteron

jagged ingot
#

Someone tried to commission an extension of this mod on my discord server.

drifting stump
#

and concept of using images for fancy uis by me

jagged ingot
#

It was things like this to extend or other mods that had no radial menu support that people tried commissioning.

kind galleon
jagged ingot
#

I do think that making templates using something like a VSCode extension would greatly help newer modders.

drifting stump
#

radialmenuapi would be nice for a community patch too

jagged ingot
kind galleon
#

Ah right, so nothing crazy at least

jagged ingot
#

I just pushed updates to the PipeWrench repositories for those things. TypeScript 4.9, etc.

sour island
#

I don't suppose either of you are very familiar with GitHub actions?

jagged ingot
#

I'm not. Someone set that up for me.

drifting stump
#

can you use actions to push updates to steam?

sour island
#

I setup the workshop upload piecing together other people's stuff

sour island
drifting stump
#

actually yes i do that for my patch notes

sour island
#

Oh nice, more automation the better

sour island
#

Unfortunately, I got the upload actio right off Google - I'm hoping there's a way to setup a new mod entirely

drifting stump
#

shows all changes from one tag to the other

sour island
#

That'd help alleviate the "1 man" issue with steam workshop

#

One of the caveats, and reason for the dummy account, is the upload requires no 2FA or a hacky worksround

#

Maybe one day Steam will let co-authors upload

#

First request was made in like 2015 tho

faint jewel
#

i made that ui for the atm lol.

drifting ore
#

Can somebody help me with uploading my mod to steam workshop please? It only uploads preview file, but not the script files

drifting stump
#

can you show the file tree

drifting ore
drifting stump
#

looks fine to me

#

and you say its not uploading everything to the workshop?

drifting ore
#

yes, its only uploading the preview picture

#

this one

drifting stump
#

i see everything

nimble spoke
winter thunder
#

I do think it would be cool to effectively pull PZ modders together somehow, since individually each person can only accomplish so much. But the size, scope, and capabilities of mods would increase drastically with even just a few people working together

winter thunder
#

👀 bet

jagged ingot
#

bet.

drifting ore
jagged ingot
#

A group of people requires focus and guiderails.

winter thunder
#

Like, personally- it was incredible how quickly the scope of what I could do changed when I went from solo to just working with a friend that does 3d modeling

sour island
#

I'd like to sit down and have it only update small changes - I figure I need to have the path of the table sent over with the new value

winter thunder
#

And I’m a just simple minded code monkey, still learning the limits and potential of lua

An actual group of people working on different projects would lead to some incredible mods imho

jagged ingot
#

Heheh.. and you can use Typescript to scale it.

sour island
#

I can attest at least four people can do some fun stuff 👍

winter thunder
# jagged ingot A group of people requires focus and guiderails.

Any idea on how you’d go about promoting individual/group creativity and projects- while still maintaining the collective focus on productivity?

That’s something I’ve thought ab a lot, since different people will have different big ideas they wanna work on

jagged ingot
#

There needs to be a process for testing and deployment.

#

Basic IT stuff.

sour island
#

Yeah, when we had a few people under CAPI we had to sit down and figure out a cohesive style

#

I voted to drop ;

jagged ingot
#

Make choices for the project that eliminates subjective code decisions from people who shouldn't worry about that problem.

nimble spoke
jagged ingot
#

Typescript + Prettier.

drifting stump
#

i vote drop ; and ban globals

jagged ingot
#

That right there eliminates most of the issues I see initially with group projects.

jagged ingot
#

If you use Lua then force modules.

sour island
#

That was already done in CAPI lol

jagged ingot
#

Refuse global poisoning.

winter thunder
sour island
#

What's a character one could use to ensure their mod loads first?

jagged ingot
sour island
#

I found out you can use Chinese characters in your modID to ensure it loads last. Doesn't render on the UI either unless you're Chinese

jagged ingot
#

Getting proper loading for PipeWrench mods was hell but we found a solution for that.

sour island
#

I don't know why there isn't a priority system

jagged ingot
#

Ended up doing post-generation Lua injection.

sour island
#

By number or string

sour island
#

Ideally the patch wouldn't cause any issues

tardy wren
#

IS it even possible to add new moodles?

winter thunder
tardy wren
#

I see

sour island
winter thunder
#

On the workshop

tardy wren
#

Then I shall make my mod extensible based on that

#

For loop it is

jagged ingot
#

The bottom block basically.

#

post-load reference reassignment saved the day.

#

Load order is scary in PZ.

#

That's generated Lua from TypescriptToLua.

sour island
#

So this ensures sledgehammer is loaded first?

#

I don't seem to know what's happening lol

jagged ingot
drifting stump
#

was about lua modules

drifting stump
#

and !! for even higher priority

sour island
#

!!!it is lol

#

Does any punctuation work?

#

I assume it works off Unicode?

drifting stump
#

its ascii order

sour island
#

Ah

jagged ingot
#

Which isn't realistic.

winter thunder
drifting stump
#

well i had to force early load to ensure it didnt override any mod hooking into radials

jagged ingot
#

When everything is contained as a Lua module, things suddenly work nicely.

#

I'm surprised that the vanilla Lua codebase doesn't take advantage of modules.

sour island
#

Most of it is pretty old from what I've seen

jagged ingot
#

Well that's the thing, it could've been done then as well. Modules in Lua isn't new.

sour island
#

Turbos' Lua is really nice though - in terms of being able to manipulate it.

sour island
jagged ingot
#

I believe things like ISUI would've strongly benefited from this approach. 🙂

sour island
#

The UI is notoriously bad at, at the very least returning elements one would want to change

#

Alot of it could use refactoring

#

I'll see about setting up a repo under CAPIs upload action

#

Would be a nice way for people to break their teeth on Lua and github

tardy wren
#

Waht's the moodle type MAX?

sour island
#

That's the index MAX

tardy wren
#

oh, so final index?

sour island
#

Yes, you don't really need to worry about it

tardy wren
#

okay

#

Any way I can get how many levels a moodle has?

drifting stump
#

i actually like the way the ui works atm because it lets you do pretty much anything youd want

tardy wren
#

Oh, it's all from 0 to 4

winter thunder
#

All moodles-

#

Oh yeah

#

Lol

drifting stump
#

but the vanilla code is really meh

tardy wren
#

yeh, sorry

#

I should be going to bed, I am not thinking straight putting a for loop in OnPlayerUpdate

#

But I want this extensible dammit

sour island
#

But there's a few times I've had to pull on stuff after they've been rendered to do what I needed

#

Ex: tooltips

#

Other times I've had to overwrite entire functions cause I need to change something in the middle

#

The context menu function is bonkers too

#

Massive if chain

drifting stump
#

as is touching tooltip rendering should be a no go

#

i have trauma reading the context menu

sour island
#

There's some good technique with some of the individual if statements -- calling on other functions to handle logic and returned options

drifting stump
#

and the inventory panels

#

shivers

winter thunder
#

Just bc I’m pretty new to LUA- using lua modules for mods would mean you could basically have a single file work as your library for all your functions- and then reference that in your code a lot cleaner/more efficiently?

Basically like- if you have something you plan on using a lot, instead of writing it every single time, add it to a module and reference that instead?

sour island
#

Avoids cluttering the global table, and same name issues

#

The second issue is not common but happened to me twice

winter thunder
sour island
#

The arbitrarily long name doesn't have to be arbitrarily long, but yes

#

That file should be

local API = {}
function API.foo()
return API
winter thunder
#

Gotcha- that’s really cool. I’m going to have to fiddle with that. Do you know any mods that use it that I could check under the hood at?

jagged ingot
#

This is the generated module table.

sour island
jagged ingot
#

@sour island , Making a VSCode template extension seems more and more needed.

vast nacelle
#

Can you add variables to a module? Or is it just functions?
Like is "MyModule.MyTable = { A, B, C }" valid?

quasi kernel
#

If my understanding of lua is correct you should be able to assign variables.

jagged ingot
#

When you require a module, you get the code.

#

It isn't read-only.

#

It returns the table you export.

sour island
#

Yeah, you can make changes as needed - the point of exporting is to make it more like a package and in use as needed rather than always available

#

Although you could export into a global if you wanted to be that way

drifting stump
#

or largest of brains

#

localize global with the requirements you will use

jagged ingot
#

_G['blah']

#

It's fun knowing how Kahlua isn't real Lua and has funny ways of handling calls in different ways.

drifting stump
#
local _G = {print = print}

print("giga brain")
jagged ingot
#

Ok buddy.. slow down.

#

Hahah

#

We don't want anyone to get hurt..

frank rivet
#

Icon = default, does anyone know where I can find the default. png associated with this line? if there even is one.

jagged ingot
frank rivet
#

I guess it would have to.

jagged ingot
#

I mean it does.. It's a question of if it's in a texture pack or a raw image file in the media folder.

frank rivet
#

Okay thanks. I searched high and low in the media folder. I will check the tiles.

jagged ingot
#

Steam\steamapps\common\ProjectZomboid\media\texturepacks

#

There's an unpacker / packer somewhere on the Internet for these files.

frank rivet
#

TileZed has a tool to open packs. I didn't know if anyone knew specifically where it was.

viral karma
#

Anyone here know about debugging sound emitters?
I'm working on a Walkman for True Music. I have it more or less working, but ran into a blocker.

So to start, it pretty much functions like the Boombox, but as a separate (smaller) item.
I added some functionality to attach the walkman to a belt, and hooked into the UI update function to stop closing the UI when it is not equipped (but attached to the belt).
The problem is that if the walkman is only attached, the sound emitter never starts playing.
With the Walkman equipped as a Secondary item, it plays as expected. When attached to the belt, it shows it's playing but the sound emitter never starts playing. The playSound command is issued; tracing the Lua scripts (and print statements on every emitter call I found) show that both equipped and attached items follow the same code path.
Likewise, when unequipping the walkman from the hands (leaving it attached to the belt), the UI stays open, no stopMusic commands are triggered, but the music emitter stops (it's still marked as playing).

When looking at the DeviceData of just the attached walkman after pressing play, the emitter is reset to nil... I have a hunch this happens in the Java code (or maybe fmod?), but I have no clue.

trail lotus
frank rivet
#

Does anyone here know if its possible for a moveable to have 2 states? One being moveable and equip able, and another a container. The only thing that seems to have a similar thing is the generator. It can act as a 2d tile thats functionable. But it can also be equipped then replaced as a moveable. Hope that makes sense.

robust briar
fast galleon
#

the generator is neither a moveable nor a container 🤔

tranquil hawk
#

any mods that add a comically large spoon as a long blunt weapon

hot patrol
sour island
#

Anyone know if there's a collection of these in higher quality?

#

This is off the wiki and it's pretty scuffed

dull moss
#

hey, how does one store mod data for players and then uses it? For example, I want to have a variable storing integer attached to each player (in case its multiplayer)

#

saw something like ModData or something

#

somewhere

worldly olive
#

player:getModData().nameOfTheModData

dull moss
#

cheers, will dig around that

worldly olive
#

if player:getModData().DTKillscheck2 == nil then
player:getModData().DTKillscheck2 = 0;
end

#

Same syntax, you can use it as assignments and comparisons

dull moss
#

cool, ty

sour island
#

player:getModData() returns a Lua table - do with it what you will

#

If you plan to have more than a few variables I'd suggest nesting it

#

player:getModData().myModsStuff = {}
player:getModData().myModsStuff.var1 = 1

dull moss
#

Any specific reason?

worldly olive
#

Oh yeah, the table, you can use it, in case you don't use it, make sure the moddataname you assign has any kind of identifier for your mod to not override other value from another mod

dull moss
#

Makes sense

fast galleon
sour island
dull moss
#

anyone knows if it's possible to make sanbox options grouped like this:

#

but obv for mods

#

oh to clarify I was thinking of putting multiple of those on same page so idk if it's even possible

fast galleon
#

UI is done with Lua so anything is possible.

dull moss
#

Nice, got an example of a mod that does that?

quasi kernel
#

Matches are renewable in Zomboid right?

sour island
# dull moss <:Fridge:961673708278267994>

I looked into that, and I think it's sort of unique to the vanilla options -- then again the documents provided for custom sandbox were very very slim and the example use provided didn't include a group option.

#

This is all to say, you'll have to do the fading on your own - but you'll also have to handle the disable/enable logic too

dull moss
#

i dont't really care about fading or locking options

#

I was just looking for a way to nicely group options

sour island
#

Welcome to PZ modding where half the battle is deciding how much of the vanilla stuff can be used or if you should just do it yourself lol

#

Oh if it's just visuals that's much easier

#

When you make custom sandbox options you can decide what page it goes into

dull moss
#

Yea

sour island
#

Unless you mean something else?

dull moss
#

I know that one

sour island
#

Like to space them out a bit?

dull moss
#

kinda

sour island
#

You could try adding /n after the name

#

Not sure if that'd work

dull moss
#

I was hoping for a bit more graphical option, like a line or something but oh well sadge

sour island
#

Otherwise you'll have to rip apart the UI

quasi kernel
#

I have my doubts but with how Zomboid is you never know until you try.

sour island
#

And if you can't catch instances you'll have to overwrite the vanilla function - which is kind of fine for this I imagine

dull moss
sour island
#

UI isn't as bad as it seems, just a bit tedious to test if you can't reload what you need to test

#

This is one of the reasons I wrote easychuckconfig

#

I kind of like things to look a certain way in spacing

#

UI doesnt have the one I need 😦

brittle mesa
#

Hi all, don't suppose anyone knows of a mod that will let me track the total zombie count remaining on the map?

dull moss
#

I don't think zombies even spawn in cells you haven't been close/into

brittle mesa
#

I think it's still track3ed, since they migrate from nearby cells

dull moss
#

idk though

brittle mesa
#

(thats one of the settings when configuring new games)

#

so its definitely tracked

#

was jsut wondering if there was a mod that highlighted it

#

for a no respawn playthrough im working on

#

seems like it would be fun to track progress that way

fast galleon
#

there's double spiffosurvivor in uipack2 but it's smaller then the other spiffos

sour island
#

I used the wiki's UI pack dump

#

I didn't see it but maybe there's another page for pack 2

dull moss
sour island
#

you might need to verify/validate MTD first

#

player:getModData().MTD = player:getModData().MTD or {}

dull moss
#

elaborate pls

#

ah

#

I assume somewhere outside? Or can it be inside function

sour island
#

uh depends on how many times it's called but it's a pretty minor action

dull moss
#

every hours

#

so doesn't matter

sour island
#

I'm not an expert on minute Lua stuff - but defining a variable or making an empty table would I assume to be tiny overhead

#

yeah that should be fine

#
function MTDEveryHoursMain(player)
    MTDWeightChanges(player);
end

function MTDWeightChanges(player)
    player:getModData().MTD = player:getModData().MTD or {}
    if player:getModData().MTD.WeightMaintainedDays == nil then
        player:getModData().MTD.WeightMaintainedDays = 0;
    end
        // some code here
end
dull moss
sour island
#

depending on what you need this to do you might be able to ditch the if

dull moss
#

checking if player maintains his weight within set limits for multiple days

sour island
#
function MTDEveryHoursMain(player)
    MTDWeightChanges(player);
end

function MTDWeightChanges(player)
    player:getModData().MTD = player:getModData().MTD or {}
    local MTD = player:getModData().MTD
    MTD.WeightMaintainedDays = MTD.WeightMaintainedDays or 0
    // some code here
end
#

purely aesthetic choices here

dull moss
#

I see, thanks

sour island
#

@dull moss I'd also probably change MTD to be alot more explicit

dull moss
#

smort

sour island
#

That's where you do want to be a bit more paranoid

#

you can use local MTD = to shorthand the rest

#
function getOrSetMusicManTastyDogs(player)
    player:getModData().MusicManTastyDogs = player:getModData().MusicManTastyDogs or {}
    local MTD = player:getModData().MusicManTastyDogs
    MTD.WeightMaintainedDays = MTD.WeightMaintainedDays or 0
    return MTD
end
dull moss
#

do I use zombie.characters.BodyDamage.Nutrition.GetWeight() to get char weight? PepeThink

sour island
#

let me check

#

isoplayer:getNutrition() works

#

:getWeight() after that

dull moss
#

so isoplayer:getNutrition():getWeight()

sour island
#

very odd, though, as Nutrition is .BodyDamage.Nutrition

dull moss
#

is weight tracked in double/float or int, out of curiosity

sour island
#

double

#

in Lua it doesn't really matter

dull moss
#

oh

#

right

#

forgot about that

dull moss
#

yea u sure about your table stuff? @sour island

ERROR: General     , 1670943687240> DebugLogStream.printException> Stack trace:
java.lang.RuntimeException: attempted index: getModData of non-table: null```
#

player:getModData().MoreTraitsDynamic = player:getModData().MoreTraitsDynamic or {}

#

^ line that throws error

#

or did I fuck something up

sour island
#

where is player being defined?

dull moss
#

ah

#

dented moment

#

Ok I'd need some help here

dull moss
fleet ore
#

where can i find the file that picks the clothing items for an outfit for zeds?

#

rlly new to pz modding here

sour island
#

I'm not sure how getPlayer works on co-op, and I know you can getSpecificPlayer() but again, wouldn't be able to tell you how to identify which player is doing what

#

co-op being couch-co-op

dull moss
#

u mean split-screen? don't care about that 😄

sour island
#

yeah it's rough having to account for all that

dull moss
#

so player = getPlayer(); ?

#

oh i can jsut use getplayer

sour island
#

yes, IF the code is in /client/ you should only have 1

dull moss
#

instead of making var

#

right

sour island
#

yeah

#
function getOrSetMusicManTastyDogs(player)
    player = player or getPlayer()
    player:getModData().MusicManTastyDogs = player:getModData().MusicManTastyDogs or {}
    local MTD = player:getModData().MusicManTastyDogs
    MTD.WeightMaintainedDays = MTD.WeightMaintainedDays or 0
    return MTD
end
dull moss
#

right i even used it before

#

dumbass

sour island
#

If you need to keep the argument as an option for whatever reason

dull moss
#

pepega moment

sour island
#

otherwise local player = getPlayer() is fine

dull moss
#

hmm

#

now it doesn't like isoplayer:getNutrition():getWeight()

#

ERROR: General , 1670944512960> ExceptionLogger.logException> Exception thrown java.lang.RuntimeException: attempted index: getNutrition of non-table: null at KahluaThread.tableget line:1689.

#

wait should it be getPlayer() instead of isoplayer?

sour island
#

should be player

#

not isoplayer

dull moss
#

another certified pepega moment

sour island
#
local player = getPlayer()
local MTD = getOrSetMusicManTastyDogs(player)
local nut = player:getNutrition()
dull moss
#

pog it works

sour island
#

👍

dull moss
#

ty

sour island
#

np

fast galleon
#

hm, random ideas...
press q to trigger Negan whistle sound instead of plain "Hey You" text

sour island
#

@iron salmon sorry for the ping, I remember a while back you shared higher res images of the spiffo art - I tried looking through discord messages using search and can't find it. 🙏 Any chance you can link that again?

#

Survivor2 is in media, but this one isn't

winter viper
#

Question. Where can I ask about commissions?

fast galleon
#

hm glytch3r already has custom shouts, wonder if I can scavenge that whistle from somewhere and also a "get over here" would fit nice.

wet dune
#

How do I add custom models as playermodels?

dull moss
#

@sour island can i put initializing mod data somwhere in other function instead of calling it every 10 min? cuz I now need it for every weapon hit and i thought it'd be nice if i dont have to do

player:getModData().MoreTraitsDynamic = player:getModData().MoreTraitsDynamic or {};
player:getModData().MoreTraitsDynamic.AllowLeadFootCount = player:getModData().MoreTraitsDynamic.AllowLeadFootCount or false

every time character hits someone

#

for example, on game load

#

like somewhere here

function MTDInitializeEvents(player)
    if getActivatedMods():contains("ToadTraitsDynamic") then
        Events.LevelPerk.Add(MTDLevelPerkMain);
        Events.EveryHours.Add(MTDEveryHoursMain);
        Events.OnZombieDead.Add(MTDKillsMain);
        Events.OnWeaponHitCharacter.Add(MTDAdditionalMain)
    end
end

its my function that starts the whole thing rolling

lavish arch
#

Does anyone know how I find the settings to add to a medical item?

sour island
#

you can also add ifs to getOrSet to apply it if it isn't there already but then you might as well leave it as is

#

you can also initilize it onCreatePlayer

dull moss
#

question: if i define it in some other function, it'll still store data for separate players? sorry not sure how all this thing works 😄

sour island
#

that'd actually solve co-op issues as onCreatePlayer has the isoPlayer as an argument

#

every object has it's own modData

fast galleon
#

make a table on top out of function

dull moss
#

don't i need player for all of that?

#

sorry for 5 iq questions

sour island
#

for initializing the tables?

fast galleon
#

I am thinking if it's safe to use IsoPlayer as key or better to use the 1 to 4 number

dull moss
sour island
#

you do need the player - modData is per object/player

#

it's not shared

dull moss
#

cuz it's getPlayer() everywhere

sour island
#

getPlayer returns the local player

fast galleon
#

but anyway random local var on top and on createplayer add the data there

sour island
#
LuaEventManager.triggerEvent("OnCreatePlayer", this.player.PlayerIndex, this.player)
#
  player:getModData().MoreTraitsDynamic = player:getModData().MoreTraitsDynamic or {}
  player:getModData().MoreTraitsDynamic.AllowLeadFootCount = player:getModData().MoreTraitsDynamic.AllowLeadFootCount or false
end

Events.OnCreatePlayer.Add(initMTD)```
sour island
#

that's the java call, don't put that in anywhere

#

just wanted to show the arguments

dull moss
#

ah

#

so If i init moddata for players at create player in a way you showed then I don't have to do checks mid-functions, right?

sour island
#

nope

#

but you'll have to be more careful for adding values to it I suppose

#

like lead foot as an example

#

if you don't init it and try to call on it - you'll have an error

dull moss
#

got it

#

aka make sure to add stuff in there if i wanna use it KekW

sour island
#

I tend to lean more on the "be able to remove a module with 1 file/point" philosophy when I can

dull moss
#

I mean

#

I agree

#

But I thought maybe not doing all of that on every weapon hit would be smarter

#

idk

sour island
#

I can check runtimes

dull moss
#

I doubt it's any noticeable performance impact

#

Just think it's a nice practice

sour island
#

Might be doing something wrong but the test on lua.org shows 0 use time lol

#

Well yeah, it looks less mangled if you're not calling on it

#

that's why I suggested the getOrSet

dull moss
#

Yea I like it

sour island
#

local leadFoot = getMTD().leadFoot

#

leave the backend stuff in the getter to make sure it's set + avoid having to type player:getModData().leadFoot

dull moss
#

yea but i need to change it

#

i cant just change leadfoot

#

i have to call getmoddata anyway

sour island
#

you can store the modData as a local too if you need to change other things

#
local MTD = getOrSetMTD()
if MTD.leadFoot == true then foo() end
#

Unless I'm misundestanding

#

also don't know if it helps but I tend to store repeated calls as a local and just lean on that in the function

#

I can't even test the timings with out triggering the autostop on inifinite loops

#

ran both methods a million times to even hit 1ms on 1

#

so go with whatever looks nicer

gilded hawk
#

Also, about moddata, is writing and reading the global moddata slow when you do it server side? 🤔

sour island
#

But I did consider repeated calls for the same object/value was probably not the best

gilded hawk
#

Okay I understand, thank you

#

I'm still wondering if there is a way to test how slow or fast is square:getModData() vs using ModData.getOrCreate()

Because I need to run a script when LoadGridsquare is triggered and I need to keep it a smooth as possible to avoid stuttering

#

I need to set a boolan flag to mark that that specific square has been checked

#

I also need to persist the list of squares that have been checked so that it does not happen again for the next server restart and ModData.getOrCreate() seems the best option

bronze yoke
#

using global mod data would likely be much faster, as you only need to make one java call instead of thousands

#

projectrp does something kind of similar where it stores coordinates in a global moddata and it seems to run fine (well it would have if it didn't originally rebuild the entire database every time you made a single change to it U_U)

gilded hawk
#

So, I could use the global moddata to store the list of squares, and update it the global when I find a square that need to marked as checked.

Also, if I'm using global moddata only on the server, I would not need to trasmit it right?

bronze yoke
#

you would not

gilded hawk
#

Okay sounds good, thank you.

#

I'll see what I can do, but first, I need to convert my code from JS to Lua pain

drifting stump
#

could store it as a bidimentional array in global mod data

#

where each dimention is x and y

sour island
#

loadSquare is super gnarly as is

#

EHE has a loadSquare check for spawning stuff in unloaded cells - basically stores the event until the area is loaded

#

reminds me I should check if that's optimized the best it can be

#

yeah right now it loops through the 'pendingSpawn' list - I was going to see if keying the X/Ys would be faster
nvm, looks like I did make the changes, the loop is just for the items for the selected x/y

faint jewel
#

anyone have a snippet of how to tell the distance between a player and a sprite?

sour island
#

wouldn't grabbing the xyz of each work?

dull moss
#

Need a bit of help here, I'm trying to calculate amount of kills made by crushing zombies on ground. I got following function that executes on Events.OnWeaponHitCharacter

function MTDLeadFootToggle(actor, target, weapon, ___)
    player = getPlayer();
    player:getModData().MoreTraitsDynamic = player:getModData().MoreTraitsDynamic or {};
    player:getModData().MoreTraitsDynamic.AllowLeadFootCount = player:getModData().MoreTraitsDynamic.AllowLeadFootCount or false;
    print("In LeadFootToggle 1");
    if actor == getPlayer() and target:isZombie() then
        print("In LeadFootToggle 2");
        if weapon == "BareHands" and target:isProne() then
            getPlayer():getModData().MoreTraitsDynamic.AllowLeadFootCount = true;
        else
            getPlayer():getModData().MoreTraitsDynamic.AllowLeadFootCount = false;
        end
    end
end

This I can't seem to reach 2nd point, anyone got idea?

sour island
#

try making print("In LeadFootToggle 1") to print("In LeadFootToggle 1 actor="..type(actor).." targetBZ="..tostring(target:isZombie()))

#

also actor == player would save the extra call

dull moss
#

oh ye

sour island
#

Why not just use actor from the start?

dull moss
#

cuz i copypasted stuff, was testing if it generally works

#

was planning to do tidying up after

sour island
#

fair enough

void fractal
#

what are all the sandbox option types?

sour island
#

Should be same as vanilla

dull moss
sour island
#

Boolean, String, Enum, Integer, Double afaik

void fractal
#

ah

#

thanks

sour island
#
   private CustomSandboxOption parseOption(ScriptParser.Block var1) {``` ```java
            switch(var4) {
            case 0:
               return CustomBooleanSandboxOption.parse(var1);
            case 1:
               return CustomDoubleSandboxOption.parse(var1);
            case 2:
               return CustomEnumSandboxOption.parse(var1);
            case 3:
               return CustomIntegerSandboxOption.parse(var1);
            case 4:
               return CustomStringSandboxOption.parse(var1);
            default:
               DebugLog.General.warn("unknown option type \"%s\"", var2.getValue().trim());
               return null;
#

just to confirm

void fractal
#

ah

#

epic

fast galleon
#

just made this, lol
will change way of selecting sounds in case more people want to add other sounds, probably tweak volume. Haven't tried yet with multiple shouts...

ancient grail
#

ow shit

#

im reading past convo about animations and time actions and saw that lol

fast galleon
#

@ancient grail
will you be making any changes to audible shout?

#

if you are, can you save available sound somewhere, like ISPlayerData?

humble oriole
#

Is there a way to remove a vanilla recipe without overwriting the whole file?

ancient grail
#

i i kept forgetting to add the freefor all tag for my mods

humble oriole
#

lol

ancient grail
#

i though you needed to overwrite lua. i posted a link.. but then i read again says recipe .. then i have no idea... lol
try? getTeachedRecipes

#

i think i asked this before... maybe albion knows

#

or maybe you can modify it via scriptmanager doparam and sett its ontest to false

#
function Recipe.OnTest.RemoveThisRecipe()
return false;
end
humble oriole
#

Well, it’s the vanilla Gather Gunpowder recipie. I could delete it by overwriting the recipes.txt but I REALLY hate doing that.

weak sierra
#

i wrote a thing that does it

#

ur supposed to be able to just reimplement it with obsolete:true added

#

but i found that didn't work

#

heh

#

anyway

#

u just need to set the OnPerform to be something like glytch3r suggested

#

and set it to hidden

#

hidden will make it not show in the crafting window

#

and onperform returning false will make it not show in the context menus/etc.

#

the thing i wrote programmatically does this for all of the recipes in a list and iterates through all recipes

#

allowing it to act on ones that have duplicate names properly

#

if u can get the base game functions for obsolete and such to work though that's preferable

ancient grail
#

whats the diffrence with on test and on perform?

#

test has something to do with item properties?

sour island
#

onTest is a valid checker

#

runs every tick like update as well as before start

#

If im not getting them mixed up

#

onPerform is when it's done

#

there's one more lua function but it escapes me

vast nacelle
#

OnCreate?

sour island
#

yeah that's the one

ancient grail
#

is it possible to assign oncreate and on_eat?

#

just being curious

sour island
#

you can assign 3 types of functions in recipes

#

I think eating is a timed action but you should be able to inject into it

sour island
#

Anyone run into issues with oncreateplayer in MP not using the actual isoPlayer?

willow estuary
#

Cigarettes are an example of a food item that uses a lua function when eaten.

#

And yes, multiple vanilla items have OnCreate functions.

frank rivet
frank rivet
sour island
#

I forgot about OnEat being an item's lua function

#

there might be an OnUse maybe

dull moss
#

Yo, Chuck, did you see my reply by any chance?

#

To your print

sour island
#

uh, no

#

working on a commission + irl stuff

ancient grail
sour island
#

The methods above are the most thorough lol

#

Obsolete doesnt work cause multiple recipes are allowed to have the same name

ancient grail
#

ye thats what i was thinking

sour island
#

Something that will hopefully be addressed one day

willow estuary
#

Oh I don't know, I'm doing 23784632877 things at once right now TBH?
Just peeped the channel and realized people don't know about OnEat and OnCreate.

ancient grail
#

no we wre discussing about removing recipe

sour island
young coral
#

Quick question on vehicles: Does "playerDamageProtection" prevent injuries with a higher number, or increase injuries with a higher number? Because the name suggests the former, but I just tested a few things and it looks like its actually INCREASING injury severity when it is set higher?

brittle mesa
#

anyone know a good mod that has examples of working with IsoWorld values?

bronze yoke
young coral
#

Excellent, ty!

balmy pike
#

how would you make a command wait? for instance if you swung a axe and all zombies die in a 4 foot radius how would you make that code have a delay of 5 seconds

wet gorge
#

Any idea if it's easily possible to give custom gear based on spawn point?

#

Like starting profession loadout but for only a specific spawn point location.

frank rivet
#

Anyone in hear willing to help me with lua experience. I need an OnCreate function wrote up for a mod I'm making. But ya boy don't know anything about lua. Just a little bit of scripting in regards to some mods.

brittle mesa
#

getPlayer():getCell():getZombieList():size(); that should get me the number of zombies in the players current cell right? there's nothing wrong with the syntax?

bronze yoke
#

yeah

brittle mesa
#

if there are no zombies nearby, list doesn't exist or list would be size 0?

#

hrmmm, that doesnt seem to be the issue either

#

figured it out, had to cast the value back to a string'

#

Python has made me lazy lol

balmy pike
#

psiber do you know a way to delay code like wait()?

brittle mesa
#

I'd make an update loop that ticks down a value

balmy pike
#

how would i go about that?

brittle mesa
#

no idea 🙂 I started modding PZ about an hour ago lol

balmy pike
#

well shit

brittle mesa
#

gl with it, back to work for me 🙂

#

very pseudocode:

-- track the time when event starts somewhere
startingTime = os.time();

-- in update loop get the current time and compare back to startTime
local cur_time = os.time();
local elapsedTime = os.difftime(cur_time,startingTime);

if elapsedTime > etc etc etc
#

i think playerUpdate can play your loop timer

#

to check inside of

dark arch
#

what does ```ReplaceOnUseOn = WaterSource-WaterBottleFull

nimble spoke
willow estuary
#

Also just straight up scorched earth file overwrites can handle messy file/recipe issues as a last resort.

#

Sometimes I wonder if this whole thing where people try to make their mods play 5D chess with other/every other existing or theoretical mod in existence regarding items and recipes etc is a straight up Hellraiser puzzle cube that engulfs it's victims into eternal torment 😄

#

If I was Pinhead I would say "such sweet suffering" but instead I worry for the sanity and well being of the Don Quixotes that tilt at that windmill stressed

#

As an extreme hyperbolic rhetorical example, if an insane superintelligent dog or AI got access to the internet, and was determined to make every mod work at the same time for their PZ server without error messages or crashes, it is not the mod-makers' responsibility to accommodate that.

bronze yoke
#

i tend to draw the line at 'it would be compatible with other mods if they also wrote their mod with compatibility in mind', but it's often pretty pointless because usually they did not

willow estuary
#

I just see a lot of stress from modders trying to cover all these edge cases and stuff, and... ...I'd suggest looking at alternate approaches than beating your forehead into jelly against a brick wall trying to be all things to all people all told?

#

If you relish the challenge, well, then Crom smiles on you from his throne of iron.
But modding should be an enjoyable hobby, and not an ordeal?

vast nacelle
dark arch
#

ohh, that makes more sense, i was wondering why a full water bottle would have that

#

im making an improvised water bottle mod, because i couldn't find one

undone crag
#

Most enjoyment and lack thereof relating to my mod would be of the people playing it though, so even if it was an ordeal it may be a profit overall, in my opinion no offence no cap (I recently read that the term "no offence" actually means "I entirely intend to offend your sensibilities" but I instead mean it literally fr fr)

sour island
#

Also this isn't for mod compat, it's a vanilla issue 🤷‍♂️

#

overwriting an entire vanilla file of recipes means supplying an probably soon outdated copy as a stand in

willow estuary
#

There is no solution that works in all instances in life.

#

Or doesn't require follow-up.

sour island
#

Never said there was, fortunately here there is a better solution

willow estuary
#

I don't care about the technical specifics of overwriting recipe files so much as I'm saying "People don't have to drive themselves insane or otherwise suffer trying to make their mods work with every other mod is existence" 🙂

ancient grail
willow estuary
#

If they choose to, well that's their choice, but it's a choice and they should know it's a choice and not an obligation.

#

Maybe we need a caveat in the mod uploading interface about end user expectations?