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.
#mod_development
1 messages · Page 61 of 1
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?
Well solid/liquid/gas containers should be separate?
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
To clarify, a bucket wouldn't have a sealable tag - this would make placing it inside of bags problematic.
Same to mugs of water
immersive cement mod, mix things for quality cement 😂
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
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?
you can do it like this
inventory:AddItem(InventoryItemFactory.CreateItem("Base.Screws"))
Thanks
If I wanna mess with UI elements, who’d be the best person here to ask ab that?
ask your question and if someone is interested/bothered to answer, they will
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
Yes
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
Are you familiar with the derive stuff for UI? To create new instances?
can someone help me me please in #mod_support
I understand the basics from Bounty’s UI doc, but not really anything beyond that
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
Render already runs on every ui tick no need for anything else
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?
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
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
Sounds really cool though, I would love to see a compelling psych mod with good effects
I would 100% run that mod
I will be sure to post updates, if you wanna help at all too- have a little mod team working on stuff. Goal is to add a bunch of different drugs under a single mantle- so you don’t need like 10 mods that don’t play together nicely 😂
I’ll post some of our current models from my 3d modeling guy
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
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
just have to adjust speed depending on ui tick rate
regardless if you use ontick ui will still only update at that speed
vanilla does this for fades
I have been super sick and thus a bit behind on a couple updates I'm trying to finish for a handful of my current mods, but I actually might play with possible ways of simulating psychedelic effects down the road if you're gonna be working on this long-term. Probably wouldn't be available for the next week or so realistically.
Fair enough advice
Oh yeah, no worries! We plan on working on this as long as it takes to feel right. Have some big plans, but are taking it one step at a time. Still in the early stages of development. So there is plenty of time
hm, add visual effects that change based on the music for player
Feel free to DM me about this whenever. May be a bit slow to respond sometimes, but I'll respond.
make sure to accommodate epileptic players
I don't know if in-game music could be analyzed in a way that could be incorporated real-time into an image adjustment... But if it could, that would be fly
you don't want to be the first pz mod to kill someone
Yeah probably disable anything too outrageous by default so servers that add the mod don't inadvertently give kids seizures lol
Let players enable via Mod Options maybe
Sounds good 
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
Definitely proper psychedelics should be about the experience and not numerical game mechanics.
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
Still, I imagine adjustments to fear or "unhappyness" [sic] could make sense
Nothing super impactful, but representative of the psychological impacts
👍
Yup haha
I still can't believe they pushed so many variables with the spelling "yness"
Jesus whose job was that to check
Oh god yeah, iirc there is a typo in the name of one of the traits too
It's all over the place, I've seen it many places
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 😦
i'd patch it if something broke, but it's working fine isn't it?
i remember being interested in adding something to it... but i forgot what it was 
yea it currently works, I'd love for someone to take it up and add being able to transfer mod lists between the server presets and the solo presets though. Would make admining servers and testing server mods/settings a little less time consuming
oooh yeah that might have been it
That's really the main thing it needs. I think Noctis was working on it but ya know.. things
I subscribed to. Mod from the workshop but I don’t see the mod in the game?
Maybe resubscribe or relaunch the game... Or check the end of the Workshop item list because upper and lowercase mod names are sorted separately
heres a question, would it be helpful if there was a tag system that was instanced to each object?
wouldn't you just use moddata at that point?
i didn't know that was a thing
mod data is a lua table you can write to attached to a lot of objects, including inventory items
How so? There are currently item tags that already exists for items
I mean tags that can be added to individual objects instead of all objects of the same kind
yeah, tags exist on the item script, not the inventory item, the related functions just grab them from the script
but mod data can record changes to an individual item?
you can put anything you want in there
thats great
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
Item tags can already be unique to the item, like Albion said. So, if you wanted, you could add unique tags to each item
that's not what i meant
oh
all items of a type share a script
since tags only exist on the script, instances can't have different tags
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
well i did have a quick java mod to do it, but thats a much better solution lol
Immersive overlay already exist tho
it's for drugs...
My drugmod has OD and a player from krp died from it i think.
i meant in real life U_U
is it only real drugs or are there beneficial ones like fallout?
And it is more than just overlays. From my understanding the immersive overlays only adds static images based on moodle/character status
Oh! You should post your mod :)
Ow . RIP
It is posted
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
By not being able to put items in there doesn't that get me back to my original question? Can mod data be used to record a change to an item?
ohh, so like each individual item has its own table?
yeah!
there is also global mod data which works mostly similarly, but it's not used nearly as much
that was going to be my next question, but that clears it up nicely!
people like to complicate moddata, but it's really as simple as a normal lua table
is there a good tutorial about it? the modding guide only mentions global mod data
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
nice
you don't need to do anything special to store it or anything, just grab the table from the item and you're good
Oh! That is awesome! Similar in some ways to the stuff we are working on
Is there a mod that removes the "100% reverse" part of Speed Demon?
Is there a simple command in vanilla for unequipping things from primary and secondary (i.e. things in your hands)?
Not sure if there's a specific hotkey, but I usually just fast equip and unequip stuff from my belt.
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);
Oh great... Do you know if I can safely call setPrimary...(nil) and setSecondary...(nil) if nothing is equipped?
Yes, it should be safe
Lit, will try those commands, tysm
@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
declaration: package: zombie.characters, interface: ILuaGameCharacter
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
Definitely works but skips the unequip event... Think I'm gonna try to use this:
ISTimedActionQueue.add(ISUnequipAction:new(playerObj, item, 50));
Just need to figure out how to get the right kind of item object...
This:
ISTimedActionQueue.add(ISUnequipAction:new(getPlayer(), getPlayer():getSecondaryHandItem(), 50));
Fails.
So not the right kind of item object getting returned I assume
vsc doesn't work well with it
you can add the vanilla lua as a library but you can't get much more than a spellcheck for java
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
Just saw this, thanks... Currently trying to get an Item object for use with the event from getPrimaryHandItem().
believe that is through tile properties, you can mess with those in TileZed
So, what are you trying to do with the code? Like, the end goal
Just unequip primary and secondary, but using this @winter thunder
The set function unequips them instantly instead
Not completely unacceptable but not preferred
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
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
I see, you are using the ISEquippedAction:new() function
Strange. The base game code does the exact sort of call you are trying and it works.
Whaaaaa
Hmm let me triple check for typos
Thanks for finding that
ISTimedActionQueue.add(ISUnequipAction:new(getPlayer(), getPlayer():getPrimaryHandItem(), 50))
Maybe its down to the method of checking the player
if that is for some reason acting weird
Oh shit I must have had a typo somewhere thanks again Cosmic... worked fine just now
wait, in your first test- did you have an item in your primary or secondary hand?
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.
because the first code you called checked secondary lol
Clearly something I thought was wrong
that might have been the issue
Looking at stair tiles in tile properties, the only thing related to stairs seems to be this: StairStyle - Top/middle/bottom(N/E/S/W)
I don't see where I might modify height or slope
All stairs are made up of the three layers there, so I dont think you can do anything different with them beyond the 3 layers like that
dang, so no way to make a low slope ramp or a tight switchback stair?
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
where is StairStyle defined?
maybe if its possible to make something like RampStyle...
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 :(
dang
is there somewhere for feature request? I guess Villa Savoye will have to wait for now...
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?
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.
this was the shooting i was talking about last night some one shot up damn school in my server... go figure LOL https://medal.tv/games/project-zomboid/clips/LEEEIcm0Hh0LM/d1337SWMP47I?invite=cr-MSxZem0sMTk5Nzc1NTUs
Watch American classroom and millions of other Project Zomboid videos on Medal, the largest Game Clip Platform.
So, you are trying to unequip the items, and then have the player sit?
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));
issue is that sitting isnt a timed action, afaiu
So the second it comes up, it bricks anything else in the order
yeah, you need to add it to the timed actions or something, it won't just work in the queue
and this is funny? awesome RP or what are trying to say
it was good rp. apparently is was an assassinations' attempt.
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);```
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
i.e. So the amount of effect from the players own class etc still applies?
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
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.
Couldnt you get the current xp value in a skill, and then set the xp value to (currentValue + yourChange)
it looks like AddXP(perk, amount, true, false, false) will do what you want
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```
it won't stop the bonus xp to strength/fitness from protein though
Thanks I'll give this a test... is it the "boolean doXPBoost" being false that's the trick there?
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)
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
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?
Is there a way i can blacklist certain items from being called when using something like item:getSubCategory()
Thanks, this seems quite consistent. I'll leave my adjusting code in to work around the protein bonus but feels safer if most of the time it's not making adjustment calculations.
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
you can just add negative xp
it doesn't look like there's any handling for leveling down though
no, you need to call level down yourself
But it can be done?
it might be simplest to calculate the resulting xp beforehand and start from level 0
Yes, going to Zero and back up is fine
otherwise it'd be annoying to calculate overflow and stuff
@vast veldt there is also the get/setTotalXp()
declaration: package: zombie.characters, class: IsoGameCharacter, class: XP
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?
Look at the methods in that link
totalxp is something else
wow... I completely missed that add would just accept a negative value 😆 . Just didn't assume so from the naming, whoops
it's a removed feature from b40
Ok. I've got it deducting XP... the "remove level" thing... any clues on that?
Oh? I thought the Javadocs were up to date
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
Xp requirements per level are a set, known value. So you can get new xp, the thresholds, and then set the levels accordingly. If you wanna remove 100xp from carp and would go down a level, you can just set the level and current xp accordingly
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?
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!)
But setting levels will work if it doesn’t account for it
it doesn't
Sounds good! Curious myself now
there's no handling for level down
No handling and/or no method possible at all?
it would be easiest to calculate the resulting xp, level 0 and add xp
Yeah, I have that data... setting up a test now.
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
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).
just use level0()
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
Got it, didn't see it there on the IsoPlayer object 🙂
Yep, I have general purpose compensating code, so it'll cope with whatever the game does if it doesn't apply a "1 for 1" XP bonus/malus.
Thanks very much guys, got the add and remove XP code working exactly as expected now, precision results each time 😎
Is there a way I can make a book with something already written in a mod?
Yeah, there is some lua I actually used recently so I could copy the text of existing notes- but it should work the same way for you
does anyone know if you can alter the player damage modifier that pain uses?
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
Could you tell me what is needed?
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
if indoors or outdoors is just as viable, IsoGridSquare:isOutside()
Finally working on my dream mod, and it's coming together nicely.
Huge Todo list remains though 🥴
Shittttttt I’m sorry 😥 I got busy and forgot i had sent you that. My mod is on the workshop, RPDescriptors if you wanna check the basics of the code
But on literature, you can set info of the custom pages
declaration: package: zombie.inventory.types, class: Literature
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
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 :/
u can put the settings in a shared folder
what is the first bool for
call the addxp event
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?
does anyone knows how to make zombie wear my custom clothing? i am looking for someone to help me
You need to register an outfit on an XML file (...media/clothing/clothing.xml) and then add it on ZombiesZoneDefinition, you can see other mods that surely do that or check it game media folder
Can you tell me more in private chat?
sure np
Guess that works, thanks!
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?
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.
Also as I forgot: https://github.com/Konijima/PZ-Libraries -- for using IntelliJ for Lua modding. 👍 @kind galleon
Thanks Chuck!
What is everybody's must have mod when they start a new playthrough
Is anyone having issue with my mod? https://steamcommunity.com/sharedfiles/filedetails/?id=2847184718&tscn=1670858715
I'm not active on pz atm but I might have time for a fix
Np, lmk how PipeWrench goes - I'd be curious over in #mod_development
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
ye i saw this already.. but wtf didnt notice theres parameters
so thats why it didnt work
lol
Thank you very much, I will do some tests!!! 
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 -_-
Learn to write your own mods for Project Zomboid build 41! Make it multiplayer ready from the start!
Some Resources:
For Items and Recipes
https://theindiestone.com/forums/index.php?/topic/15188-item-and-recipe-script-variables-brief-description/
LUA Event List
https://pzwiki.net/wiki/Modding:Lua_Events
IsoPlayer
https://projectzomboid.com/m...
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
does pz support fbx files or only directx
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
yes
U cant do animations with fbx tho. Thats the limitation
This is false. Advance trajectory made its own dmg system
go on?
i thought it might have but i didnt think it was possible
Which makes armors for zed only
well of course you can get around hardcoded parts of a system if you rewrite the entire thing
is that what the mad lad did?
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
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
Well i am trying to redesing the whole character model
Shouldn't be a problem right?
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
A ton of people model in fbx :) I know the expanded helicopter events is one, and my 3d model guy uses the format a lot
You can swap between the two, afaik. Similar to exporting as a png vs jpeg
I'm still getting people not finding skill recovery journal's crafting recipe because:
-
The mod is translated into their language and they are typing "bound journal" in English.
-
They are expecting the main menu to also add the mod onto an on-going save.
Not sure how to address either issue lol
Chuck saw the mention of EHE and immediately started typing lmao 👀
Hm?
No it was just funny, you worked in ehe right?
Yeah, Shark worked on the models with Cytts help I think.
I mostly do 2D art and programing
Haha yeah- I just meant I typed ehe and then immediately saw you start typing haha
No worries tho
Could you just add a snippet into the mod description on how to add it?
Would be simple to make it universally applicable too, so you can throw it onto any other mods in the future
There's a pinned discussion on the issue. I don't think most people read sadly.
As someone who works in customer service- I 100% agree that 99% of the population is selectively illiterate 😂
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.
Imagine a mod that enabled itself just from being subscribed on the Workshop.
That'd be a bit worrying to be honest. lol
I think the issue with the loaded games is because the mod caters to new users.
They enable it manually in the main menu - but that doesn't impact old saves. They don't know that though.
Imagine thinking mods are broken cause you're not actually using them. 😅
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
I think the load screen shouldn't have the mods button behind something else tbh
If I recall you have to select "More"
yeah it's pretty well hidden
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?
Yeah, would be nice for those to be core features of the game
Ah shit, it's Noctis
:/
He's been MIA last I heard - since the invasion of Ukraine
yeah someone was talking about them the other day
Hopefully it's just a coincidence, or just money troubles, and not anything worse
Konijima's stuff is currently dated any may have issues but I've been working on getting things stable again for PipeWrench.
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.
Is he around? I tried reaching out
He's too busy IRL to update things. I have access to his repositories for PZPW.
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
You're a veteran here so I'd think he'd contact you.
ive thought multiple times of making a community api
theres so much stuff that could be supplied to modders and vanilla fixes/improvements
I'm thinking about a few things, one being UI creation templates.
yeah thats one of my major motivations
PipeWrench is literally the same energy as what you're saying.
rewrite uis as performant versions and provide more templates
Well we have a platform for it - we have a stand-in account on steam which allows us to update from GitHub actions
I'll need to download an offline copy of the official JDocs for PZ and bake the documentation in with PW.
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
yeah not like i had multiple ideas and projects going when i stopped
This is from an old API back in 2016:
That's pretty slick
Custom UI and child element setup.
which tbf was a lot because of motivation when the game doesnt let me do what i want
The other issue is Steam's refusal to let co-authors also upload
You can do a lot with the game already.
not when you want to have server sided stuff but its all client sided
like inventories
soon™️
mmmmmmmmmm well yeah. You'd have to do some code gymnastics.
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
Anyone knows why my mod doesnt show in the modlist? Here are the files for it, also im subbed to it on steam workshop.
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
The things I had to do to get this to work: https://github.com/asledgehammer/ExtraCommands/blob/master/media/lua/server/cmd_windows.lua
could take a modular approach
Server-side Lua NEEDS to be refurbished at some point.
Server side is wildly unwieldy
or simply only release updates when a lot of changes have pilled up
Most things are handled via commands, unless the devs added their own transmit
commands are fine
This is worse: https://github.com/asledgehammer/ExtraCommands/blob/master/media/lua/server/cmd_utils.lua
Yeah but it feels off
Shows the meat of having to get around things not populated on the server vs client.
I have to refactor my shops mod soon
what bothers me is that i cant have server authority to validate inventories
Right now I have commands sending the entire table of all shops and ivnetories
Your community API seems like a nice idea.
also for example zombie kills
sure i could have a client send the info that they killed a zombie
Konijima helped set it up, with me and a few others, but he did alot of the leg work
Hence I'm hesitant to take it in a slightly different direction
but then anyone could send that info and "cheat"
The bane of leading a project is when you have to leave it be.
Even PipeWrench stalled out for a minute.
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
I'm about to update my extra commands patch for twitch users to make their own commands in Lua for both single and multiplayer.
Hahaha. Man.. I'd love to see it.
You could even build a texture cache for drawing UI parts as textures, then load them in like a mod does.
did you see aiterons atm mod?
Nope.
Oh wait yeah I did.
Someone tried to commission an extension of this mod on my discord server.
and concept of using images for fancy uis by me
It was things like this to extend or other mods that had no radial menu support that people tried commissioning.
Sorry just catching up with this conversation, what is it about it that is dated?
I do think that making templates using something like a VSCode extension would greatly help newer modders.
radialmenuapi would be nice for a community patch too
PZPW. Likely outdated dependency versions in package.json
Ah right, so nothing crazy at least
I just pushed updates to the PipeWrench repositories for those things. TypeScript 4.9, etc.
I don't suppose either of you are very familiar with GitHub actions?
I'm not. Someone set that up for me.
can you use actions to push updates to steam?
I setup the workshop upload piecing together other people's stuff
Yes, but I wanted to know if it's possible to scum the githubs repo history as a makeshift changelog
actually yes i do that for my patch notes
Oh nice, more automation the better
Unfortunately, I got the upload actio right off Google - I'm hoping there's a way to setup a new mod entirely
shows all changes from one tag to the other
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
did someone say art monkey?
i made that ui for the atm lol.
Can somebody help me with uploading my mod to steam workshop please? It only uploads preview file, but not the script files
can you show the file tree
Are you using global mod data?
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
Challenge accepted.
👀 bet
ok, I think its working now, thanks for the help
A group of people requires focus and guiderails.
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
Yes, I have it transmitting
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
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
Heheh.. and you can use Typescript to scale it.
I can attest at least four people can do some fun stuff 👍
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
Well Lua brings out the best of the "I have my own way of doing code right" in developers. I suggest TS (Beyond advertising PipeWrench), because it focuses on OOP design that would keep a lot of that problem at bay.
I would also suggest formulating goals and a mission statement.
There needs to be a process for testing and deployment.
Basic IT stuff.
Yeah, when we had a few people under CAPI we had to sit down and figure out a cohesive style
I voted to drop ;
Make choices for the project that eliminates subjective code decisions from people who shouldn't worry about that problem.
The way I did it for Anomalous Storm and Toxic Zones is when a client updates the table and sends it to the server, the server automatically transmits it back to clients, so clients don't need to request as much, and it really helped. I don't think there is a way around sending whole tables unless you break it into smaller separate mod data but that may not suit your needs
Typescript + Prettier.
i vote drop ; and ban globals
That right there eliminates most of the issues I see initially with group projects.
That's what I'm doing too
If you use Lua then force modules.
That was already done in CAPI lol
Refuse global poisoning.
What, you don’t think everything everyone makes should be set in Base? 😂 I personally LOVE when I download a big mod and it puts an extra 10,000 things right into the base files
What's a character one could use to ensure their mod loads first?
Or you could create a registrar table for mods to submit to with dependency data.
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
Getting proper loading for PipeWrench mods was hell but we found a solution for that.
I was thinking, for the community patch, it would have to be loaded first
I don't know why there isn't a priority system
Ended up doing post-generation Lua injection.
By number or string
Does this impact the other mods?
Ideally the patch wouldn't cause any issues
IS it even possible to add new moodles?
Yes, moodle framework
I see
Yes, there's a Moodle API if I 'm not mistaken
On the workshop
The bottom block basically.
post-load reference reassignment saved the day.
Load order is scary in PZ.
That's generated Lua from TypescriptToLua.
So this ensures sledgehammer is loaded first?
I don't seem to know what's happening lol
PipeWrench, and it ensures all PipeWrench mods work.
we werent talking about those modules
was about lua modules
i used ! for radialmenuapi
and !! for even higher priority
its ascii order
Ah
It is, but this harbors so many issues.. unless everything is a dependency chain.
Which isn't realistic.
Yee, I understand- the global vs local variable stuff is always messy as hell in mods from what I’ve seen 😂 I just also hate when people have no rhyme or reason to their module distinctions in script files
well i had to force early load to ensure it didnt override any mod hooking into radials
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.
Most of it is pretty old from what I've seen
Well that's the thing, it could've been done then as well. Modules in Lua isn't new.
Turbos' Lua is really nice though - in terms of being able to manipulate it.
From what I understand, the lore is the devs really wanted to accommodate modders and picked up Lua after the fact.
I believe things like ISUI would've strongly benefited from this approach. 🙂
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
Waht's the moodle type MAX?
That's the index MAX
oh, so final index?
Yes, you don't really need to worry about it
i actually like the way the ui works atm because it lets you do pretty much anything youd want
Oh, it's all from 0 to 4
but the vanilla code is really meh
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
Yeah, that part is awesome. The fact that you can change almost all the UI with Lua is great
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
as is touching tooltip rendering should be a no go
i have trauma reading the context menu
There's some good technique with some of the individual if statements -- calling on other functions to handle logic and returned options
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?
The file returns the main table that would be your global - you can then call on it and name it whatever you want and set it as a local for where you need it
Avoids cluttering the global table, and same name issues
The second issue is not common but happened to me twice
So something like -
example.foo(*inputVariable1*) ```
The arbitrarily long name doesn't have to be arbitrarily long, but yes
That file should be
local API = {}
function API.foo()
return API
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?
PipeWrench generates module code.
This is the generated module table.
It would only be used for mods expected to be called on - most people don't have that in mind unfortunately but anything Konijima wrote should have it and the CAPI repo is still up
@sour island , Making a VSCode template extension seems more and more needed.
Can you add variables to a module? Or is it just functions?
Like is "MyModule.MyTable = { A, B, C }" valid?
If my understanding of lua is correct you should be able to assign variables.
When you require a module, you get the code.
It isn't read-only.
It returns the table you export.
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
_G['blah']
It's fun knowing how Kahlua isn't real Lua and has funny ways of handling calls in different ways.
local _G = {print = print}
print("giga brain")
Icon = default, does anyone know where I can find the default. png associated with this line? if there even is one.
Probably in a texture pack.
So you're saying there's a possibility it exists?
I guess it would have to.
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.
Okay thanks. I searched high and low in the media folder. I will check the tiles.
Steam\steamapps\common\ProjectZomboid\media\texturepacks
There's an unpacker / packer somewhere on the Internet for these files.
TileZed has a tool to open packs. I didn't know if anyone knew specifically where it was.
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.
delta is helping us with kentucky rp 🙂
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.
It looks like function ISMoveableSpriteProps:pickUpMoveableInternal in \lua\client\Moveables\ISMoveableSpriteProps.lua will be what you want to hook up with. Specifically: _object:setCustomSettingsToItem(item) seems to let you copy the settings of the IsoObject into InventoryItem. I am sure that file can lead you down the right path.
the generator is neither a moveable nor a container 🤔
any mods that add a comically large spoon as a long blunt weapon
Yes and I think it is literally called comically large spoon
Anyone know if there's a collection of these in higher quality?
This is off the wiki and it's pretty scuffed
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
player:getModData().nameOfTheModData
cheers, will dig around that
if player:getModData().DTKillscheck2 == nil then
player:getModData().DTKillscheck2 = 0;
end
Same syntax, you can use it as assignments and comparisons
cool, ty
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
Any specific reason?
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
There's a few in the uipacks
Good to know, I wanted to use it but I'd need to make it bigger to work
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
UI is done with Lua so anything is possible.
Matches are renewable in Zomboid right?
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

i dont't really care about fading or locking options
I was just looking for a way to nicely group options
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
Unless you mean something else?
I know that one
Like to space them out a bit?
kinda
I was hoping for a bit more graphical option, like a line or something but oh well 
Otherwise you'll have to rip apart the UI
I have my doubts but with how Zomboid is you never know until you try.
And if you can't catch instances you'll have to overwrite the vanilla function - which is kind of fine for this I imagine
Yea I don't think I'll be doing that, guess it'll be long-ass list of options then

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 😦
Hi all, don't suppose anyone knows of a mod that will let me track the total zombie count remaining on the map?
I don't think zombies even spawn in cells you haven't been close/into
I think it's still track3ed, since they migrate from nearby cells
(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
there's double spiffosurvivor in uipack2 but it's smaller then the other spiffos
I used the wiki's UI pack dump
I didn't see it but maybe there's another page for pack 2
function MTDEveryHoursMain(player)
MTDWeightChanges(player);
end
function MTDWeightChanges(player)
if player:getModData().MTD.WeightMaintainedDays == nil then
player:getModData().MTD.WeightMaintainedDays = 0;
end
// some code here
end
something like this?
you might need to verify/validate MTD first
player:getModData().MTD = player:getModData().MTD or {}
uh depends on how many times it's called but it's a pretty minor action
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

depending on what you need this to do you might be able to ditch the if
checking if player maintains his weight within set limits for multiple days
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
I see, thanks
@dull moss I'd also probably change MTD to be alot more explicit
smort
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
do I use zombie.characters.BodyDamage.Nutrition.GetWeight() to get char weight? 
so isoplayer:getNutrition():getWeight()
very odd, though, as Nutrition is .BodyDamage.Nutrition
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
where is player being defined?
how does one do that 
I've been using LevelPerk before and it has player as one of parameters so never had to do it myself
where can i find the file that picks the clothing items for an outfit for zeds?
rlly new to pz modding here
Where every you're calling it, you need to feed it the player - if the code is on client I believe 'getPlayer()' should be fine
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
u mean split-screen? don't care about that 😄
yeah it's rough having to account for all that
yes, IF the code is in /client/ you should only have 1
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
If you need to keep the argument as an option for whatever reason
moment
otherwise local player = getPlayer() is fine
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?
another certified
moment
local player = getPlayer()
local MTD = getOrSetMusicManTastyDogs(player)
local nut = player:getNutrition()
👍
np
hm, random ideas...
press q to trigger Negan whistle sound instead of plain "Hey You" text
@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
Question. Where can I ask about commissions?
hm glytch3r already has custom shouts, wonder if I can scavenge that whistle from somewhere and also a "get over here" would fit nice.
How do I add custom models as playermodels?
@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
Does anyone know how I find the settings to add to a medical item?
Yes, getOrSet is just a "safer" approach - but you can make it strictly a get
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
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 😄
that'd actually solve co-op issues as onCreatePlayer has the isoPlayer as an argument
every object has it's own modData
make a table on top out of function
for initializing the tables?
I am thinking if it's safe to use IsoPlayer as key or better to use the 1 to 4 number
ye
cuz it's getPlayer() everywhere
getPlayer returns the local player
but anyway random local var on top and on createplayer add the data there
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)```
what does this do?
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?
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
I tend to lean more on the "be able to remove a module with 1 file/point" philosophy when I can
I mean
I agree
But I thought maybe not doing all of that on every weapon hit would be smarter
idk
I can check runtimes
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
Yea I like it
local leadFoot = getMTD().leadFoot
leave the backend stuff in the getter to make sure it's set + avoid having to type player:getModData().leadFoot
yea but i need to change it
i cant just change leadfoot
i have to call getmoddata anyway
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
I did read in the lua performance tips pdf (https://www.lua.org/gems/sample.pdf) that using local to store functions can help with performance, is this why you are doing it?
Also, about moddata, is writing and reading the global moddata slow when you do it server side? 🤔
Honestly it is easier to read, looks nicer, shortens lines
But I did consider repeated calls for the same object/value was probably not the best
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
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)
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?
you would not
Okay sounds good, thank you.
I'll see what I can do, but first, I need to convert my code from JS to Lua 
could store it as a bidimentional array in global mod data
where each dimention is x and y
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
anyone have a snippet of how to tell the distance between a player and a sprite?
wouldn't grabbing the xyz of each work?
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?
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
oh ye
Why not just use actor from the start?
cuz i copypasted stuff, was testing if it generally works
was planning to do tidying up after
fair enough
what are all the sandbox option types?
Should be same as vanilla

