#mod_development

1 messages ยท Page 112 of 1

tacit tree
#

Ok, but a weapon doesn't have "WorldStaticModel" defined in any of the mods I've been looking at.

true vault
#

Well, wherever in the weapon definition you set the model it's using, it would be that. same concept really

tacit tree
#

Ok.

rain iron
#

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 )

tacit tree
tacit tree
#

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

true vault
tulip wolf
#

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

drifting ore
#

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..

tulip wolf
#

Beautifulbaseballbat

drifting ore
#

nice!

thick karma
true vault
drifting ore
#

don't need admin is all. but i can use it

#

it just doesn't actually change the displayed level for PickUpLevel

true vault
#

Fair enough

drifting ore
#

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 vault
#

True... could do if isAdmin or perks.Electricity > 5 then type of thing...

drifting ore
#

no admin tho

#

just for players

true vault
#

I mean, without that then server admins would have to manually set their elec perk to that level or higher to do so

drifting ore
#

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

true vault
#

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.

drifting ore
#

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"

true vault
#

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

drifting ore
#

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.

true vault
#

You can manually say that in the context menu of course.

drifting ore
#

although using context menu is seeming like maybe a fun way to handle it

#

yea

#

seems like the best way

true vault
#

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.

drifting ore
#

gonna try this out lol

#

this is the last part before the update goes out

#

huge update also

#

essentially overhauls how lightswitches work completely

true vault
#

nice, nice... I'm getting close to an alpha release myself. Good luck :3

drifting ore
#

ty! you too

true vault
#

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)

drifting ore
#

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

true vault
#

Agreed; I woulda never understood the Lua side of mods without some prior coding experience lolz

drifting ore
#

took me a month just to mostly understand how arguments are called through functions

true vault
#
if player.Nippy(isWeird) then
  return true
end
drifting ore
#

๐Ÿ˜„

true vault
#

giggle โฃ๏ธ hehe

glass basalt
#

how do I, as a contextmenu option, change one item into another instantly? Does it require ItemTweaker?

humble oriole
#

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

humble oriole
glass basalt
#

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

drifting ore
humble oriole
#

won't that remove it from all distributions?

drifting ore
#

oh yes one sec

#

oh i guess you need to loop through the list of zombie targets

#

but same thing

humble oriole
#
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

drifting ore
#

you dont want suburbsx

#

Distributions[1]

humble oriole
#

hmmm

drifting ore
#

the only thing you have that is diff from me spawning on zombies is that

humble oriole
#

procedural doesn't do anything with zeds, does it?

ancient grail
drifting ore
#

hahaha

#

maybe it doesn't but i know the [1] does

#

i dont think you actualyly have to require anything tbh

humble oriole
#

probably not

#

I'll loop through and try to figure it out

drifting ore
#

use the table Distributions[1] but use the zombie targets

#

i bet you it works

humble oriole
#

ok, thanks, I'll give it a shot

glass basalt
#

having an issue where the new context menu option I've made isn't showing up for my item, not sure what's wrong

drifting ore
#

show code

#

im doing contexts atm so can prolly get you through it lol

