#mod_development
1 messages ยท Page 112 of 1
Well, wherever in the weapon definition you set the model it's using, it would be that. same concept really
Ok.
Hi, is there a way to force clothes to not show these patches on tailoring? (without resorting to the invisible patch mod since I only want this to apply to my costumes )
Is there some weird rule about how many underscores one can use in filenames, functions, or variables?
Can anyone explain this?
AutoRifle_V7_model is what I have named the model and the .fbx file, but it's invisible. Also, this screenshot of the DevMode attachment editor tool shows "AutoRifle_V7_" instead of AutoRifle_V7_model
Not that I have ever encountered, but I don't know for sure; I don't use more than like 3 lolz
I wasn't able to use your template, but found the error that the original one didn't work, not sure, but i had to start the code again in no hurry: ```local function OnPreDistributionMerge()
-- ProceduralDistributions.list.KitchenDishes = {
rolls = 2,
items = {
"PWp.Cannon", 20,
"PWp.Heineken", 20,
end
Events.OnPreDistributionMerge.Add(OnPreDistributionMerge)``` I think i was already crazy
not sure if any dev or anyone who knows reading but if anyone sees this who knows. is there any thing i'm missing for Setting PickUpLevel via sprite properties? is it not dynamically able to be set via lua? i see lots of other things with exposure, but i don't see any way ATM.
I do prefer to use the built in feature of controlling it by tile property level if anyone has a suggestion to use sandboxvars for changing the tile property PickUpLevel dynamically for server owners (in my case, just for lightswitches as a moveable)
i will use a workaround by setting ismoveable to false until the correct perklevel is hit, but it doesn't feel as contextually straightforward as seeing what level needed to move a moveable..
Beautiful
nice!
Yes, please.
Why not use isMoveable in conjuction with isAdmin?
don't need admin is all. but i can use it
it just doesn't actually change the displayed level for PickUpLevel
Fair enough
i did think of a quirky workaround
i could use context menu to set the lightswitch to is moveable
that way the player has to "disconnect" the lightswitch before moving it
then i will have my perk level check
if not perklevel then context is not valid
True... could do if isAdmin or perks.Electricity > 5 then type of thing...
I mean, without that then server admins would have to manually set their elec perk to that level or higher to do so
this is for my lightswitch electrician mod. to let admins set the level which players can remove lightswitchs
yes
with sandbox option
thats the goal
that way server owners have full control of my mod
by limiting the option to sandbox it's implied that admin can only use
No I mean, say I wanna use your mod on my server; as admin, I would need to change my own perk level to whatever is specified, in order to pick up the light switch lolz
Versus what I specified above allows admins to bypass the requirement, and enforces the level requirement for players.
ohh yea i see what you mean. thats pretty much exactly what im doing. i didn't think about letting admins bypass it haha, i spose thats easy way to do that also
only thing im running into is it's not straightforward for player
i'm blocking them from doing it without some context explaining
was gonna use say
"i'm too potato"
That's how I usually do it at least; I assume admins on a server should be allowed to bypass all requirements in my mods, since that's how it works in the base game, basically lolz
i just want to be able to communicate that you can't interact with because... but since i can't edit the pickuplevel on the fly it seems i'm stuck kinda doing it this way.
You can manually say that in the context menu of course.
although using context menu is seeming like maybe a fun way to handle it
yea
seems like the best way
Basically check their perk level versus requirement, and display it as <their actual level>/<requirement> Electrical, and display it as red or green. Basically what you would see in the carpentry menu. And enable or disable it as a selectable option, based on that comparison.
gonna try this out lol
this is the last part before the update goes out
huge update also
essentially overhauls how lightswitches work completely
nice, nice... I'm getting close to an alpha release myself. Good luck :3
ty! you too
ALSO, the more I make the mod I'm working on, the more I'm learning how to make that mod we talked about a long while ago >.>
(nope, I haven't forgotten about it lolz)
haha i'm glad you learning. having more people who have some background in coding in general seems to help pickup this stuff way faster lol
Agreed; I woulda never understood the Lua side of mods without some prior coding experience lolz
took me a month just to mostly understand how arguments are called through functions
if player.Nippy(isWeird) then
return true
end
๐
โฃ๏ธ hehe
how do I, as a contextmenu option, change one item into another instantly? Does it require ItemTweaker?
How can I remove specific loot items from a zed? like, I want to remove all boxes of ammo.
I'm trying with RemoveItemFromDistribution() but it doesn't seem to be working
best way is to remove the item from the inventory and then add the new item in.
I'm doing that within my timed action, but I want to make sure the battery level doesn't reset, so I'm trying to get that working
just not sure if my context menu option is going to show up correctly
haven't seen anything on how to add them, only timed actions
RemoveItemFromDistribution(Distributions[1], item, nil, true)
won't that remove it from all distributions?
oh yes one sec
oh i guess you need to loop through the list of zombie targets
but same thing
for x,y in pairs(SuburbsDistributions["all"]) do
if x:contains("Outfit_") then
RemoveItemFromDistribution(SuburbsDistributions["all"][x], "Bullets57Box", nil, true);
RemoveItemFromDistribution(SuburbsDistributions["all"]["inventoryfemale"], "Bullets57Box", nil, true);
RemoveItemFromDistribution(SuburbsDistributions["all"]["inventorymale"], "Bullets57Box", nil, true);
I'm doing this, but boxes of ammo are still showing up on zeds
hmmm
the only thing you have that is diff from me spawning on zombies is that
procedural doesn't do anything with zeds, does it?
Nippy is a good friend but yes lets agree to this
hahaha
maybe it doesn't but i know the [1] does
i dont think you actualyly have to require anything tbh
ok, thanks, I'll give it a shot
having an issue where the new context menu option I've made isn't showing up for my item, not sure what's wrong
ClientLogic.lua
`require "TimedActions/ISPocketTVSwitchMode"
function PocketTVSwitchModeAction(item, player)
local char = getSpecificPlayer(player)
ISWorldObjectContextMenu.equip(char, char:getPrimaryHandItem(), item, true, false);
ISTimedActionQueue.add(ISPocketTVSwitchMode:new(getSpecificPlayer(player)));
end
function PocketTVSwitchModeMenu(player, context, items)
for i,v in ipairs(items) do
local item = v;
if not instanceof(v, "InventoryItem") then
item = v.items[1];
end
if item:hasTag("PocketTV3TVMode") then
context:addOption(getText("ContextMenu_PocketTV3TVMode_switchMode"), item, PocketTV.switchModeAction, player);
elseif item:hasTag("PocketTV3RadioMode") then
context:addOption(getText("ContextMenu_PocketTV3RadioMode_switchMode"), item, PocketTV.switchModeAction, player);
end
end
end
Events.OnFillInventoryObjectContextMenu.Add(PocketTVSwitchModeMenu);`
no error?
it's probably context:addOption(), as I don't know what that does
no error, simply no context menu option
oih wait
ah, the action is still PocketTV.switchModeAction, ill change that rn
did you add the translation? also
yeah, the ContextMenu translations are there
gotcha
gonna run again
i have a good feeling for ya this time in that case
hmm, still nothing
๐ค
lemme ss
try to get it to appear without functionality. just use context:addOption(getText("ContextMenu_PocketTV3TVMode_switchMode")
that will make appear but do nothing
if you get that far then your args after will be where you wanna look at
im going to enable errorMagnifier to see it in-game
seems I missed a parentheses
se.krka.kahlua.vm.KahluaException: ClientLogic.lua:19: ')' expected (to close '(' at line 18) near elseif
it's if elseif end, right? only one end?
from what you pasted?
No context menu option, even with it being empty
I think I'm not correctly doing my condition for the items
I added your line and missed the second parentheses, fixed it now
like sharpknives
is a tahg
tag
maybe not spelled exaclt correct
ScriptManager.instance:getItem("Base.item")
item:getType() returns the ID without Base? I think getFullType() gives the module as well
gonna try
finally. time to add the args
sweeeet
now something's wrong with my timed action ๐ฎโ๐จ
i can't see what the issue is when its in this window, how do I actually navigate the window lol
ah im calling something that isn't there, shoot
Here's my timed action performing. I think the ISBaseTimedAction.perform(self) might be the issue, so I moved it from the top to the bottom
function ISPocketTVSwitchMode:perform() -- Trigger when the action is complete local itemType = self.item:getType(); local batteryDelta = self.item:getDelta(); self.character:getInventory():Remove(self.item); if itemType == "PocketTV3TVMode" then self.character:getInventory():AddItem("PocketTV3RadioMode"):setDelta(batteryDelta); elseif itemType == "PocketTV3RadioMode" then self.character:getInventory():AddItem("PocketTV3TVMode"):setDelta(batteryDelta); end ISBaseTimedAction.perform(self); end
wouldnt you want start? maybe im wrong. i dont rewrite vanilla much
you want the timed action to start right? or do you want it to happen at the end of a timed action? and where are you calling that?
do you mean the ISBaseTimedAction? I took this from the modding resources, not sure exactly how it works
my whole file is here:
put icons on my context menus haha
nice. you have the light switch mod, right? looks really neat, wasn't sure how well it works though
it only works to move around inside houses atm
doesn't work if the room doesn't have a roomdef
update will change that
do the houses have predefined ceiling lights?
and you can add colored bulbs to switches
predefined is not exactly correct. still a light from sprite in a sense
just more complex then my method which essentially changes switches into a lamp/switch hybrid to break it down simply
because it removes limitation of needing a room id to work
then you can use lightswitches in player bases and anywhere really
neato, ill check it out then
complete overhaul to how lighting works for lightswitches
sandbox for 80% of options it offers including changing loot dist on location and zombies
anyways lets see here
i probably need to pass the item as a parameter in the lua constructor
time to reboot ๐
okay, I have the timed action working now, it needed item to be defined. Now I have the issue of the previous item not actually disappearing from the primary itemslot
ghost item
oh yea
just use the reference to item via local and use that instead of items in arg there
context:addOption(getText("ContextMenu_PocketTV3RadioMode_switchMode"), item, PocketTV.switchModeAction, player);
define the way you are calling the item if you arent already and call it there
instead of item
unless item is a loop
it's a part of a list within a loop
ahhh
ohh i totally misread im a dummy
so it's working just you have an old item still there?
cant you just not allow to do it while eqipped
I'd like to have it not be equipped, and instantaneous
not really sure the context for need there
can you force the unequip
i think also timed action?
maybe, i will pull up the resource I was using
My first mod with a custom model I made myself lolz... simple as hell, just makes stones stackable and unstackable because I was sick of manually placing hundreds of stones for aesthetic organization >.>
https://steamcommunity.com/sharedfiles/filedetails/?id=2932188191
how would I do that
oh shoot lemme see
love this
I was following this
https://github.com/MrBounty/PZ-Mod---Doc/blob/main/How to make a custom timed actions.md
I only see a force complete, is that what I want?
I feel like a certain MP server should use it >.>
ISTimedActionQueue.add(ISUnequipAction:new(playerObj, playerObj:getPrimaryHandItem(), 50));
AHA, I removed the equip and it instantly changes the item. One issue though: if the item is on the ground, it doesn't get deleted and the item duplicates
yes you have to remove that
Well, 100, but yeah lolz...
100 stones <-> 1 stone pile
hey its okay to have a few stone piles. better that way
do I add this after adding my custom timed action?
Is it against the rules to ''recruit'' here?
I'm currently working on a mod alongside a couple of other people that's supposed to add a decent variety of drugs, we currently have ~2 people on the coding part while me, myself and I create textures and models for items and such. Just sort of checking interest, would anyone be interested to work together/collaborate with creating models and textures? It's not really a deathly serious project, more so something we do together for the fun of it and out of our love for PZ ๐ซก
Also more aesthetically pleasing, and easier to organize on the ground.
I originally made it for Medievaloid, because you collect a metric crapton of stones, but have no storage at first til you build crappy crates, but just laying 7271938477 stones on the ground looks terrible lmao
I don't see why not
yea its not against the rules if you aren't spamming
Hell yeah
or at least i haven't seen anyone complain ๐ i dont know all the rules haha
Hahaha that's fair enough! As long as you're not spamming the place with walls of text ๐
What's the eventual end goal, or theme for it? Are we talkin somethin like Jiggas, but more expansive?
...are we talkin somethin like a Mr White mobile lab van setup possibility? lolz

I adapted this to my params but it's throwing errors. Am I missing a require?
I guess the end goal is to eventually have something finished and put it on the workshop for people to use and edit as they please, really nothing more major than that! The theme for it could be described as street pharma, adding a buncha' illicit alternatives to the vanilla medicines while keeping it relatively simple and in line with how PZ already treat such items. The plan is to have an addiction mechanic and some fun variations of drugs to feed your character with at the start with crafting and chemistry maybe planned for it later down the line when we've (hopefully) finished it :>
hmm... that actually sounds really interesting; would def use that on a few of my community servers.
I wouldn't mind helping with it once I have my current project in a more stable phase, but I can't really give an estimate on that yet.
I plan to have some things like that in the current mod, but as it's geared towards a medieval setting, I doubt anything I make right now will seem like it belongs in that one, since I assume you aren't using foraged herbs for them lolz
sorry this should be more simple
ISTimedActionQueue.add(ISUnequipAction:new(playerObj, item, 50))
my issue is the ISUnequipAction, I don't think my script can find it
player shoudl work and item and time
Understandable! I'm always looking to make stuff, so if you want to help contribute you're of course free to use anything I've already made for your own projects. I want to keep the stuff I create as open source as possible. We also have someone working on their own stuff while helping us out on the side! We do actually have some things we want the player to be able to forage as well ๐
woah... getting a super weird error now. My player object is having an issue??? gonna check it
If you want to just come check it out and feel the vibe/talk a buncha' crap with us I could shoot you an invite to our little Discord server
code currently
function PocketTVSwitchModeAction(item, player) local char = getSpecificPlayer(player) ISWorldObjectContextMenu.equip(char, char:getPrimaryHandItem(), item, true, false); ISTimedActionQueue.add(ISPocketTVSwitchMode:new(getSpecificPlayer(player), item)); ISTimedActionQueue.add(ISUnequipAction:new(player, item, 50)); end
maybe i need to call char?
maybe? but i wouldnt think so
I took some of this from another mod, the only thing that's mine is that ISTimedActionQueue.add
@agile lily by all means, sure, feel free to send over the invite and I'll check it out. I may help a little on the side, as long as noone minds I'm working on something massive already that's kinda my focus... send halp...
youre not getting an error on that 3rd line?
nope
ISWorldObjectContextMenu.equip(char, char:getPrimaryHandItem(), item, true, false);
wth lol
i got an error within ISUnequipAction
Holy fuck, that's L A R G E! And sure, I'll hook you up with the link in a DM :)
i need to pull it up again. it was referring to hotbar and player
i'm guessing uses another arguement
aye aye.. and yeah, but that's partly because of the customized map haha... 10k files for the entirety of Knox map, modified on every cell, even the not-yet-part-of-the-usual-map cells lolz >.>
I think it needs SpecificPlayer, so I'll trying passing char
it needs getPlayerNum
Jesus christ haha, meanwhile our github folder is ~2.5mb ๐
at least im fairly certain
how would I define primary hand
primary lol
as a string?
yes
ok
50, primary
lolz... Yeah, I'm slightly worried I won't be able to upload it to the workshop when alls said and done... might need to make a custom mod installer that downloads the map files externally lmfao
time to try again
No dice, still showing up on zeds.
for x,y in pairs(Distributions[1]["all"]) do
if x:contains("Outfit_") then
RemoveItemFromDistribution(Distributions[1]["all"][x].items, "Base.Bullets57Box", nil, true);
You want to simply remove it from their inventories, yeah?
yes
You could remove it from corpses on death
...what does it want from me? ๐ญ
wouldn't this be kinda heavy on the server?
Only fires when you kill a zed.
So, not even close to as heavy as some vanilla events are already, like onplayerupdate, onzombieupdate, etc
That's what I use to completely clear zed inventories in my own mod 
yeah, first time i put a log into an event for onplayerupdate I was astonished how fast it was calling
@glass basalt yeah, like every millisecond lolz.... try adding a print in there... that'll kill any machine that's not decent
i think you should test this more
i tried the same thing myself and it didn't work well
and it makes sense to me that it shouldn't really work
Oh? It's been working flawlessly for me during playthrough testing ever since I put it in there..
onzombiedead is called before the zombie dies - it's not a corpse yet, so its inventory hasn't been filled
when i used it, it would consistently clear their clothing, but random drops like cigarettes would remain
it makes sense to me that the clothing already exists before they die, but their drops don't
albion, do you have experience with ISUnequipAction?
none
darn
Well, I also cleared all loot and dist tables, so maybe that's why it works for me?
Nothing to add to inventory after the fact, with empty tables >.>
that makes sense!
i had wanted to use it to optimise some dummy item code but it didn't work out
what abou that condition
i mean it's like the only thing i can think of
can you just remove it and try?
Yeah, so the relevant parts of my custom lua is:
function removeLoot()
ClearAllDistributionItems(SuburbsDistributions, true)
ClearAllDistributionItems(Distributions, true)
ClearAllDistributionItems(ProceduralDistributions, true)
ClearAllDistributionItems(VehicleDistributions, true)
end
function clearZedInv(zombie)
zombie:getInventory():clear()
end
Events.OnPostDistributionMerge.Add(removeLoot)
Events.OnZombieDead.Add(clearZedInv)
i dont really see why it would be needed if you want it off all zeds anyways, unless you really are trying to narrow it to specific ones
yeah that makes sense, you already delete everything that it doesn't work for
Aye lolz... made sense to just mass-clear everything; there's no containers, structures, vehicles, etc in the world, so, no reason to have anything in the tables at that time.
is "all" just zeds?
is x:contains() valid? aren't these lua strings?
if your targets are zeds yes
seems to work when I'm iterating, yea
then you dont need that condition
that's probably why then, I thought all had things other than zeds and only Outfits_ were zeds
The distrosystem isn't exactly clear, sorry
for me i just spent an entire day messing around until i started to get it lol
literally all day
i hope it's working now
is there any documentation for ISWorldObjectContextMenu or ISUnequipAction?
the answer to any question that starts with 'is there any documentation' is no
๐
it's not the menu giving you trouble from what iseen
it's the action you want to take from clicking the menu
is there somewhere where I can look at the IS java classes? I don't see them in the modding index
they aren't java
ah shoot
yea i had to give up the replacing context menu for removing lightbulb
even when i thought i got it right i didnt
there are a lot of mods that tie into the world menu, just reference those for how it works. The vanilla code is thicccccc in that section so I don't suggest looking there.
In an item script, is there a particular order the parameters must be written in for the game to read it properly?
I've been looking at Better Batteries as a reference, is there another mod that has more timed actions and context menus?
no
does anyone know why this is valid?? i made sure it is, but i don't get it
contains should only exist for java strings, right? i checked and it's not happy with local foo = "bar"; foo:contains("ba") so it's not some strange kahlua/pz thing
Ok then, would someone be able to review my script file and tell me what is wrong? This is driving me nuts.
More Builds
for your weapon? I don't have experience with weapons & models, I apologize
@anyone
I've spent 3 days of my life trying to figure this bleep thing out.
no need to ask permission. if noone can help they just wont respond to you ๐
You should really be using base with Brita's stuff, they do everything from Base
I don't even know what that means. I'm making my own mod.
No errors.
Game just doesn't seem to recognize the item as a weapon.
I can equip it, but it's just empty hands.
did you write the xmls to attach it to the hands?
I know the game can see the model, because in the devmode tool "Attachment Editor" I can select the model and it even has the texture on it.
Uh... no. That wasn't in the tutorial.
scale / position.
What?
that's 9 /10 times what cause it to not be visible in the hands
I don't think that's it. Character doesn't hold it like a rifle or any weapon... it acts exactly like there is nothing being wielded.
well did you set it up based off an existing weapon?
have you tried renaming it to a weapon you want to mimic to see if the game shows it?
Yes. Both the model and the script file.
No... I did not think of that. Wouldn't that cause a conflict?
still not, but I'm just going to clear them off dead zeds 
if you get that working consistently i'd like to hear how
it just needs to happen 75% of the time and I'd be happy, we're just trying to clear off some/most of the ammo boxes off zeds
because Brita's adds far too much loot to the table
I tried with more loot settings to just do Base.Bullets57Box:0
but nothing happened lol
i got the spawn rate on my book to .00005 on zeds atm doing it that way. i haven't tried to remove
i never got 0 to work
ever

LOL
it's a good thing I saved that excel sheet
i posted this before but this is what i consder low spawn rate for my book
Base.Bullets38Box:.00005;Base.Bullets380Box:.00005;Base.Bullets9mmBox:.00005;Base.Bullets357Box:.00005;Base.Bullets57Box:.00005;Base.Bullets45Box:.00005;Base.Bullets45LCBox:.00005;Base.Bullets44Box:.00005;Base.Bullets4570Box:.00005;Base.Bullets50MAGBox:.00005;Base.20gShotgunShellsBox:.00005;Base.ShotgunShellsBox:.00005;Base.10gShotgunShellsBox:.00005;Base.4gShotgunShellsBox:.00005;Base.223Box:.00005;Base.556Box:.00005;Base.545x39Box:.00005;Base.762x39Box:.00005;Base.308Box:.00005;Base.762x51Box:.00005;Base.762x54rBox:.00005;Base.3006Box:.00005;Base.50BMGBox:.00005
require "Items/ProceduralDistributions"
local function nipswitchBook()
local list = ProceduralDistributions.list
local targets = { BedroomSideTable = .000000001, BookstoreStationery = .00000001, LibraryCounter = .00000001,
OfficeDeskHome = .00000001 , LivingRoomShelf = .000000001}
local item = "Base.Lightswitches_fordummies"
for k,v in pairs(targets) do
local items = list[k].items
table.insert(items, item)
table.insert(items, v)
table.insert(items, "Base.Lightswitches_fordummies")
table.insert(items, SandboxVars.Nipswitch.Bookchanceplace * 0.0000001)
end
targets = {inventoryfemale = 0.000000001, inventorymale = 0.000000001}
for k,v in pairs(targets) do
table.insert(Distributions[1].all[k].items, item)
table.insert(Distributions[1].all[k].items, v)
table.insert(Distributions[1].all[k].items, "Base.Lightswitches_fordummies")
table.insert(Distributions[1].all[k].items, SandboxVars.Nipswitch.Bookchancezombie * 0.0000001)
end
ItemPickerJava.Parse()
end
Events.OnInitGlobalModData.Add(nipswitchBook)
LOL
notice how im using .000000001 but also then mlutiplying it by .000000001
I actually just need to do it for vanilla items
i meant more for the values lol
I noticed that when I drop the multiplier on loot below .5 it just rounds to 0 and doesn't do it
only issue with this also i didn't consider is i dont know your loot table
if other stuff is low rates also then this wont seem as low of rate
you will have to lower it by way more
doesn't it round to 0 at some point?
no
at least no for 32 chars or something
it's java double value
it does have max but not sure exact. it's deep tho
the zed loot stuff is a roll on x items, doesn't it just roll against the table and pick one?
essentially. by roll amount and weight of each item over entire table of items for that container
something like that
if your item has more rolls than other items then even with low number it will still have higher chance
dont quote me but thats def pretty close haha
most of what i know is from testing though. not from others words
I checked the timed action in the game, it doesn't take a string after time
`function ISUnequipAction:new(character, item, time)
local o = ISBaseTimedAction.new(self, character);
o.item = item;
o.stopOnAim = false;
o.stopOnWalk = false;
o.stopOnRun = true;
o.maxTime = time;
o.ignoreHandsWounds = true;
o.hotbar = getPlayerHotbar(character:getPlayerNum());
if o.hotbar then
o.fromHotbar = o.hotbar:isItemAttached(item);
else
o.fromHotbar = false;
end
o.useProgressBar = not o.fromHotbar;
if o.character:isTimedActionInstant() then
o.maxTime = 1;
end
if o.maxTime > 1 and o.fromHotbar then
o.animSpeed = o.maxTime / o:adjustMaxTime(o.maxTime)
o.maxTime = -1
else
o.animSpeed = 1.0
end
return o;
end`
ahh
Well, if you end up figuring it out please send me a DM. I've spent more time on this than I'm comfortable with this week and need a break.
Now I know why some mods I love playing in games eventually stop getting updated.
myb i must have misread for equipped
its good, i should've opened these lua files sooner
i think my issue is what i am using for equip. going to find a different action for it
...nope. vanilla code uses it just fine
time to test again
new errors, all throughout ISUnequipAction. I don't understand it, I frankly want to have the option of switching the item without equipping it, so I'm going that route
Maybe a dumb question, but.. do the different zone types affect anything other than foraging? For example, does the Farm or FarmLand zone object group/zone affect crops?
those just affect foraging
cool beans, thanks
finally... no stupid errors. Just need to fix the validity of the timed action to avoid making dupes and I'm done with the code. Just some dumb model making and finished.
nice! i haven't asked... what is the mod supposed to do?
This mod was SUPPOSED to let you use any TVs in your hands, by rerouting IsoObject properties into an InventoryItem object (because TVs don't properly connect to a TV station without being placed) but I am not capable enough of figuring out how to do that apparently. So now, I'm simply adding portable versions of TVs that you have to carry with you and throw on the ground whenever you want to watch something. I blame the game limitations, but someone who has a better understanding of OOP could probably figure it out and let everyone watch TVs while equipped
just... upset with everything
lol nah dont be!
I wasted a whole day on this nonsense. I have college assignments to do but that's on me for not prioritizing it
pre-game brain for assignments lol
my assignments are writing papers... if only it was code
haha
hello! is there anyway i can troubleshoot why a mod will not appear in my mod list? It is a custom mod not on steam, it seems to be in the right file path and the mod.info file is formatted correctly (name, id, desc, poster). any help appreciated!
which folder do you have it in
C:\Users***\Zomboid\Workshop\ "modname"
lol what, if you have only 1 item with 1 chance it's low chance. It doesn't get transformed to 100%.
cast to float
woops under "modname"
workshop has different structure
ah? what should the folder structure be? I was following this tutorial. https://steamcommunity.com/sharedfiles/filedetails/?id=2648115890
there should be a template mod in there to copy from
workshop/my folder/content/mods/modFolder
i see, i will try to follow the template and update!
if you use -nosteam, you should just put it into the mods folder
does the workshop.txt replace a mod.info file? or will i need both?
sorry it takes me a bit to get stuff, new to modding/java
that's for steam description
oooh ok
my brain hurts now lol
everything looks to be in the same place, mod.info is in
C:\users\wierd0\Zomboid\Workshop\mymod\Contents\mods\mymod
Nope, doesn't appear in my mods list at all.
ahh,,,maybe its because my mod name doesn't match the one in the mod.info file? that seems obvious to check now <-- SOLVED lol. apparently im very good at speling
I don't think that should be an issue. Names can usually be changed.
iirc it wasn't the last time i tried to make a mod, but now my mod appears in the mod list? very weird though.
btw if u not sure where to drop ur mod u can use this rule : wanna publish - loc1 ;wanna play by urself? - loc2. loc1 is at C:\Users\USER\Zomboid\Workshop\ModTemplate\Contents\mods\ModTemplate || loc2 - C:\Users\USER\Zomboid\mods\examplemod
examplemod and ModTemplate are mods. and folder structure at last folder must be same for both loc1 and loc2 (media folder/poster.png/mod.info)
most mods i keep for myself and friends, so this is good to know thank you!
alrighty, how can i start debugging a mod? where can i look to find errors and fix them? this clothing tutorial broke the itemlist in debug mode and i got a lot of errors ๐ญ
-debug for startup and console.txt has all errors as well
there are more ways but im about off for now
console.txt in user\zomboid
thanks!
@red tiger
What are some common artefacts from decompiling java?
Welp, already have 2 more mods on the agenda.
Can't catch a break on these workaholic sprees hehe
Thinking about 2 compatibility mods.
One is an improved ReducedWoodWeight mod that uses DoParam and a sandbox setting so one can manually adjust, intended for compatibility with Skizots funny carrying mod thing
(Guess that's less a patcher and more ReducedWoodWeight but better, but we don't talk about that)
Then an actual patcher that makes Rebalanced Prop Moving and Disassemble Containers with Items play nice.
Disassemble Containers with Items is
quite possibly the least compatible mod i've ever looked at
It overrides the entire
file
To change 1 single line, in 1 single function
Is it possible to get Intelisense for PZ? So that you can see all the functions that you can call from player and such?
Good morning.
Found out that both mods override the entire file

So question - if I basically fix these mods up to use sandbox settings and to effectively be independent of the original mods, would that be an ethics issue or would I be fine?
good evening
It's different for each decompiler. I know fernflower really well. Spent over 10 years with it.
JAD too but I only use it as a backup.
What artifacts are you dealing with?
I am mostly curious about how accurate it is / what can be decompilation errors and such.
The errors comes from a failure to effectively interpret the artifacts of compiler optimizations to source code.
You can absolutely restore Java source code.
I know the differences between compiler optimizations and the original code now because of the time spent doing it heh.
You'll see some funny ones that also doesn't hurt the code.
int var1;
// ...
var1 = true; // Compiler stuff showing up on the decompiled code.
Fernflower is a very competent decompiler now.
Hopefully this answers your curiosity.
One note about fernflower: it can and often does treat constant reference values above 32767 as UTC-16 character literal expressions so if you see those, know that you can either cast them as (int) or replace it with the utc offset value.
thank you for explaining
No problem. It's refreshing to discuss this since I really haven't for those years. Haha
If you end up applying the decompiled code, make sure you understand your legal rights in your jurisdiction.
This is the darker side of the legal gray zone in modding software.
I'm legally obligated to respect the copyright holder when directly modding the byte code for PZ.
Sounds silly to mention but I've seen projects go horribly wrong in the past for ignoring this.
I don't know whether a current version exists, but it's certainly possible. Depends on your IDE of course
Without more descriptive documentation (which a lot of helpful folks here are working on!) it would really only be helpful to show you what functions exist & what types they expect. I use a fork of emmylua, so if I wanted intellisense I'd generate a type stub that it can use
If you need a more type-friendly modding environment, consider trying PipeWrench, my Typescript for PZ.
Can you give me the url to the documentation about PipeWrench? I have seen you mention it and looks very interesting but haven't studied it yet
Sure. Am on my phone
No rush, whenever you can ๐
TypeScript typings for ProjectZomboid Java API. Contribute to asledgehammer/PipeWrench development by creating an account on GitHub.
Thanks!!
No problem.
I'm working on improving the Lua to Typescript transpiler by rewriting it.
So I'm gonna read through all of it with details but just to know, this is to code in Typescript and then it converts to lua?
Yes. You can code Lua too.
If you understand d.ts then you can interface with your Lua code. PipeWrench is a giant compile of d.ts
Just combined two 3000+ line mods into a small, 264 line one.
This does bring a smile to my face
It if doesn't have code it can't fail
Jk jk nice!!
You aren't wrong
Fr though I genuinely don't know why both mods overwrote the same file in the same exact way
When they could've just both overwrote the functions they needed-
I can't even be upset because I probably would've done the same exact thing when I was starting out
Probably not knowing why. I remember when I just started modding, I only required the inventorytransfer update and I overwrote the entire file.
I'm still refactoring old code that now I notice it could be much better
I had to refactor my battery mod yesterday because a friend ran into a peculiar error where Duct Tape essentially multiplied in uses.
Was very strange.
ProceduralDistributions.list.test1 = {
rolls = 4,
items = {
"ElectronicsMag4", 1,
}
}
ProceduralDistributions.list.test1 = {
rolls = 4,
items = {
"ElectronicsMag4", 1,
"Nails", 1,
"Nails", 1,
"Nails", 1,
}
}
here is what I wanted to say with LootZed pictures
@drifting ore
quick question, im editing the distributions lua so that i can get an item to spawn mostly in bedrooms, closets, and sometimes on zombies. The yt tutorial says that procedural blocks of code are better left deleted. Why would this be the case? should i leave procedural blocks alone or delete them?
incase i misuse any vocabulary im talking about stuff like this
mmm MSDos theme
looked that up and it looks like a cool theme! i like this blue one tho makes me feel like an epic hackermanโข๏ธ
i think if i werent to delete some of these blocks then the items in this distribution.lua will also spawn with the PZdistibution.lua? making a lot of loot? im working around how this works because i know it makes stuff spawn but i dont know the extent of needing to clean this file
Heh. My boss said he'd help me get certified for security / ethical hacking course.
I already know a lot about how to pen test code though. ;D
ooo cool
i want to learn lua/java exclusively b/c of zomboid right now, but man setting up javac and lua was a nightmare for someone with a lack of knowledge of windows powershell
The problem: Stop doing this old-school.
Try it with IntelliJ IDEA.
=)
I do all my reverse-engineering through that portal.
silently stares at the intellij decompiler thats open because i wanted to look at all the clothing files zomboid has
It's fernflower. JetBrains adopted it.
I've used fernflower for over 10 years now. It's the best one so far.
oooo
Funny how I spoke about this earlier. (Read up)
ive adjusted a little into assetripping/decompiling when i looked through the assets for cult of the lamb (loved the art, scoured for png's) so im getting used to using such tools
ough i can barely get started without the wiki/steam guides lol
explains though why my mod rn is terrible buggy (read: 300 errors), because im just not understanding things work
sprites seem really cool, i liked watching rpg maker games but that's as much experience i had with sprites/sprite art
It's fun when you have the time to do things like that.
it really is! ironic since right now the experience of modding/learning/debugging simultaneously is time-suck, but it is fun!
id love to go back to school for a programming class or something basic, since im only programming for zomboid and the occasional "greeting.java"
Get personal with your ideas and try to write them. After you do, try school.
This will help you get over the learning-curve that spits out ~95% of students.
When you are stuck on something, remember that programming is a form of creative writing.
Make it personal.
oh yeah, learning curves burn me out bad but i learned my lesson with trying blender a few months ago
still suck at modeling but hey, stack exchange is a god send
Something I taught students when I had time to help out people with their class work.
=)
i have. SO many ideas for zomboid (mostly clothing items lol theyre fairly easy to implement methinks) but. fixing errors is the hard part (local14????????)
also YEAH so i shouldnt like. have any issues if i get rid of blocks that are basically not being used for the mod?
I didn't respond to your question because I don't know that side of the game.
Here, I'm a humble tool builder.
OH makes sense srry;;!
All good.
it makes sense though, best to mess around and find out
Going to resume work on my Lua transpiler.
me when i have carpentry 4 but electrical 1
good luck!! plops down next to my burning moniter
It's going well. Writing it way faster than I thought.
It might take weeks instead of a couple months.
it already took me two months trying to get this clothing mod to work ๐ญ
but i have a good feeling about this time 
is this the right place to request a mod to be made? 
been searching for a modding community ๐
I'd argue no. Some people dislike requests being here.
If you are commissioning a mod, it's a little different but same issue with some people.
so let's say i wanna commission a mod, where best to post it?
with rimworld as example there's a dedicated discord for modding, but can't find it for zomboid
There's no official channels. I do have a marketplace on my discord server.
๐
My server is built around my org projects and well these things. I don't advertise it much because I'm either too busy coding and I don't want to piss anyone off here.
I do commissions sometimes.
Built the market for me and others who wants to make something off of comms.
(My org's focus is building tool-solutions for modders)
i used to do bunch of xml coding for rimworld, but i don't quite understand zomboid coding. would love to enter it and maybe request a mod or 2
Do you know TypeScript?
i'm fairly new, only know XML so far, looked into C# too but that's magic to me ๐
If you do and know how to work a node project, TypeScript is an option using PipeWrench.
If you know Lua, that's basically the modding language for PZ.
Try learning it. Maybe you can make it yourself and not pay anyone.
=)
i might look into it later, not much free time with work currently lol
Yeah. I'm code-jamming on the weekends because of work.
but i'd gladly pay commission to get things done
Well I'm open to that. Feel free to use my marketplace if you want to make a post. I might even pick it up.
I have a couple right now that I shelved to work on PipeWrench to improve it.
Question: What in the world can make a context action appear on mouse click, but not controller? What's the actual difference in both in that context?
P.S Conditions I use are one of these compared to string
local spriteName = v:getSprite():getName();
local objectName = IC:getCustomName(v);
local objectGroup = IC:getCustomGroup(v);
So in short its either sprite name or custom IsoObject name+group field.
anyone know what property on isoGrid class to tell if a tile is a light?
You can check what controller use current player
I dont understand why my item is not being registered as a clothing item
DisplayCategory = Accessory Type = Clothing, Displayname = Heart Choker, Clothingitem = heartchoker_freak, Bodylocation = neck, Icon = heartchokerpink, Bitedefense = 5, Weight = 0.1, WorldStaticModel = heartchoker_ground,
^thats its text file, and i keep getting an asset path error for the ground model, which has something to do with bones but im not sure how to fix besides maybe disconnecting it from the armature since it's not on the player model?
I mean there should be none of the difference, yet there is. I'm just not sure what is exact difference in context menu interactions, should I be supporting controllers in some way directly with Lua?
Yep, need to do support gamepads in lua. You can check how it works in vanilla
Do you have that model defined as a model script?
hi! can you elaborate on what you mean?
Hello
To make it short I want to make a server with my friends, and we want to create a profession with custom starter items
Can someone teach me how to do it?
I'm completely new in this kind of thing
Hey folks. Thinking of making a save game mod. Is there a restriction on this sort of thing somewhere? Surprised no one has beat me to it yet
missing comma after accessory
SYNTAX ofc.. well at least the models in the game. textures missing but we'll see
maybe that's also where the missing translation IG UI comes from too
check capitalisation too
oh yeah,,because java.. what should be capitalized? all file names should be case sensitive too?
DisplayName, etc
missing comma fixed, but the worlditem and skinned models are completely invisible, with the player also becoming invis when they travel on the same tile as the model. somehow the png for the item was also darkened
wonder if this is the issue?
i gave an accessory category item bite defense, which is not possible for that category of items? maybe if i change the displaycategory to 'clothing' it will be better?
looking for some advice if anyone is aware. when I'm using
bookItem = ScriptManager.instance:getItem("Base.Lightswitches_fordummies") my main condition for a context menu appearing or not appearing. it seems that it still includes every other book when running through the entire function
can post the entire thing but wouldn't using a condition such as if not bookitem then return end would stop other books? it's not but wondering what i'm missing here
or do i need to use the display name or something as well as a condition?
tried checking playerinv for it but didn't seem to make a diff
bookItem bookitem
Unfortunately following \media\lua\client\Context\World\*.lua I found that actions you are adding in vanilla are pretty much the same addOptions
That's tad confusing now, because somehow controllers get some issue with contexts I create the same way.
being lazy atm but caps aren't off
What problems with controllers you have now?
did you use setTests?
@nova socket
when do you want the option to actually appear?
only when using the book there
Some of the addOption doesn't seem to pop up on controllers
not for any vanilla books
No, what's that about?
so, when you right click and the player is already reading / holding it (using)?
You give this function playerNum?
yes, not using though. just any instance of that item in their inv i suppose
i have been struggling with the correct code to get instance of item in playerinv. specifically
i'm assuming scriptmanager is just getting the item but maybe not the instance of it on me
just get it, why r u even using :getItem from script manager? u need to check type of item that got clicked on
because 
Nope, I just supply it with
addOption:
| ((
name: any,
target: any,
onSelect: any,
... args
I don't really see any playerNum references to properties, neither seen people using that anywhere.. 
in this case i already used for another function and thought i couldreuse, but the more i think i realize i can't
@jaunty marten I mean mod tools are mod tools, function is a snippet pretty much but ok
Oh, you right. Hmmmm
tell me what exactly do u want to do and show the current code
wall incoming
local function readOrNot(player_num, context, items)
local item = items[1].items and items[1].items[1] or items[1]
if item:getType() ~= "Base.Lightswitches_fordummies" then return end
local player = getSpecificPlayer(player_num) -- get player
local bookLevel = SandboxVars.Nipswitch.Booklevel -- Required Electrical level from Sandbox Options
local zapLevel = player:getPerkLevel(Perks.Electricity) -- get player's Electrical level
local lowLevel = zapLevel <= (bookLevel - 1) -- set lowLevel to true if player's Electrical level is equal or below SandboxVars
--local contextRead = context:getOptionFromName(getText("ContextMenu_Read")) -- get "Read" context menu option
local dumbText = getText("ContextMenu_One") -- get text for dumb context menu option from translations
local smartText = getText("ContextMenu_Two") -- get text for smart context menu option from translations
local toolTip = ISInventoryPaneContextMenu.addToolTip() -- get tooltip for context menu option
local previousPhrase = "" -- storing for reference
if lowLevel then -- if player's Electrical level is too low
toolTip.description = dumbText -- set tooltip to dumb text
local rand = ZombRand(1, 4) -- generate random numbers between 1 and 4 even though 4 is nil (reduce chance of similar phrases)
local newPhrase = "" -- set new phrase so able to reference it against previousPhrase
while newPhrase == previousPhrase do -- continue generating new phrase until it's different from previous
if rand == 1 then
newPhrase = "You go cross-eyed trying to read..."
elseif rand == 2 then
newPhrase = "You feel like a complete potato trying to read..."
elseif rand == 3 then
newPhrase = "Your brain hurts trying to read..."
end
rand = ZombRand(3) -- generate a new random number between 1 and 3
end
previousPhrase = newPhrase -- set previous phrase to new phrase
local contextRead6 = context:insertOptionAfter("Read", newPhrase) -- insert new phrase into context menu where "Read" was
contextRead6.toolTip = toolTip -- set tooltip for new phrase
contextRead6.iconTexture = getTexture("media/textures/switch.png")
contextRead6.notAvailable = true -- set new phrase to not available
context:removeOptionByName(getText("ContextMenu_Read")) -- remove "Read" from context menu
else
toolTip.description = smartText -- set tooltip to smart text
local contextRead5 = context:insertOptionAfter("Read", "Read, I am a Smarty Pants!", items, ISInventoryPaneContextMenu.onLiteratureItems, player_num) -- insert custom text into context menu where "Read" was
contextRead5.toolTip = toolTip -- set tooltip for "Read"
contextRead5.iconTexture = getTexture("media/textures/switch.png")
contextRead5.notAvailable = false -- set "Read" to available
context:removeOptionByName(getText("ContextMenu_Read")) -- remove "Read" from context menu
end
end
Events.OnFillInventoryObjectContextMenu.Add(readOrNot)
so the only issue i have is running into trying to grab the correct instance of this book on the player.
or at least only trigger upon this specific item use
Check what happens if force set player to context menu:
context.player = playerObj:getPlayerNum()
context:addOption(...)
--no
local bookItem = ScriptManager.instance:getItem("Lightswitches_fordummies")
local function readOrNot(player_num, context, items)
if not bookItem then return end
--yes
local function readOrNot(player_num, context, items)
local item = items[1].items and items[1].items[1] or items[1]
if item:getType() ~= "Base.Lightswitches_fordummies" then return end
so your local item is just all combination of item names?
trying to make sure i understand what im reading also
and that passes through the function specifically so it only triggers when function in use?
items it's arg for context menu that contain item or items that was be clicked on
in no way u always have bookItem so it will work for everything
not only for Lightswitches_fordummies item
makes sense
this doesn't work for me though
not detecting book
no error but doesn't allow context menu
ill check my conditions quick but i thought it would
it should be blocking read and replacing
i update this now to reflect new code
No errors?
none
good call
it did work when it was detecting the item in the world. just not in its current usage. i'll report back here
NM
it was my naming
since i use Base module
i just removed Base.
local item = items[1].items and items[1].items[1] or items[1]
if item:getType() ~= "Lightswitches_fordummies" then return end
good to go TY @jaunty marten
not call, it's base 
hm?
Oh ๐
i followed the inspect code lol
saw you added a texture in and i think thats dope
easy way to differentiate what is a vanilla option and what is for the lightswitch mod, since it changes a lot of vanilla functions with lights
Appreciate it - and that's a clever use
def helps with people with 300 mods who dont know which context option comes from which mod ahaha
wooo i can't believe i'm so close to finished
last step is using context menu to set ismoveable flag to sprite
since i can't control PickUpLevel since there is no param for it, i figured i can just change the pickuplevel of the tile itself to 10, and then use context menu to set the item to pickupable based on perk level
a little menu that say something like "disconnect wires before removal"
if anyone has a better suggestion please feel free ๐ my brain is running out of juice for this mod
Bashing my head against a wall trying to figure out why the game won't let me disassemble containers with items in them
It wouldn't be so bad if I didn't have to fish through a 3K line file
I thought I had it figured out this morning but apparently not
you want to be able to disassemble even with items?
Yes, it's a mod that I want integrated with another mod I like.
Saves time to not have to manually dump everything on the floor.
It just does it automatically!1
when you destroy them the items drop out
maybe mimic that for disassemble?
also something that occurred to me but I keep forgetting - picking up boxes and stuff
I would be surprised if destroy wasn't running from disassemble.
But I can't even get to that point anyways because it wont let me heccin disassemble things
i see ISDestroy why not just use that
I see a bunch of "scrapObject" checks which I've already mimicked from another mod.
I'm using the vanilla context menu is the thing
Like, the vanilla option to disassemble
why not just change though. is getting items back from scrapping matter?
I just want it to allow me to break the stuff down w/o the check for items
That's usually the entire reason you scrap furniture

If not for the XP
No worries
I just want to retain vanilla functionality and just override that one part
dont know full context to your usage, but i do see
I have the little info menu working correctly, it no longer goes "Container has items" when disassembling.
It just won't let me move forward with the action and it has this weird red blinking effect which is probably unrelated.
Driving me nuts
alot of the context code is giant if chain functions
you might have to replace the entire thing to avoid the 'if items inside stop'
hopefully there's just 1 valid check somewhere
There's supposed to be anyways
"canScrapObjectInternal"
"canScrapObject" exists too but doesn't seem to like
mess with items at all
function ISMoveableSpriteProps:canScrapObjectInternal(_result, _object)
self.yOffsetCursor = _object and _object:getRenderYOffset() or 0;
if not _result.containerFull then
_result.containerFull = not self:objectNoContainerOrEmpty( self.object );
end
local canScrap = not _object or self:objectNoContainerOrEmpty( _object );
if canScrap and self.isTable then
canScrap = not _object:getSquare():Is("IsTableTop") and _object == self:getTopTable(_object:getSquare());
end
if canScrap and instanceof(_object, "IsoDoor") and _object:isBarricaded() then
canScrap = false
end
if canScrap and instanceof(_object, "IsoThumpable") and _object:isDoor() and _object:isBarricaded() then
canScrap = false
end
if canScrap and instanceof(_object, "IsoThumpable") and _object:isDoorFrame() and _object:getSquare():getDoor(_object:getNorth()) then
canScrap = false
end
if canScrap and instanceof(_object, "IsoThumpable") and _object:isWindow() and _object:getSquare():getWindow(_object:getNorth()) then
canScrap = false
end
-- As with ISDestroyCursor, the floor at the top of a staircase cannot be destroyed.
if canScrap and self:isFloorAtTopOfStairs(_object) then
canScrap = false
end
if canScrap and self.isWaterCollector then
if _object and _object:hasWater() then
canScrap = false
end
end
return canScrap;
end
i think its sprites
Literally overwrote that to make "canScrap" true regardless, as the original mod I'm forking did.
(Rewriting that mod and the other from the ground up to be smaller and compatible with each other)
They both overwrote the entire file which makes this
pain
function ISMoveableSpriteProps:objectNoContainerOrEmpty( _object )
for i=1,_object:getContainerCount() do
local con = _object:getContainerByIndex(i-1)
if con and (con:getItems() and not con:getItems():isEmpty()) or not con:isExplored() then
return false
end
end
return true;
end
I try not to use or recommend mods that overwrite the entire files
I wanna make em play nice regardless because A) It's a good excuse to kill time and B) it'd make my future server just that tiniest bit more convenient.
Problem is it's turning out to be too good at killing time

Tiny change in getInfoPanelDescription was needed to get rid of the disassemble item text
if InfoPanelFlags.hasItems and _mode ~= "scrap" then
infoTable = ISMoveableSpriteProps.addLineToInfoTable( infoTable, "- "..getText("IGUI_ItemsInContainer"), 255, 0, 0 );
end
Good afternoon.
canScrapObjectInternal became this
it sounds like your ideas are total rewrites, so i don't think it can really be considered a copyright issue - and ethically, i don't think anyone owns 'wood weighs less' as a concept
(of course anything i say about copyright is not legal advice ^_^)
I'll probably still link the original mods to give credit where credit is due since it's polite but nyeh

function ISMoveableSpriteProps:canScrapObjectInternal(_result, _object)
self.yOffsetCursor = _object and _object:getRenderYOffset() or 0;
if not _result.containerFull then
_result.containerFull = not self:objectNoContainerOrEmpty( self.object );
end
local canScrap = true
if canScrap then
if self.isTable then
canScrap = false
elseif instanceof(_object, "IsoDoor") and _object:isBarricaded() then
canScrap = false
elseif instanceof(_object, "IsoThumpable") and _object:isDoor() and _object:isBarricaded() then
canScrap = false
elseif instanceof(_object, "IsoThumpable") and _object:isDoorFrame() and _object:getSquare():getDoor(_object:getNorth()) then
canScrap = false
elseif instanceof(_object, "IsoThumpable") and _object:isWindow() and _object:getSquare():getWindow(_object:getNorth()) then
canScrap = false
elseif self:isFloorAtTopOfStairs(_object) then
canScrap = false
elseif self.isWaterCollector and _object and _object:hasWater() then
canScrap = false
end
end
return canScrap;
end
Keeps a healthy modding community.
I did minor optimization because yes but it wasn't technically necessary
yesss
I would've done one big if statement but that ruins legibility
This functions about the same anyhow
should probably get rid of the "canScrap" check
since it's always true before checks begin
Speaking of which.. @jaunty marten Did you ever touch the mod loader experiment?
you could have a single instanceof(_object, "IsoThumpable") check
probably could tbh
elseif rand == 3 then
this can simply be
else
Guess I'll do that while I'm here
i had it that way. never triggers 3rd option
ill try again and see
Decided to just move thumpables to the end
ZombRand(3) should be 0-2, not 1-3
i really dont like zombrand
i've tried so many diff ways and it seems like the smaller the number the less frequent it changes
sometimes i'll right click and it will show the same option like 5 times
He uses (1,4) so it's 1-3
oh, i read it backwards ๐คฆ
i tried to store the previous name to reference against new option to cut down on same choice but it doesn't seem effective
i saw ZombRand(3) *after* the ifs and was like 'yep! this must be the random value those ifs use'
this is just sort of true of probability i'm afraid
right haha
why i kinda just let it go
it is random so i can't really complain lol
still have no time 
doing refactoring for my current mod
i could order it that seems boring
I feel this.
haha
[Screams in Transpile]
so would there actually be any dif f between using else and elseif rand == 3 then
i'm trying to go for more random so i wasn't sure
can still be refactored
if self.isTable then
canScrap = false
elseif instanceof(_object, "IsoDoor") and _object:isBarricaded() then
canScrap = false
elseif instanceof(_object, "IsoThumpable") then
if _object:isDoor() and _object:isBarricaded() then
canScrap = false
elseif _object:isDoorFrame() and _object:getSquare():getDoor(_object:getNorth()) then
canScrap = false
elseif _object:isWindow() and _object:getSquare():getWindow(_object:getNorth()) then
canScrap = false
end
elseif self:isFloorAtTopOfStairs(_object) then
I already refactored to account for thumpable hehe
If you stored the last one used you could just make it cycle through
There's only 3 options, you're not going to get much use out of random
Problem is I still can't get it to allow me to scrap, might just shelve it for later.
Someone also recently posted a little formula to handle cycling
Also mfw I had someone comment that I was "updating too frequently" on my mod page despite the fact that I haven't touched my mod in months and I did 2 quick updates over the course of 2 days, both of which were fixes.
elseif rand == 3 requires it to evaluate a condition we already know is true
so the only real difference is one less operation
fair enough
should be
if self.isTable then
canScrap = false
elseif instanceof(_object, "IsoDoor") and _object:isBarricaded() then
canScrap = false
elseif instanceof(_object, "IsoThumpable") then
if _object:isDoor() and _object:isBarricaded() then
canScrap = false
elseif _object:isDoorFrame() and _object:getSquare():getDoor(_object:getNorth()) then
canScrap = false
elseif _object:isWindow() and _object:getSquare():getWindow(_object:getNorth()) then
canScrap = false
end
end
if self:isFloorAtTopOfStairs(_object) then
otherwise it doesn't actually behave the same
you can also make the IsoThumpable check the final condition to accomplish this
Ok i was just simply pointing that the isothump thing
exampleIndex = (exampleIndex % #example) + 1
examples = examples + 1
I think you can use this to simply have the messages cycle through
i thought about it
something about the thought of always knowing what the next option is going to be though.... why that affects my decision...
LOOL
thank you though it honestly makes sense
I think you'd need like 5 lines at least to avoid alot of repeats
well time to change the tile properties and move to phase 5 of the nippytime universe
Nippy only started to code less than a month and the progress is amazing dont you think
the completion stage
ty i still have a LONG way to go haha
i came for the mapping i stayed for the modding ๐
glad i learned mapping before modding though. i probably never would have learned it otherwise
I also suppose this is a good moment to thank all the people who help me understand all this stuff as well ๐
Hahahaha
I just threw ISBaseObject.lua into my transpiler.
It's soo broken.
I love seeing such broken code
all of the nope.
OMG I FIXED IT
IT WAS THE STUPID TABLE CHECK
I ACCIDENTALLY OVERWROTE IT TO ALWAYS SAY FALSE INSTEAD OF USING THE ORIGINAL LINE

Now to solve it not dropping the items
Hey everyone! Nice meeting you'll and I hope your are all doing all right.
This has probably been asked before, but I'm trying to the most basic weapon mod so I can learn in the process. I'm making a stick, but it does not show in the game, it is transparent even though I can Spawn it an see it in the inventory and I can use it to hit zombies and windows.
I dont know what I'm missing, so far I've made one stick.x file with the model, one stick.png for the textures and one Item_stick.txt which is almost an exact copy from the lead pipe entry
I think u will get much help in #modeling
Thanks mate.
u r welcome 
Okay, it remains to make a guide for vehicle scripts and then a guide for all scripts will be ready!
Sounds good.
You're the hero we all needed
I'm implementing metatable transpilation right now.
getSprite("..."):getProperties():Set("PickUpLevel","5")
Anyone knows how to completely remove the loot distribution of a vanilla item? Want to replace batteries with battery packs in this case
Would probably have to loop through the distributions and replace as necessary.
Or remove, if you don't want the chances to be the same.
completely replacing the distribution file?
You wouldn't replace the distribution file itself, you'd just hook onto it and modify if dynamically via fancy code!
It's been a hot second but I think I did something similar for one of my mods.
ty for the info! if you can give me an example or a mod to reverse engineer would be really appreciated
I set it up like this for my "Ultimate Farming Patch" mod to allow replacement of the seed packets, it's technically superseded at this point since with the mod you can combine different seed types from different mods- but that's besides the point.
local function fixDistributions()
for _, v in pairs(ProceduralDistributions.list) do
if type(v) == "table" then
local itemList = v.items
if itemList then
MoFilchers.patchItemsInList(itemList)
end
end
end
for _, v in pairs(SuburbsDistributions) do
if type(v) == "table" then
for _, l in pairs(v) do
if type(l) == "table" then
local itemList = l.items
if itemList then
MoFilchers.patchItemsInList(itemList)
end
end
end
end
end
for _, v in pairs(VehicleDistributions) do
if type(v) == "table" then
local itemList = v.items
if itemList then
MoFilchers.patchItemsInList(itemList)
end
end
end
end
Lemme get the "patchItemsInList" function rq
You'll likely need to modify it a bit, but this is a place to start.
how are you making it moveable, which parts do you edit.
function MoFilchers.patchItem(list, oldItems, newItem)
for _, i in pairs(oldItems) do
local index = MoFilchers.getIndexOf(list, i)
if index > -1 then
local rarityIndex = index + 1
if rarityIndex <= #list then
local rarity = list[rarityIndex]
if type(rarity) == "number" then
if MoFilchers.replaceSeeds then
list[index] = newItem
else
table.remove(list, rarityIndex)
table.remove(list, index)
end
end
end
end
end
end
function MoFilchers.patchItemsInList(list)
for _, item in pairs(MoFilchers.allItems) do
local mod = MoFilchers.getHighestModWithItem(item)
if mod then
local itemsToPatch = {}
for modID, values in pairs(MoFilchers.itemConversions) do
if modID ~= mod then
local oldItem = values[item]
if oldItem then
if oldItem.seedData then
table.insert(itemsToPatch, oldItem.seedData.seedName)
else
table.insert(itemsToPatch, oldItem.itemName)
end
end
end
end
MoFilchers.patchItem(list, itemsToPatch, item)
end
end
end
You'd instead just skip straight to "itemsToPatch" if I understand my own code correctly.
Apologies if this is all a bit weird, this was when I was first setting up the framework so it's a little old

Hopefully it can help you a bit with some modification though, I was having to patch an entire table / dictionary of items while you'll only need to do one from the looks of it.
Don't worry, i don't fully understand it but because i'm still learning, will take an eye and try to learn
It can be simplified a lot for your use case so yeee
If you need any help with it, do let me know. I would link the mod but the functions associate with such a large file I worry it'd overwhelm you more than it's worth.
(I love a 4K+ line data definition dictionary!)
Ty! if i have any question will def ask ๐
hey, is there a way to intercept a Java only method to at least get some of its parameters?
Is it called from lua?
#mod_development message
yo guys is there a function(or mb event) in lua that handles drinking alcohol with meds? didnt saw that in def of any meds or booze
Finally . . . done . . . for now . . . (support for faction and safehouse UIs has arrived for gamepad players).
https://steamcommunity.com/sharedfiles/filedetails/?id=2922618524
It worked for me from console, which is why I posted it.
Things to consider: this should be done after spritemanager has started most likely. Event: OnLoadedTileDefinitions, gives you the instance when loading game. Though I have never used it.
Absolute legend
passes out
Just got my little mod wrapped up as you posted that hehe
Finally I can rest easy knowing there's one less minor incompatibility in my server
~w~
Now to go solve another one with wood weight!
@quasi kernel "This mod was created with the sole purpose of improving furniture and containers just that little big" <--- bit*
Oop thank
โค๏ธ
Umm yeah scooping this one for sure.
Clutch
Never seen a nailed down couch in my life.
It bothered me so much that those two mods specifically weren't compatible
You killed it
Game dead
Game eliminated by pwrcosmic with a mod.
lol but f.r. vanilla couches are nailed down why?
where does the person who made that decision live?
that such things are normal?
No clue
oh didn't notice this. tile properties edit
i will attempt to try this because it should work if it's a thing. i got no errors with it, just didn't actually update the value
maybe i missed a condition correctly
i'll try again. i'd really prefer that way.
i will test with OnLoadedTileDefinitions maybe
oh i also just saw your other comment lol... i'll try another way then, maybe chunk load if there is one
@drifting ore try it from console first to see that it works as intended, if it does then you just need to figure a good moment to do it
Sounds good. Just about to jump on and try. Really appreciate you sharing that info about distro stuff and this. ๐ฅ
yo, anyone knows why getName() from zombie.inventory.InventoryItem gives DisplayName an not actual nameID of the item? Or am i wrong and there is another method for that?
getType()
oh. ty
getFullType() if you want it to include the module ('Pencil' vs 'Base.Pencil')
tysm. didnt thoght about it
I fought with the Lua Gods today..
I barely just survived it all.
The amount of logic and hackery to get this result is.. Yeah.
Not proud.
I'll need to modify the derive method but yeah holy heck.
I have to mark and handle these methods carefully.. To the point where I have to delete the empty table statement and replace it with the new function.
derive function calls for class objects will be tricky.
_proto_ chain hell..
this is such a non factor issue, but if anyone knows..... what i use to get an icon to appear in the Items List Viewer?
i thought Icon would do it but it works in inventory, just not in that screen
I tried, I failed
maybe if they were in a pack or something
hmm they are... maybe ill check the newdef tiles
see what it could be doing there
i thought for sure it would be a script thing but yea, no
you could edit the UI maybe, didn't want to go that far
nahhh lol
TY haha
the fact that i added icons to all my context menus was enough lol
plus i love doing absolutely useless things
aaaaaaaaaaaaaa
like randomizing context menus just for the extra chance to see a new phrase ๐
I might have to jerry-rig the utter shit out of ISBaseObject and then modify derives.
this is why I don't like and will forever call 'pseudo-classes'..
it works btw so i just gotta figure out best way to do it
as im sure you knew but i guess i'm just doing something wrong in how im calling it. no horribly surprised ๐
time to simplify
I think the only thing that I'll need to fix is the Type assignment.
/* FILE: ./assets/media/lua/test//class.lua */
function ISBaseObject() {};
ISBaseObject.Type = "ISBaseObject";
ISBaseObject.prototype.initialise = function() {};
ISBaseObject.prototype.derive = function(type: any) {
const _proto_ = this.prototype;
return function() {
this.prototype.prototype = _proto_;
this.Type = type;
};
};
Straight-up override the derive function haha.
is there an event that triggers only when cursor is on a tile?
hmm maybe that wont work either. i can create a custom event that only triggers when place tool is active?
local lights = {"lighting_indoor_01_0", "lighting_indoor_01_1", "lighting_indoor_01_2", "lighting_indoor_01_3", "lighting_indoor_01_4", "lighting_indoor_01_5", "lighting_indoor_01_6", "lighting_indoor_01_7"}
local function moveLevel()
--local sprSwitch = getSprite():getProperties():Val("CustomName") == "Switch"
for _, light in pairs(lights) do
if not getSprite(light) then return end -- if not sprite, exit function
--if light then
getSprite(light):getProperties():Set("PickUpLevel","7")
--end
end
end
Events.EveryOneMinute.Add(moveLevel)
what im using atm
The reason why ISItemsListViewer doesn't show icons for mod items is it calls getTexture("Item_" .. icon) and that returns nil, to get the texture I use Texture.trygetTexture("Item_" .. icon) instead. In case anybody has any use for this or suggestions.
Did that work?
yes it's working. testing using sandbox now
prefer not to use every minute tbh since the condition is a lightswitch sprite which are everywhere
also you can only see when using place tool
It only need to be done once everytime you load the game
it wont show you pickup level otherwise tha ti can see
really?
i thought it happened on load sprite
ill try again
so OnNewGame should work
that does not happen every time you load the game
do you even need to attach it to an event?
oh shiiii. good to know lol... wth
i'd assume so. if i dont it's just looping thru this table for no reason? keep in mind i dont know what casuess real prerformance issues
are there other places it would be visible?
but yeah, OnNewGame is only for new games - OnGameStart is called for both that and loading
not to my knowledge
ohh got it
so far i havent been able to see pick up level unless im picking up
only place i've noticed
another weird thing i noticed... wheni choose 1-8 the skill level is correct
when i choose 9 it changes to 3
Every programmer big endless loop
Thank you!
Thank you aswell!
this pickuplevel 9 showing as 3 thing has just got me stumped lol wtf
i wonder if somehow the default level being 7 made a difference, but why level 9.... lol 
Has anyone modified vehicle glovebox/trunk/gastank capacities with vehicle tweaker?
i did this, which depends on
this.. which uses vehicle tweaker api
so yes, indirectly
ty! saw it, tried to reverse engineer eggons but had not found a proper way to do so, will take an eye
How would I go about randomly spawning a set of specific objects/tiles into the world on random squares in each cell, upon world creation?
I feel like this is one of those things that sounds really simple in concept, but is probably complex as heck lolz
If it's of any help, we're talking single-square object, rotation/direction doesn't matter.
Only real requirement is that it only does this once per cell, and that I can do it in a while loop aha
you can't do it 'upon world creation' because we can't mess with unloaded areas
the best you can do is live spawn them to give the illusion that they were always there
World tasks cache when?
A cache for actions when the chunk loads the next time would save a lot of grief.
One could write it in Lua.
Store Lua code even
i'd love something like that, though i'm not fancy of dependencies
I really am crazy. 
Could include that in your code.
It'd be simple to write.
Is this actually a desired solution for many modders ?
i already do something sort of like this, but if it were one system it'd save performance at scale
i've heard a lot of complaints about the performance of such systems, not really sure how substantiated it is myself
i haven't had performance complaints towards any of my mods but i think you'd have to really fuck up to get direct complaints about an issue to which the source is mostly invisible to users like that
Yep, I have just been looking through the docs, and looks like the closest I can do is OnPostMapLoad to get the cell that loaded, which is perfectly fine too; I can count number of X object in cell somehow, and if greater than or equal to 1, skip spawning them, I think
It'd be file IO and event checking
is your solution relying on the idea that IsoCell is a map cell?
Well, it returns the Cell, X, and Y of cell that loaded >.>
i think the wiki must just be totally wrong on what this event does
First parameter returned is supposedly in fact an ISOCell... >.>
https://pzwiki.net/wiki/Modding:Lua_Events/OnPostMapLoad
IsoCell isn't a map cell, it's just the loaded area
hmm... alright, but in theory I could figure out the cell based on the X,Y coordinates returned, yea?
well the biggest issue is this idea is relying on this event to be called every time a cell 'loads' right?
(back to drinking and lurking)
but there's only one cell, it doesn't change - this event is just called during creating/loading a save
you can sort of do what you want with LoadGridsquare - you can't really measure how many are in a map cell because a map cell doesn't really exist at runtime, but you can populate the world using that
i've been cautioned a lot to be very careful with performance when using that event, so i'll extend that to you
When it comes to performance, every event is questionable.
Focus first on making it work, then make it work better.
Hmm... yeah, if that's running on every square, it could potentially have an impact, though, the worst impact would be the first time it runs the second half of the script, actually generating the objects into that cell, based on the square...