ERROR: General , 1670960918171> ExceptionLogger.logException> Exception thrown java.lang.RuntimeException: attempted index: isZombie of non-table: null at KahluaThread.tableget line:1689.
Boolean, String, Enum, Integer, Double afaik
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
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...
ow shit
https://i.imgur.com/djeOB6I.mp4 haha reminds of mine
im reading past convo about animations and time actions and saw that lol
@ancient grail
will you be making any changes to audible shout?
if you are, can you save available sound somewhere, like ISPlayerData?
smol bump 
Is there a way to remove a vanilla recipe without overwriting the whole file?
i dont polan to . it was just a test experiment.. feel free to do anything with it 🙂
i i kept forgetting to add the freefor all tag for my mods
lol
cuz i read it wrong
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
Well, it’s the vanilla Gather Gunpowder recipie. I could delete it by overwriting the recipes.txt but I REALLY hate doing that.
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
whats the diffrence with on test and on perform?
test has something to do with item properties?
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
OnCreate?
yeah that's the one
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
Anyone run into issues with oncreateplayer in MP not using the actual isoPlayer?
Cigarettes are an example of a food item that uses a lua function when eaten.
And yes, multiple vanilla items have OnCreate functions.
No its not a container. And I guess you are right. It's not the type of moveable I am referring to. I guess it's not really an accurate example of the kind of item I was referring to.
Yeah that's pretty much what I was saying. The reason i ask is because I've been working on a visible items mod for myself that is similar in functionality to the visible generators mod u made. I've been using both your mod and some work from skizot as templates.