glass basalt
#

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);`

drifting ore
#

no error?

glass basalt
#

it's probably context:addOption(), as I don't know what that does

#

no error, simply no context menu option

drifting ore
#

oih wait

glass basalt
#

ah, the action is still PocketTV.switchModeAction, ill change that rn

drifting ore
#

did you add the translation? also

glass basalt
#

yeah, the ContextMenu translations are there

drifting ore
#

gotcha

glass basalt
#

gonna run again

drifting ore
#

i have a good feeling for ya this time in that case

glass basalt
#

hmm, still nothing

drifting ore
#

๐Ÿคž

glass basalt
#

lemme ss

drifting ore
#

try to get it to appear without functionality. just use context:addOption(getText("ContextMenu_PocketTV3TVMode_switchMode")

glass basalt
#

it's missing "Switch to Radio Mode"

#

will do

drifting ore
#

that will make appear but do nothing

#

if you get that far then your args after will be where you wanna look at

glass basalt
#

hmm, an error came up but I can't see it

#

on game boot

drifting ore
#

uhhh

#

shouldnt see any error until context menu i'd think

#

unless something else

glass basalt
#

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?

drifting ore
#

from what you pasted?

glass basalt
#

No context menu option, even with it being empty
I think I'm not correctly doing my condition for the items

glass basalt
drifting ore
#

ahh

#

so back to no error and no option?

#

then it has to be condition for sure

glass basalt
#

yep, its probably the condition

#

hasTag checks for the tag itself, right? no Base?

drifting ore
#

well yea because the tag isn't the item

#

it's the item tag

glass basalt
#

ah shoot

#

lemme change that

drifting ore
#

like sharpknives

#

is a tahg

#

tag

#

maybe not spelled exaclt correct

#

ScriptManager.instance:getItem("Base.item")

glass basalt
#

item:getType() returns the ID without Base? I think getFullType() gives the module as well

#

gonna try

#

finally. time to add the args

drifting ore
#

sweeeet

glass basalt
#

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

drifting ore
#

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?

glass basalt
#

do you mean the ISBaseTimedAction? I took this from the modding resources, not sure exactly how it works

#

my whole file is here:

drifting ore
#

put icons on my context menus haha

glass basalt
#

nice. you have the light switch mod, right? looks really neat, wasn't sure how well it works though

drifting ore
#

it only works to move around inside houses atm

#

doesn't work if the room doesn't have a roomdef

#

update will change that

glass basalt
#

do the houses have predefined ceiling lights?

drifting ore
#

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

glass basalt
#

neato, ill check it out then

drifting ore
#

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

glass basalt
#

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

drifting ore
#

oh yea

#

just use the reference to item via local and use that instead of items in arg there

glass basalt
#

wdym by that

#

no self?

#

self.item

drifting ore
#

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

glass basalt
#

it's a part of a list within a loop

drifting ore
#

ahhh

#

ohh i totally misread im a dummy

#

so it's working just you have an old item still there?

glass basalt
#

yeah it's still in the primary slot

#

when i equip anything else it disappears

drifting ore
#

cant you just not allow to do it while eqipped

glass basalt
#

I'd like to have it not be equipped, and instantaneous

drifting ore
#

not really sure the context for need there

#

can you force the unequip

#

i think also timed action?

glass basalt
#

maybe, i will pull up the resource I was using

true vault
drifting ore
#

i meant you can

#

not can you

glass basalt
#

how would I do that

drifting ore
#

oh shoot lemme see

glass basalt
#

I only see a force complete, is that what I want?

true vault
drifting ore
#

wells cost like 1k stone so yea

#

for sure! LOL

drifting ore
glass basalt
#

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

drifting ore
#

yes you have to remove that

true vault
drifting ore
#

hey its okay to have a few stone piles. better that way

glass basalt
agile lily
#

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 ๐Ÿซก

true vault
#

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

drifting ore
#

yea its not against the rules if you aren't spamming

drifting ore
#

or at least i haven't seen anyone complain ๐Ÿ˜„ i dont know all the rules haha

agile lily
#

Hahaha that's fair enough! As long as you're not spamming the place with walls of text ๐Ÿ˜‚

true vault
#

...are we talkin somethin like a Mr White mobile lab van setup possibility? lolz

glass basalt
agile lily
# true vault What's the eventual end goal, or theme for it? Are we talkin somethin like Jigga...

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 :>

true vault
#

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

drifting ore
glass basalt
#

my issue is the ISUnequipAction, I don't think my script can find it

drifting ore
#

nah it should

#

it's global right?

#

so it should be fine

glass basalt
#

idk, i can't find any information on this

#

I changed it to item, gonna try again

drifting ore
#

player shoudl work and item and time

agile lily
# true vault hmm... that actually sounds really interesting; would def use that on a few of m...

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 ๐Ÿ‘€

glass basalt
#

woah... getting a super weird error now. My player object is having an issue??? gonna check it

agile lily
glass basalt
#

maybe i need to call char?

drifting ore
#

maybe? but i wouldnt think so

glass basalt
#

I took some of this from another mod, the only thing that's mine is that ISTimedActionQueue.add

true vault
#

@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...

drifting ore
#

youre not getting an error on that 3rd line?

glass basalt
#

nope

drifting ore
#

ISWorldObjectContextMenu.equip(char, char:getPrimaryHandItem(), item, true, false);

#

wth lol

glass basalt
#

i got an error within ISUnequipAction

drifting ore
#

what error you seeing?

#

oh ok

#

what is it sayingh

agile lily
glass basalt
#

i need to pull it up again. it was referring to hotbar and player

drifting ore
#

i'm guessing uses another arguement

true vault
#

thumbsup 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 >.>

glass basalt
#

it needs getPlayerNum

drifting ore
#

ah

#

also you can pass the argument for hands also after time

agile lily
drifting ore
#

at least im fairly certain

glass basalt
#

how would I define primary hand

drifting ore
#

primary lol

glass basalt
#

as a string?

drifting ore
#

yes

glass basalt
#

ok

drifting ore
#

50, primary

true vault
#

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

glass basalt
#

time to try again

drifting ore
#

has to pass to function tho

#

or that action at least

#

GL

humble oriole
true vault
#

You want to simply remove it from their inventories, yeah?

humble oriole
#

yes

true vault
#

You could remove it from corpses on death

glass basalt
#

...what does it want from me? ๐Ÿ˜ญ

humble oriole
true vault
#

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 shrug

glass basalt
#

yeah, first time i put a log into an event for onplayerupdate I was astonished how fast it was calling

true vault
#

@glass basalt yeah, like every millisecond lolz.... try adding a print in there... that'll kill any machine that's not decent

bronze yoke
#

i tried the same thing myself and it didn't work well

#

and it makes sense to me that it shouldn't really work

true vault
bronze yoke
#

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

glass basalt
#

albion, do you have experience with ISUnequipAction?

bronze yoke
#

none

glass basalt
#

darn

true vault
#

Nothing to add to inventory after the fact, with empty tables >.>

bronze yoke
#

that makes sense!

#

i had wanted to use it to optimise some dummy item code but it didn't work out

drifting ore
#

i mean it's like the only thing i can think of

#

can you just remove it and try?

true vault
# bronze yoke i had wanted to use it to optimise some dummy item code but it didn't work out

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)
drifting ore
#

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

bronze yoke
#

yeah that makes sense, you already delete everything that it doesn't work for

true vault
#

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.

bronze yoke
drifting ore
#

if your targets are zeds yes

humble oriole
drifting ore
#

then you dont need that condition

humble oriole
#

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

drifting ore
#

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

glass basalt
#

is there any documentation for ISWorldObjectContextMenu or ISUnequipAction?

bronze yoke
#

the answer to any question that starts with 'is there any documentation' is no

glass basalt
#

๐Ÿ˜”

drifting ore
#

it's not the menu giving you trouble from what iseen

#

it's the action you want to take from clicking the menu

glass basalt
#

is there somewhere where I can look at the IS java classes? I don't see them in the modding index

bronze yoke
#

they aren't java

glass basalt
#

ah shoot

drifting ore
#

yea i had to give up the replacing context menu for removing lightbulb

#

even when i thought i got it right i didnt

humble oriole
tacit tree
#

In an item script, is there a particular order the parameters must be written in for the game to read it properly?

glass basalt
bronze yoke
#

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

tacit tree
# glass basalt no

Ok then, would someone be able to review my script file and tell me what is wrong? This is driving me nuts.

glass basalt
#

for your weapon? I don't have experience with weapons & models, I apologize

drifting ore
#

this is the channel for that

#

you just post it

tacit tree
#

I've spent 3 days of my life trying to figure this bleep thing out.

drifting ore
#

no need to ask permission. if noone can help they just wont respond to you ๐Ÿ˜„

tacit tree
drifting ore
#

NM

#

ignore that it's just REALLY long

#

i gotta download this one lol

humble oriole
#

You should really be using base with Brita's stuff, they do everything from Base

tacit tree
drifting ore
#

so are you even getting any error with it?

#

or just nothing

tacit tree
#

No errors.

#

Game just doesn't seem to recognize the item as a weapon.

#

I can equip it, but it's just empty hands.

humble oriole
#

did you write the xmls to attach it to the hands?

tacit tree
#

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.

tacit tree
faint jewel
#

scale / position.

tacit tree
faint jewel
#

that's 9 /10 times what cause it to not be visible in the hands

tacit tree
faint jewel
#

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?

tacit tree
#

Yes. Both the model and the script file.

No... I did not think of that. Wouldn't that cause a conflict?

humble oriole
bronze yoke
#

if you get that working consistently i'd like to hear how

humble oriole
#

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

drifting ore
#

oh why don't you just use a value but multiply it by .000000001

#

๐Ÿ˜„

humble oriole
#

I tried with more loot settings to just do Base.Bullets57Box:0

#

but nothing happened lol

drifting ore
#

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

humble oriole
drifting ore
#

LOL

humble oriole
#

it's a good thing I saved that excel sheet

drifting ore
#

i posted this before but this is what i consder low spawn rate for my book

humble oriole
#

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

drifting ore
#
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

humble oriole
#

I actually just need to do it for vanilla items

drifting ore
#

i meant more for the values lol

humble oriole
#

I noticed that when I drop the multiplier on loot below .5 it just rounds to 0 and doesn't do it

drifting ore
#

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

humble oriole
#

doesn't it round to 0 at some point?

drifting ore
#

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

humble oriole
#

the zed loot stuff is a roll on x items, doesn't it just roll against the table and pick one?

drifting ore
#

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

glass basalt
#

`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`

drifting ore
#

ahh

tacit tree
# drifting ore i gotta download this one lol

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.

drifting ore
#

myb i must have misread for equipped

glass basalt
#

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

true vault
#

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?

humble oriole
#

those just affect foraging

true vault
#

thumbsup cool beans, thanks

glass basalt
#

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.

drifting ore
#

nice! i haven't asked... what is the mod supposed to do?

glass basalt
#

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

drifting ore
#

lol nah dont be!

glass basalt
#

I wasted a whole day on this nonsense. I have college assignments to do but that's on me for not prioritizing it

drifting ore
#

pre-game brain for assignments lol

glass basalt
#

my assignments are writing papers... if only it was code

drifting ore
#

haha

wintry dune
#

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!

glass basalt
#

which folder do you have it in

wintry dune
#

C:\Users***\Zomboid\Workshop\ "modname"

fast galleon
fast galleon
wintry dune
#

woops under "modname"

fast galleon
wintry dune
fast galleon
#

there should be a template mod in there to copy from

#

workshop/my folder/content/mods/modFolder

wintry dune
#

i see, i will try to follow the template and update!

fast galleon
#

if you use -nosteam, you should just put it into the mods folder

wintry dune
#

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

fast galleon
wintry dune
#

oooh ok

wintry dune
#

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

fast galleon
#

I don't think that should be an issue. Names can usually be changed.

wintry dune
#

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.

weary dock
#

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)

wintry dune
#

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 ๐Ÿ˜ญ

drifting ore
#

-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

wintry dune
#

thanks!

fast galleon
#

@red tiger
What are some common artefacts from decompiling java?

quasi kernel
#

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.

quasi kernel
#

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

rustic garnet
#

Is it possible to get Intelisense for PZ? So that you can see all the functions that you can call from player and such?

quasi kernel
#

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?

fast galleon
#

good evening

red tiger
#

JAD too but I only use it as a backup.

#

What artifacts are you dealing with?

fast galleon
#

I am mostly curious about how accurate it is / what can be decompilation errors and such.

red tiger
#

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.

red tiger
#

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.

fast galleon
#

thank you for explaining

red tiger
red tiger
#

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.

frank elbow
#

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

worldly olive
red tiger
worldly olive
worldly olive
red tiger
#
GitHub

TypeScript typings for ProjectZomboid Java API. Contribute to asledgehammer/PipeWrench development by creating an account on GitHub.

GitHub

Implemented TypeScript support for modding Project Zomboid. - GitHub - asledgehammer/PipeWrench-Template: Implemented TypeScript support for modding Project Zomboid.

worldly olive
#

Thanks!!

red tiger
#

No problem.

#

I'm working on improving the Lua to Typescript transpiler by rewriting it.

worldly olive
#

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?

red tiger
#

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

quasi kernel
#

Just combined two 3000+ line mods into a small, 264 line one.

#

This does bring a smile to my face

worldly olive
worldly olive
quasi kernel
#

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

worldly olive
#

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

quasi kernel
#

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.

fast galleon
#
ProceduralDistributions.list.test1 = {
    rolls = 4,
    items = {
        "ElectronicsMag4", 1,
    }
}
ProceduralDistributions.list.test1 = {
    rolls = 4,
    items = {
        "ElectronicsMag4", 1,
        "Nails", 1,
        "Nails", 1,
        "Nails", 1,
    }
}
fast galleon
wintry dune
#

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

red tiger
#

mmm MSDos theme

wintry dune
#

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

red tiger
#

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

wintry dune
#

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

red tiger
#

Try it with IntelliJ IDEA.

#

=)

#

I do all my reverse-engineering through that portal.

wintry dune
#

silently stares at the intellij decompiler thats open because i wanted to look at all the clothing files zomboid has

red tiger
#

I've used fernflower for over 10 years now. It's the best one so far.

wintry dune
#

oooo

red tiger
#

Funny how I spoke about this earlier. (Read up)

wintry dune
#

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

red tiger
#

I've modded since 2003. =)

#

I was asset-ripping for people like spriters' resource.

wintry dune
#

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

wintry dune
red tiger
#

It's fun when you have the time to do things like that.

wintry dune
#

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"

red tiger
#

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.

wintry dune
#

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

red tiger
#

Something I taught students when I had time to help out people with their class work.

#

=)

wintry dune
#

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????????)

wintry dune
# red tiger mmm MSDos theme

also YEAH so i shouldnt like. have any issues if i get rid of blocks that are basically not being used for the mod?

red tiger
#

Here, I'm a humble tool builder.

wintry dune
#

OH makes sense srry;;!

red tiger
#

All good.

wintry dune
#

it makes sense though, best to mess around and find out

red tiger
#

Going to resume work on my Lua transpiler.

wintry dune
wintry dune
red tiger
#

It's going well. Writing it way faster than I thought.

#

It might take weeks instead of a couple months.

wintry dune
#

it already took me two months trying to get this clothing mod to work ๐Ÿ˜ญ
but i have a good feeling about this time gnome

pallid coral
#

is this the right place to request a mod to be made? toothless_look

#

been searching for a modding community ๐Ÿ˜›

red tiger
#

If you are commissioning a mod, it's a little different but same issue with some people.

pallid coral
#

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

red tiger
red tiger
#

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)

pallid coral
#

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

pallid coral
#

i'm fairly new, only know XML so far, looked into C# too but that's magic to me ๐Ÿ˜›

red tiger
#

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.

#

=)

pallid coral
#

i might look into it later, not much free time with work currently lol

red tiger
#

Yeah. I'm code-jamming on the weekends because of work.

pallid coral
#

but i'd gladly pay commission to get things done

red tiger
#

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.

nova socket
#

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.

modern dirge
#

anyone know what property on isoGrid class to tell if a tile is a light?

tame mulch
wintry dune
#

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?

nova socket
tame mulch
nimble spoke
wintry dune
junior prairie
#

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

hot steppe
#

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

fast galleon
wintry dune
#

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

fast galleon
#

check capitalisation too

wintry dune
#

oh yeah,,because java.. what should be capitalized? all file names should be case sensitive too?

fast galleon
#

DisplayName, etc

wintry dune
# fast galleon missing comma after accessory

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?

drifting ore
#

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

nova socket
#

That's tad confusing now, because somehow controllers get some issue with contexts I create the same way.

drifting ore
#

being lazy atm but caps aren't off

tame mulch
fast galleon
#

did you use setTests?
@nova socket

fast galleon
drifting ore
#

only when using the book there

nova socket
drifting ore
#

not for any vanilla books

nova socket
fast galleon
tame mulch
drifting ore
#

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

jaunty marten
nova socket
# tame mulch You give this function playerNum?

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.. stressed

drifting ore
nova socket
#

@jaunty marten I mean mod tools are mod tools, function is a snippet pretty much but ok

tame mulch
jaunty marten
drifting ore
#

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

tame mulch
jaunty marten
drifting ore
#

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?

jaunty marten
#

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

drifting ore
#

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

drifting ore
sour island
#

No errors?

drifting ore
#

none

sour island
#

Try putting prints under the ifs

#

Confirm its doing what you think it is

drifting ore
#

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

jaunty marten
drifting ore
#

also ty @sour island i figured out hwo to use icons from the debug tool

#

LOL

sour island
#

hm?

drifting ore
#

yea your AUD

#

the community debug tools

sour island
#

Oh ๐Ÿ˜…

drifting ore
#

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

sour island
#

Appreciate it - and that's a clever use

drifting ore
#

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

quasi kernel
#

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

drifting ore
#

you want to be able to disassemble even with items?

quasi kernel
#

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

sour island
#

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

quasi kernel
#

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

drifting ore
#

i see ISDestroy why not just use that

quasi kernel
#

I see a bunch of "scrapObject" checks which I've already mimicked from another mod.

drifting ore
#

if chuck says they fall anyways

#

wouldn't that suffice for your intentions?

quasi kernel
#

I'm using the vanilla context menu is the thing

#

Like, the vanilla option to disassemble

drifting ore
#

why not just change though. is getting items back from scrapping matter?

quasi kernel
#

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

drifting ore
#

haha yea

#

lolol i wasn't sure if that purpose mattered sorry haha

quasi kernel
#

If not for the XP

#

No worries

#

I just want to retain vanilla functionality and just override that one part

drifting ore
#

dont know full context to your usage, but i do see

quasi kernel
#

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

sour island
#

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

quasi kernel
#

There's supposed to be anyways

#

"canScrapObjectInternal"

#

"canScrapObject" exists too but doesn't seem to like

#

mess with items at all

sour island
#
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
drifting ore
#

i think its sprites

quasi kernel
#

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

sour island
#
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

quasi kernel
#

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

drifting ore
#

lol modding fun

#

๐Ÿ˜„

#

16 hours later....

quasi kernel
#

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
red tiger
#

Good afternoon.

quasi kernel
#

canScrapObjectInternal became this

bronze yoke
quasi kernel
#

Sweet

#

That's one less worry

bronze yoke
#

(of course anything i say about copyright is not legal advice ^_^)

quasi kernel
#

I'll probably still link the original mods to give credit where credit is due since it's polite but nyeh

quasi kernel
# sour island ```lua function ISMoveableSpriteProps:canScrapObjectInternal(_result, _object) ...
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
red tiger
quasi kernel
#

I did minor optimization because yes but it wasn't technically necessary

quasi kernel
#

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

red tiger
#

Speaking of which.. @jaunty marten Did you ever touch the mod loader experiment?

bronze yoke
#

you could have a single instanceof(_object, "IsoThumpable") check

quasi kernel
#

probably could tbh

ancient grail
quasi kernel
#

Guess I'll do that while I'm here

drifting ore
#

ill try again and see

quasi kernel
#

Decided to just move thumpables to the end

bronze yoke
#

ZombRand(3) should be 0-2, not 1-3

drifting ore
#

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

sour island
bronze yoke
#

oh, i read it backwards ๐Ÿคฆ

drifting ore
#

i tried to store the previous name to reference against new option to cut down on same choice but it doesn't seem effective

bronze yoke
#

i saw ZombRand(3) *after* the ifs and was like 'yep! this must be the random value those ifs use'

bronze yoke
drifting ore
#

right haha

#

why i kinda just let it go

#

it is random so i can't really complain lol

jaunty marten
drifting ore
#

i could order it that seems boring

red tiger
drifting ore
#

haha

red tiger
#

[Screams in Transpile]

drifting ore
#

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

ancient grail
# quasi kernel ```lua function ISMoveableSpriteProps:canScrapObjectInternal(_result, _object) ...

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