^
ah
ye no worries
sir whats the best way to disable recipes?
The methods above are the most thorough lol
Obsolete doesnt work cause multiple recipes are allowed to have the same name
ye thats what i was thinking
Something that will hopefully be addressed one day
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.
no we wre discussing about removing recipe
Check this: #mod_development message
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?
anyone know a good mod that has examples of working with IsoWorld values?
it's a multiplier, lower values are better
Excellent, ty!
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
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.
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.
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?
yeah
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
psiber do you know a way to delay code like wait()?
I'd make an update loop that ticks down a value
how would i go about that?
no idea 🙂 I started modding PZ about an hour ago lol
well shit
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
what does ```ReplaceOnUseOn = WaterSource-WaterBottleFull
Actually Override: true together with Obsolete: true can disable a recipe, I never tried making multiple of the same name obsolete though
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 
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.
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
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?
Water bottle full is a drainable that will lose water as its used.
That line is saying when you Use the WaterBottleFull on a WaterSource, Replace it with another WaterBottleFull (which will have all its uses) thus replenishing it.
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
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)
That's where it fails unfortunately, the way it's written in the java only catches the first pass.
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
There is no solution that works in all instances in life.
Or doesn't require follow-up.
Never said there was, fortunately here there is a better solution
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" 🙂
@faint jewel exactly what you needed



moment