quasi kernel
#

I already refactored to account for thumpable hehe

sour island
#

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

quasi kernel
#

Problem is I still can't get it to allow me to scrap, might just shelve it for later.

sour island
#

Someone also recently posted a little formula to handle cycling

quasi kernel
#

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.

bronze yoke
#

so the only real difference is one less operation

drifting ore
#

fair enough

bronze yoke
# ancient grail can still be refactored ```lua if self.isTable then canScrap = false ...

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

ancient grail
#

Ok i was just simply pointing that the isothump thing

sour island
#

I think you can use this to simply have the messages cycle through

drifting ore
#

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

sour island
#

I think you'd need like 5 lines at least to avoid alot of repeats

drifting ore
#

well time to change the tile properties and move to phase 5 of the nippytime universe

ancient grail
#

Nippy only started to code less than a month and the progress is amazing dont you think

drifting ore
#

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 ๐Ÿ’•

red tiger
#

Hahahaha

#

I just threw ISBaseObject.lua into my transpiler.

#

It's soo broken.

#

I love seeing such broken code

#

all of the nope.

quasi kernel
#

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

paper meadow
#

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

paper meadow
#

Thanks mate.

jaunty marten
#

u r welcome spiffo

tame mulch
#

Okay, it remains to make a guide for vehicle scripts and then a guide for all scripts will be ready!

worldly olive
red tiger
#

I'm implementing metatable transpilation right now.

fast galleon
drifting ore
#

I tried this. Iโ€™ll try again

#

Maybe I didnโ€™t do something right

spare burrow
#

Anyone knows how to completely remove the loot distribution of a vanilla item? Want to replace batteries with battery packs in this case

quasi kernel
#

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.

spare burrow
#

completely replacing the distribution file?

quasi kernel
#

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.

spare burrow
#

ty for the info! if you can give me an example or a mod to reverse engineer would be really appreciated

quasi kernel
#

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.

fast galleon
quasi kernel
#
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.

spare burrow
#

Don't worry, i don't fully understand it but because i'm still learning, will take an eye and try to learn

quasi kernel
#

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!)

spare burrow
#

Ty! if i have any question will def ask ๐Ÿ˜›

zinc pilot
#

hey, is there a way to intercept a Java only method to at least get some of its parameters?

fast galleon
weary dock
#

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

thick karma
fast galleon
# drifting ore I tried this. Iโ€™ll try again

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.

thick karma
#

passes out

quasi kernel
#

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!

thick karma
#

@quasi kernel "This mod was created with the sole purpose of improving furniture and containers just that little big" <--- bit*

quasi kernel
#

Oop thank

thick karma
#

โค๏ธ

thick karma
#

Clutch

#

Never seen a nailed down couch in my life.

quasi kernel
#

It bothered me so much that those two mods specifically weren't compatible

thick karma
#

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?

quasi kernel
#

No clue

drifting ore
#

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

fast galleon
#

@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

drifting ore
#

Sounds good. Just about to jump on and try. Really appreciate you sharing that info about distro stuff and this. ๐Ÿ”ฅ

quasi kernel
#

Somehow made a dynamic wood and metal weight mulitpleir mod first try

#

Feelin' good

weary dock
#

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?

bronze yoke
#

getType()

weary dock
#

oh. ty

bronze yoke
#

getFullType() if you want it to include the module ('Pencil' vs 'Base.Pencil')

red tiger
#

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..

drifting ore
#

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

fast galleon
#

I tried, I failed

drifting ore
#

lolol

#

dang

fast galleon
#

maybe if they were in a pack or something

drifting ore
#

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

fast galleon
#

you could edit the UI maybe, didn't want to go that far

drifting ore
#

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

red tiger
#

aaaaaaaaaaaaaa

drifting ore
#

like randomizing context menus just for the extra chance to see a new phrase ๐Ÿ˜„

red tiger
#

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'..

drifting ore
#

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

red tiger
#

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.

drifting ore
#

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

fast galleon
#

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?

drifting ore
#

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

fast galleon
#

It only need to be done once everytime you load the game

drifting ore
#

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

fast galleon
#

that does not happen every time you load the game

bronze yoke
#

do you even need to attach it to an event?

drifting ore
#

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

fast galleon
bronze yoke
#

but yeah, OnNewGame is only for new games - OnGameStart is called for both that and loading

drifting ore
#

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

rustic garnet
rustic garnet
drifting ore
#

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 KEKWlaugh

spare burrow
#

Has anyone modified vehicle glovebox/trunk/gastank capacities with vehicle tweaker?

spare burrow
#

ty! saw it, tried to reverse engineer eggons but had not found a proper way to do so, will take an eye

true vault
#

aniThonk 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

bronze yoke
#

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

red tiger
#

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

bronze yoke
#

i'd love something like that, though i'm not fancy of dependencies

red tiger
#

I really am crazy. drunk

red tiger
#

It'd be simple to write.

#

Is this actually a desired solution for many modders ?

bronze yoke
#

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

red tiger
#

You'd trust me with the task right? <3

#

I'd need time to do it but not that much.

true vault
red tiger
#

It'd be file IO and event checking

bronze yoke
true vault
#

Well, it returns the Cell, X, and Y of cell that loaded >.>

bronze yoke
#

i think the wiki must just be totally wrong on what this event does

true vault
bronze yoke
#

IsoCell isn't a map cell, it's just the loaded area

true vault
#

aniThonk hmm... alright, but in theory I could figure out the cell based on the X,Y coordinates returned, yea?

bronze yoke
#

well the biggest issue is this idea is relying on this event to be called every time a cell 'loads' right?

red tiger
#

(back to drinking and lurking)

bronze yoke
#

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

red tiger
#

When it comes to performance, every event is questionable.

#

Focus first on making it work, then make it work better.

true vault
#

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...

bronze yoke
#

absolutely

#

if it's the only way for your mod to work (and with these things, it generally is), then who cares how badly it runs