#mod_development

1 messages ยท Page 194 of 1

tardy wren
#

Okay

#

I might be overusing the whole thing a bit...

#

like some functions could be local and still work,

#

This does make my mod accessible to... modding

bronze yoke
#

the whole t = t or {} pattern doesn't make sense if you define the table elements within it

tardy wren
#

okay

sour island
#

If you make the daikons local

bronze yoke
#

i recommend just going for normal modules:```lua
--- shared/SandboxOptionsSyncing.lua
local SandboxOptionsSyncing = {}

function SandboxOptionsSyncing.foo()
-- do something
end

return SandboxOptionsSyncing

--- shared/AnotherFile.lua
local SandboxOptionsSyncing = require "SandboxOptionsSyncing"
SandboxOptionsSyncing.foo()

sour island
#

You can use

local daikon1 = require "file1"
local daikon2 = require "file2"
tardy wren
#

Okay, thanks

sour island
#

Technically speaking the module name inside the file doesn't matter -- as long as the filename is rememberable

bronze yoke
#

yeah, the variable names don't matter, only the file name

sour island
#

However - I usually name them the same thing cause I can copy paste the file name for faster require typing

#

Me lazy no type

tardy wren
#

okay, uh

#

any of you to familiar with context action menus

sour island
#

Yeah

tardy wren
#

It takes these arguments, which after reading the code, I have no clue what they are

(player, context, items)
#

I only figured out that player is the player's index...

#

As in the Local Co-op index

sour island
#

Are you using the events for onfillcontextmenu?

#

There's two, one for in world, one for inventory

tardy wren
#

yes

#
Events.OnFillInventoryObjectContextMenu.Add(Daikon.ApocalypseBiofuels.PourEthanolContextMenu)
sour island
#

There should be more arguments, no?

tardy wren
#

I will have to explore the world one too, eventually

#

triggerEvent("OnFillInventoryObjectContextMenu", player, context, items);

#

Nope, the event has only those three. The function itself has more

sour island
#

Context is a ISContextMenu

#

You can add options to it

#

Player is indeed the index

tardy wren
#

context menu... So the whole thing that appears when you right click the item?

sour island
#

Whatever changes you make to the context menu - yes it's the right click

#

Items should be a table - but Im not sure if it uses the pseudo stack object inventories use

#

Which would make items have an items variable drunk

#

Let me check

tardy wren
#

I praised the codebase one too many times it seems

sour island
#
    for _, v in ipairs(items) do 
  
         ---@type InventoryItem 
         local item = v 
         if not instanceof(v, "InventoryItem") then item = v.items[1] end
#

Yeah it's one of those pseudo objects - since your clicking the inventory row

#

It's feeding you the row clicked

tardy wren
#

so either a table of items or an item?

sour island
#

No... So you know how each row of the inventory can be collapsed?

#

Even if there's only 1 item unhappy

tardy wren
#

Oh, right

sour island
#

Yeah... So items in this case is that group

tardy wren
#

And if it's a single item it shows some details about it

#

usually a useless bar

sour island
#

The header item of the group is items.items[1]

#

For me it just shows the same item again

tardy wren
#

never expanded a cabbage?

sour island
#

you're right - it does show the delta

#

Forgot about that

tardy wren
#

So it's an array of... What exactly

sour island
#

It's the inventory list entries

#

But specifically the entry clicked

#

So if you go to ISScrollingList

#

It shares the same stuff it does

#

So items.items = a list of items displayed

#

The problem here is the argument should be 'inventoryRow'

keen silo
#

@sour island @bronze yoke I noticed something: when I wear clothes, it calls ModelManager.loadAdditionalModel

It then says the clothing Mesh code to load. Is there a way to change the arguments passed before it is called and make it say a different mesh?

sour island
#

You can set different item visuals for items

tardy wren
#

I see...

table 0x396001414
table 0x82321303
zombie.inventory.types.DrainableComboItem@6d970989
zombie.inventory.types.DrainableComboItem@6d970989
zombie.inventory.types.DrainableComboItem@6d970989
zombie.inventory.types.DrainableComboItem@6d970989
table 0x1394398871
zombie.inventory.types.ComboItem@3b567f83
zombie.inventory.types.ComboItem@2a8329f6
zombie.inventory.types.ComboItem@14e519aa
zombie.inventory.types.ComboItem@35b47d0f
zombie.inventory.types.ComboItem@3d96a65d
zombie.inventory.types.ComboItem@e69f480
zombie.inventory.types.ComboItem@327d94ae
zombie.inventory.types.ComboItem@3b567f83
zombie.inventory.types.ComboItem@2a8329f6
zombie.inventory.types.ComboItem@14e519aa
zombie.inventory.types.ComboItem@35b47d0f
zombie.inventory.types.ComboItem@3d96a65d
zombie.inventory.types.ComboItem@e69f480
zombie.inventory.types.ComboItem@327d94ae
zombie.inventory.types.ComboItem@3b567f83
zombie.inventory.types.ComboItem@2a8329f6
zombie.inventory.types.ComboItem@14e519aa
zombie.inventory.types.ComboItem@35b47d0f
zombie.inventory.types.ComboItem@3d96a65d
zombie.inventory.types.ComboItem@e69f480
zombie.inventory.types.ComboItem@327d94ae
table 0x1452896648
zombie.inventory.types.DrainableComboItem@2437cbeb
zombie.inventory.types.DrainableComboItem@5bf1a6ab

tardy wren
#

These are all results of just doing this

    for k,v in ipairs(items) do
        print(v)
    end```
sour island
#

Idk if this is what you mean - but I made this schoolbag look like an alicebag (only when in a car)

tardy wren
#

and clicking on various items

sour island
#

The context menus items argument is the group of items you have right clicked

#

If you want the actual items that is items.items

tardy wren
#

Yeah, I think I see it now

#
table 0x1794491859
zombie.inventory.types.DrainableComboItem@9a8a4b0
#

First one is a saucepan with water in a collapsed state

#

Second one is the same item in an expanded state

#

InventoryItems get shoved into a ComboItem class when in the menu

#

I wanna go back to fixing bugs in the engine already

sour island
#

Yes, for display purposes - items only stack visually in the inventory

#

They don't actually stack into 1 object

tardy wren
#

so what you posted earlier is the approach I should take?

sour island
#

This isn't really a bug - more of a argument needing to be more clear

tardy wren
#

Issue is... if you have selected a whole stack of items, expand it, then the function gets called for all of them

sour island
#

I actually need to check that once I'm home

tardy wren
#

No, that's what happens in the game already

sour island
#

?

tardy wren
#
table 0x969276697
zombie.inventory.types.ComboItem@2963d57b
zombie.inventory.types.ComboItem@5c2625fc
zombie.inventory.types.ComboItem@2963d57b
zombie.inventory.types.ComboItem@5c2625fc
zombie.inventory.types.ComboItem@2963d57b
zombie.inventory.types.ComboItem@5c2625fc
zombie.inventory.types.ComboItem@2963d57b
zombie.inventory.types.ComboItem@5c2625fc
zombie.inventory.types.ComboItem@2963d57b

#

First is clicking on a collapsed stack of 8 sheets

#

next I expand it and right click

#

it does the call on all of them, since they're automatically selected

sour island
#

The header of the row is a place-in

#

The expanded rows should be netting the actual item - correct?

tardy wren
#

Yes

#

What I'm saying, when you expand the rows, they're all selected by default

sour island
#

Then my code is probably wrong to some degree

tardy wren
#

So the Event fires for all of the items at the same time

#

Actually, no

#

The event fires once

bronze yoke
#

the event fires once with a table of items

tardy wren
#

yeah

#
1    table 0x189851768
1    zombie.inventory.types.ComboItem@ac2b4f2
2    zombie.inventory.types.ComboItem@464000d5
3    zombie.inventory.types.ComboItem@4262bfe8
4    zombie.inventory.types.ComboItem@49505f3d
5    zombie.inventory.types.ComboItem@56aa17c1
6    zombie.inventory.types.ComboItem@102ae369
7    zombie.inventory.types.ComboItem@4760837b
#
    if instanceof(items, "InventoryItem") then
        print(items:getFullType())
    else
        for k,v in ipairs(items) do
            print(k,v)
        end
    end
#

So I guess I can dismiss the call if there's more than one actual item

#

That's what happens in vanilla with pouring water

sour island
#

That sounds right, items can be 1 item (sub row) or the header which houses a list

#

Which I usually have it just use the first one if the header is selected

#

Hence the items.items[1]

tardy wren
#

And it's always a ComboItem...

#

Okay...

print(items)
    for _, v in ipairs(items) do
        print(v.items[1])
    end
#

on a collapsed stack, this works, and v.items[1] gives me a single item. On a multi-selection, it errors regardless of selecting one or multiple

crystal terrace
#

lf an event which would only run once per life

#

i see a couple of options, onNewGame, OnCreatePlayer, actually i think newGame is more suited for my use.

bronze yoke
#

onnewgame fires when creating a new character

crystal terrace
#

for some reasons im getting player as nil(passed through params) after player death when im creating a new character. Is it because the prev character is ded?

bronze yoke
#

before a new character has been made? or after

crystal terrace
#

made a character, died and tried to make a new one right after that.

#

interesting so onCreatePlayer is fired on each load of save

#

ok so that was just me being stupid, OnNewGame works. I was fetching player inside the function isntead of using the one passed through params.

tired tartan
sour island
#

OnCreatePlayer did something weird online vs single player if I recall

crystal terrace
#

then it's prolly due to SP, but definitely loaded twice.

weak sierra
#

o look it daikon

cerulean trail
#

Hey, i'm not really normally the type of fox to ask somewhere for help if I don't feel like I fully grasp what i'm working with, but for the sake of not being that idiot who fumbles around pointless for weeks when they could of asked and gotten a simple answer.

I've spent the last 2 days importing my truesona into Zomboid with the Anthro mod, and actually have had pretty much zero issues.
However, right now I noticed I cant wear jackets specifically, though I remember one or two stray items also bugged.
Context being it crumples up my legs or sometimes my hair on my model in my best guess to prevent outfit piece clipping; Though as far as I'm aware because of the way the anthro clothing items are made, they should be exempt from this happening? The base Anthro mod models seem to work fine with everything.

Happy to provide any information / screenshots needed.
I've looked at my files for the mod and nothing seems different from the base mod configurations/other fursona mods using it. Even remade the mod using the tool to generate up the mod scripts in case I did miss something after all but even with basically official anthro mod item configs for my fursona the deflating issue with my legs when wearing a jacket seems to persist and I don't have any idea where to even start to look at fixing this issue.

Thank you for any help in advance
(note: I'm new to PZ modding specifically)

weak sierra
#

much of the PZ clothing just kinda masks body parts and shows itself instead

#

so if the anthro model is different shape then it will require a remade version of the clothing model to fit the shape

#

@cerulean trail

#

that said im not a clothing maker

#

and only have done statics with no animations

#

as more ppl who work with this stuff will be present

cerulean trail
#

Im not worried about clipping of any sorts

#

Its the fact that wearing jackets, which are proper models on the player model causes the legs of my model to shrink down to crumpled tooth picks. I'll get a screenshot really quick

#

oh what ?
Okay, so now its properly just culling the model, which makes a little more sense to me but ??? huh?

weak sierra
#

huh the player model isn't even a weird shape

cerulean trail
#

I know ive had it also just shrink the leg bones to hell and back though

weak sierra
#

at least not from this angle

cerulean trail
#

Yeah exactly my confusion

weak sierra
#

yeah just the head

cerulean trail
#

Which is fine

weak sierra
#

other stuff shud fit fine if it uses the fem build stuff

cerulean trail
#

ive had like maybe one item cause that to also happen to the pony tail but even then thats like

#

been a single item and truthfully I dont care lol

weak sierra
#

depends on how the body is modded in ig

#

if it doesnt replace he player model but instead is clothing itself

#

the masks could fuck with it perhaps

cerulean trail
#

It is clothing

#

because thats how the Anthro mod handles it

weak sierra
#

then perhaps that jacket masks the slot the legs are using

cerulean trail
#

it is it's own hidden category

cerulean trail
bronze yoke
#

i bet it's the uvs

cerulean trail
#

Oh?

#

OH WAIT

bronze yoke
#

when you wear clothing the game uses a texture mask to hide that part of the body

#

i'm guessing what's normally the chest on the vanilla uvs is the legs on yours

cerulean trail
#

Oh

#

oh my gosh that makes sense

#

oh my gosh i know whats wrong now

weak sierra
#

yeah that's what i was getting at, but less specifically

cerulean trail
#

oh thats the worst thing to be wrong

#

๐Ÿ˜ญ

bronze yoke
#

yeah ๐Ÿ˜ญ

cerulean trail
#

Okay thank you lol

weak sierra
#

gl :|

cerulean trail
#

I have a larger texture because I didnt see it actually causing problems

#

So that'd be why

#

UV's are misaligned because of that

weak sierra
#

time to crunch the texture into place

#

:p

cerulean trail
#

Yuh

#

thanks :D

weak sierra
#

gl :)

#

@bronze yoke glad u were able to get that across with a bit more detail

#

i had like.. a feel for the issue but didnt know the specific thing to say

#

lol

#

ive never made clothing

cerulean trail
#

lol regardless thank you so much

#

both of u

#

haha shit this is gonna suck

#

my fault ๐Ÿ˜ญ

vagrant valley
#

I spent hours trying to figure out why my lua code doesnt work

#

And i still dont know why

fathom barn
#

Is there any tutorial on how to create simple traits/moodles?

#

i tried the "moodle framework" with an unsuccessful attempt.

bronze yoke
#

my statsapi has a custom moodle api, it's a bit more flexible than moodle framework's but depending on what you're trying to do it could be harder not easier as it expects you to implement the actual logic yourself whereas i understand moodle framework handles most of it for you

#

if it's very similar to how most vanilla moodles work then moodle framework would be the easier option

fathom barn
#

For example

#

i want to create X moodle which goes bad over time just like hunger or thirst. When the player reads a magazine, the moodle will be better.

bronze yoke
#

yeah, from what i can tell that's the kind of thing that framework specialises in

#

unfortunately i haven't used it myself so i can't help you more with that

fathom barn
#

well thanks

#

i just can't figure out how to configure it myself

#

like i can't even figure out how to make a simple trait/moodle which goes bad over time

#

i looked at the game files, downloaded peoples mods and examined them

cobalt fiber
#

I recommend you take a look on the SOTO mod by @polar gyro, I've learned a lot from traits by looking into that mod's code

fathom barn
#

thanks

fathom barn
#

i'll download withsteam cmd

cobalt fiber
#

Don't think it adds moodles tho, but should get you somewhere

fathom barn
#

i also want to create a trait and implement vanilla moodles so this'll help a lot

cobalt fiber
#

It should do the trick ๐Ÿ˜‰

fading horizon
#

LOG : General , 1693958586023> bugged action, cleared queue ISFishingAction

#

love this highly detailed error

vagrant valley
#

Yes

#

I still have no idea what is null

#

What the hell is local9

crystal terrace
#

press f11, opens debugger menu. Scroll through lua files, find yours. Server files are loaded first, than shared and then client ones. Open your file, double click to put a break point on a line of code. Play the game and it should stop right there with all the variables populated, use print statement and variables. Debugger is a really great tool if you start to mess around.

fathom barn
bronze yoke
#

local9 is a java variable, their names are lost in compilation

#

the java function is having an unhandled error

fathom barn
#

i'll keep exploring the single trait mods

crystal terrace
vagrant valley
#

So my mod somehow broke java

crystal terrace
#

When debugging always try to isolate the snippet causing the issue and then you wanna minimize the lines until you find the exact issue.

bronze yoke
#

i think it's something wrong with the recipe, since that's the part of the code that's having issues

vagrant valley
#

It could be the other recipes

#

But im not sure how that could break it

#

Then again

#

Programming is quite a journey

bronze yoke
#

if you have a decompile you can look at the method's source and see where a local could actually be null

vagrant valley
#

I dont have a decompiler with me right now

#

So i'll scour through my recipe file

#

And then get vscode or an equivalent

cobalt fiber
#

Eg. The alcoholic trait, it is very complex tho

#

Maybe look for the trait breathing techniques and other simpler ones

cobalt fiber
cerulean trail
# weak sierra gl :|

Hey, just wanted to thank you again. I just set some custom maks and that fixed my issue entirely without having to remap my entire UV's. TSC_wave

fathom barn
#

edited someone elses code

#

when the player selects the "addict" trait, will they start off with a bit on their arm?

crystal terrace
#

i swear if looked at that code a couple of mods ago, would be totally blank. Learned a bit along the way.

fathom barn
#

huuh

crystal terrace
#

thinking about pz modding day 1 ๐Ÿ‘€

vagrant valley
#

I can see how that code goes

fathom barn
fathom barn
#

Does anybody have a quality LUA Tutorial video?

#

That teaches from scratch

cobalt fiber
#

If a client uses the ModData.request(key), the server automatically sends the requested table to the client that requested?

fickle oasis
#

is anyone here available for commission? ive tried looking on reddit, steam discussions, and fiverr, but i cant find anyone to do a mod for me. its a pretty simple one; i just kind of want a mad max style of cab armor for the w900 semi truck mod. im not sure if you can make it an addon for that mod or just a new semi truck all together. please inquire in my dm's for more details.

weak sierra
vagrant valley
#

Okay

#

I noticed one of my recipes requires an item i havent added yet

#

But it's a completely different recipe

#

Than the one causing java errors

fickle oasis
#

yeah i saw that one, wasnt a huge fan of the design for the cab armor, too rounded for my taste

#

i like stuff like the one in mad max lol

fickle oasis
#

ooo thank you im surprised no ones told me about that

jolly goblet
tranquil jackal
#

Hey all, I'm doing my first mod and wanted to start out by making one that starts a timer when the player is spotted by a zombie. Is there a check/event for this within the zomboid source?

true nova
tiny karma
#

Making a mod that replaces the main rendering pipeline for more visual effects

drifting ore
#

Hey does Events.OnGameStart.Add start after player is fully loaded in? i have functions that rely on checking traits of the player.

crystal terrace
drifting ore
#

Like. brand new character

crystal terrace
#

ah for that you need OnNewGame

drifting ore
#

Also, anyone familiar or worked with moodle framework before?

crystal terrace
#

once each run

drifting ore
#

nah what im doing sticks with the player and changes. so it needs the player to be loaded first before doing anything'

crystal terrace
#

You want it to work each time after player is loaded?

drifting ore
#

Yeah

#

Events.OnGameStart.Add works i think, but i'm having some issues with it.

crystal terrace
#

what issues? if you cant pull player obj then its not what you need

#

Wait yea it def triggers after player obj is loaded

drifting ore
#

Ok. so its on an issue on my end, good to know

tardy wren
#

You can add, then remove if it only has to run once

#

Or make it run only once in a while

queen kraken
#

One message removed from a suspended account.

vapid quest
#

is it possible to make new command?

fathom barn
#

chat command yea

queen kraken
#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

cobalt fiber
#

Well I don't know about the car battery part, but in write to the UI you mean a message above the player's head?

#

If it is, idk if the server-side can do that, but if you want the server to trigger it, you can use sendServerCommand(module, command, args) and handle it on the client-side

#

The easiest command to show a message is player:Say(message)

jolly goblet
median mantle
fast galleon
median mantle
jolly goblet
crystal terrace
#

Actually nvm does look like decompiled code

median mantle
#

Yes it's decompiled zomboid code

glacial viper
#

Hey there, quick question for item:DoParam(), how to add an additional param if there's already one exisiting? I am getting this errror __concat not defined for operands: Item{Module: Base, Name:PopBottleEmpty, Type:Normal} and Tags = SlowScoop

#

PopBottleEmpty has an existing Tags defined Tags = EmptyPetrol,

jolly goblet
#

Does anyone have an example of how to make specific objects appear in specific places?
Away from the current player position and loaded only once in a while when a new game is loaded.

sour island
#

DoParam(concatedString..","..yourTag) would then work.

#

Alternatively, if the array is exposed you might be able to simply add it.

#

In that case you wouldn't use doParam

bronze yoke
#

yeah you can just add to the list

sour island
#

I'll have to clean that up in EHE then lol

crystal terrace
jolly goblet
# crystal terrace are you talking about spawning items through distribution files or just spawning...

I want to just place an object in a specific place. I have the following code. But it does not work.

local function setNotaInWorld()
    local sq = getCell():getOrCreateGridSquare(3148, 7228, 0);  -- place where I want a note to appear

    if sq ~= nil then
        local sqNote  = sq:AddWorldInventoryItem("Base.wicked_lab01_SheetPaper", ZombRand(0.1, 0.5), ZombRand(0.1, 0.5), 0);
        if sqNote then
            sqNote:addPage(1, getText('News_note02'));
        end
    else
        print("ERROR bla bla bla")
    end
end

local function OnNewGame(player)
   setNotaInWorld()
end

Events.OnNewGame.Add(OnNewGame);
#

./mods/MapLaberinto/media/lua/client/AddItems.lua

sour island
#

Are you getting error bla bla bla?

bright hawk
#

this is awesome

bronze yoke
#

the prefixes are a necessary part of the getText strings

bright hawk
#

thanks for making such a fun mod

sour island
bronze yoke
#

unless the player spawns next to that area this will fail

sour island
#

Theres two APIs that I know of that can do this.

#

One uses mapping, the other uses Lua and chunk loading

#

Rather than square Loading

jolly goblet
bronze yoke
#

you have to wait until the square loads to spawn the item

sour island
#

Oh if you're making it for a specific map, maybe the other one will be easier to utilize

#

I can't say which will be better for what you need, and I've only used the first myself.

bronze yoke
#

never used that api but even just the overhead from having an event function is significant on loadgridsquare so an api would be well needed there

sour island
#

It doesn't use that event ๐Ÿ˜…, actually gets around it by using something the game uses for Iso Objects

#

Far less intensive

bronze yoke
#

it doesn't even use the event? that's even better

sour island
#

Yeah, I may have to update EHE for that as well

jolly goblet
sour island
#

What did your code try to do?

#

That event is very intensive

bronze yoke
#

yeah you can easily make the game hang with loadgridsquare and some other rapidly called events

sour island
#

You cannot use prints at all

#

That's why superb survivors hangs for 5 minutes on boot...

bronze yoke
#

you can print as long as they're conditional

sour island
#

Literally just a print left over

bronze yoke
#

when loading in loadgridsquare gets called tens of thousands of times at once so anything intensive on there will just hang

sour island
#

Yeah even doing simple stuff can be pretty gnarly

#

That's where avoiding for() would be impactful

jolly goblet
# sour island What did your code try to do?
local NOTE_LAB01 = "test text bla bla";

local function LoadGridsquare(sq)
    if sq:getWindow() and sq:getX() == 3148 and sq:getY() == 7317 and sq:getZ() == 0 then
        print('1qX ---->' .. sq:getX());
        print('1qY ---->' .. sq:getY());
        local sqNote  = sq:AddWorldInventoryItem("Base.wicked_lab01_SheetPaper", ZombRand(0.1, 0.5), ZombRand(0.1, 0.5), 0);
        if sqNote then
            sqNote:addPage(1, NOTE_LAB01);
        end
    end
end

Events.LoadGridsquare.Add(LoadGridsquare); ```
sour island
#

I guess that shouldn't have caused any issues with the print - but idk what the errors in this were

#

What does square get window do?

#

If that's not a thing, you'd be calling an undefined function thousands of times

jolly goblet
bronze yoke
#

yeah if this function errors the game will also hang because it prints tens of thousands of errors

sour island
#

Odd that it crashed then

#

This is a method under isogridsquare?

jolly goblet
#

I think maybe I'm calling it from the wrong place.

This is the route from where I call it:
./mods/MapLaberinto/media/lua/client/ItemSpawner.lua

sour island
#

Nah youre fine, I just checked, isogridsquare does have a getWindow

#

It could be that getWindow itself is intensive

#

And it doesn't seem like you need it?

jolly goblet
#

OK I can remove it to test. but do you think it is well located where it is...?

sour island
#

I wouldn't use this event at all

#

You're going to be firing a XYZ check for every square around the player that is loaded in as he moves - so even the same square multiple times.

#

I would recommend the first API linked.

jolly goblet
#

Do you have an example code? how would it be?

fast galleon
jolly goblet
fast galleon
#

OnNewWithSprite is for the first time a square loads

sour island
#

IsoWorldInventoryObject is a IsoObject right?

fast galleon
#

Obviously you can use already existing tiles on the squares or use one that is special and only serves this purpose to improve performance.

#

You could place special tile on the map and remove it completely when it is loaded.

covert summit
#

Shit, i lost file where i saw all attributes for stove building... such as .litsprite etc. ... can you point me where i can find those??? I tried everything using Notepad++ searching tool and found just nothing.

jolly goblet
fast galleon
#

If you search vanilla files for MapObjects.OnNewWithSprite or MapObjects.OnLoadWithSprite you will find more examples.

fast galleon
fast galleon
fast galleon
covert summit
#

I found just a little piece of example ... cant remember where i saw almost full list of them.

What attributes have ISBSFurnace or ISStove objects when you building it?

#

.litsprite is only one that i remembered

glass gorge
#

anyone want to make like $10 for a mod that disables sprinter's random bullshit player slowdown when they get near you

covert summit
#

I'm making a mod based on More Builds Reloaded that will allow you to build most of the objects from Dirk Tiles and DylanTiles. I have dealed with ISDoubleTileFurniture, containers, double windows, doors and walls, but now I have reached the furnaces from barrels. They are very cool and I would like to take into account all possible attributes for them that are possible. Please help me.

covert summit
# jolly goblet BSFurnace?

Oh thanks a lot. I think this ll help.

I saw that in MBReloaded BBQ is declared as ISStove so i need to experiment with it first.

#

Nope, i dont need to

true nova
#

I'm having issues with this cause i have no idea what i'm doing. in the placebedsheet function it doesn't seem to recognize bed as an isobject giving me attempted index: getSprite of non-table: null as error and any other function i try to use on it. any help appreciated

local function PlaceBedSheet(player, bedSheet, bed)
     local bedName = bed:getSprite():getName()
     if bedName == "furniture_bedding_01_0" then
        bed:setSprite("furniture_bedding_01_2")
    end

    
       player:getInventory():Remove(bedSheet)
end
                    
local function addPlaceOptionToBed(player, context, worldobjects, test)
    local bed = nil
    local player = getSpecificPlayer(0)
    
    for key, value in pairs(worldobjects) do
            if value:getProperties():Is(IsoFlagType.bed) then
                 bed = value
                    
        for i = 0, player:getInventory():getItems():size() - 1 do
            local bedSheet = player:getInventory():getItems():get(i)
            
            if bedSheet:getName() == "Black Blanket" then
                        local optionBed = context:addOption(getText("Place Bed Sheet"),player,bedSheet,bed,PlaceBedSheet)
                    end
               end
    end
    end
end


Events.OnFillWorldObjectContextMenu.Add(addPlaceOptionToBed)
azure rivet
#

Hello, In the scripts how can use 2 textures in one item model?

bronze yoke
#

you can't

fast galleon
#

attempted index: getSprite of non-table
weird, shouldn't it say not a function instead because the function is in wrong parameter order?

#

also bedsheet would be an InventoryItem, what you want is bed:getTextureName()

#

getTextureName is getSprite + getName with a nil check directly in one call

#

wait, you probably want to use getType instead on the bedsheet?

true nova
#

what is the proper parameter order? and i didn't catch that getTextureName much easier way of doing that. and yes i getType is what i was looking for i could only find getName at the time and was confused why it was giving me display name

solid dawn
#

Idk if this is the right place here but a guy named "Glytch3r" (a lot of modders here probably know him) is currently sending scam links to people on Steam. Dont use the login option on the links he sends. You will lose your steam account.

Note the double "i" in the steamcommuniitys. Maybe someone with more connections in the community can make an announcement about it or something. Someone so known as him sending such links might make some people take their guard down. Even though I quickly realized it was a scam even I clicked on the link initially

fast galleon
bronze yoke
#

i have my issues with him as many of us do, but i didn't expect this - maybe he fell for one himself and- yeah

solid dawn
#

just wanted to put this out here as most steam accounts usually have bank or paypal accounts linked to them etc. so this really is no joke. And yeah I was a client of him. I have some some wild stories as well lol

true nova
fast galleon
#
            option.onSelect(option.target, option.param1, option.param2, option.param3, option.param4, option.param5, option.param6, option.param7, option.param8, option.param9, option.param10);
fading horizon
#

is there a way to give a crafting recipe a custom icon on the context menu

#

or do i need to have a custom context menu option for that

#

ie

#

can i make 'crucify' and 'prepare to throw' have the dead rat icon

fast galleon
#

I could suggest instead of making a new option, get the option and add an icon. Whatever seems more efficient.

fading horizon
#

i hadnt even thought of that

#

that's a good idea

#

thank you polt

fast galleon
#

option.iconTexture = bulbPart:getInventoryItem():getTex()

true nova
#

you know this is a step up though atleast it knows its an object now

crystal terrace
true nova
#

nooo i want 50$ i'm a poor broke boy

fading horizon
#

hope y'all are ready

true nova
fading horizon
#

update 3.0 may include something like that

true nova
#

must appease the rat god

true nova
true nova
fading horizon
#

I would love that

#

because

#

i have this image

#

having a pentagram in the middle would be PERFECT

#

ive also just always wanted a pentagram tile

undone tapir
#

what in the world

#

lmao

crystal terrace
limber onyx
#

Hi guys. I'm currently working on a small mod that allows you to make Improvised Tools with Sturdy Sticks (Stone Knife, Stone Axe, Stone Hammer)
The mod already works but there's one issue. My mod is only adding more recipes instead of modifying the existing ones.

Can someone lend me a hand on how I could be able to modify the vanilla recipes instead of just adding new ones on top?

vagrant valley
#

You can do Overwrite:true,

#

Or override

#

Not sure which one is correct

#

But it should override the recipe with the same name

limber onyx
#

Can I share the code? Im VERY new to LUA so I wouldn't know in which part I should place the Overwrite function

#

it's my first mod actually

vagrant valley
#

You dont need lua for replacing vanilla recipes

#

It should be on the script file

limber onyx
#

that's how little I know lol. I thought i was modifying a lua file with that since i'm using Notepad++ I just can't tell the difference

#

`module ChippedStone
{
imports
{
Base
}

recipe Make Stone Knife
{
    TreeBranch/WoodenStick,
    SharpedStone,
    RippedSheets/Twine/RippedSheetsDirty,

    Result:FlintKnife,
    Time:80.0,
    Category:Survivalist,
}

recipe Make Stone Axe
{
    TreeBranch/WoodenStick,
    SharpedStone,
    RippedSheets/Twine/RippedSheetsDirty,

    Result:AxeStone,
    Time:80.0,
    Category:Survivalist,
}

recipe Make Stone Hammer
{
    TreeBranch/WoodenStick,
    Stone,
    RippedSheets/Twine/RippedSheetsDirty,

    Result:HammerStone,
    Time:80.0,
    Category:Survivalist,
}

recipe Create Spear
{
    Plank/TreeBranch/WoodenStick,
    keep [Recipe.GetItemTypes.SharpKnife]/SharpedStone/MeatCleaver,

    Result:SpearCrafted,
    Time:100.0,
    OnCreate:Recipe.OnCreate.CreateSpear,
    Category:Survivalist,
    OnGiveXP:Recipe.OnGiveXP.WoodWork5,
}

}`

#

where should I place the Overwrite thing?

vagrant valley
#

Overwrite should be in the recipe block

limber onyx
#

Like this? I'm sorry I'm making so many questions, I have no idea what I'm doing

recipe Item
{
Other values n' stuff
Overwrite:true,
}

sour island
#

Should be noted that only effectively works if the recipe is uniquely named. Using overwrite on recipes with shared names only applies it to the first one found.

#

Same with obsolete.

#

So, actually, Lua is more reliable for modifying existing recipes.

limber onyx
#

Thanks

#

My mod is kinda small and only intended for those specific recipes, I think I should be OK

#

appreciate the support guys

sour island
#

What is it you're trying to do/change?

limber onyx
#

Make it so you can use Sturdy Sticks to make improvised tools and spears

#

stone knife, axe, hammer, and spears

sour island
#

I see

limber onyx
#

there was a mod that did that in the workshop but i'ts obsolete, and it still uses the old spear ID

sour island
#

Those recipes should be fine then.

limber onyx
#

awesome, thanks

#

the override:true, thing must go on each block, right?

#

IT WORKED, thank you so so much

#

i only see 1 recipe now

lean reef
#

Does anyone know of a good way to make certain foraged items only appear when wearing a specific item? I'm currently trying to work out a way but I don't know (or think) it will be a good way lol, so I'm just trying to see if anyone's already worked this one out yet

fading horizon
#

anyone have an idea of why

local getCrucify = context:getOptionFromName("Crucify Stuart Little") or nil
        local addCrucify = StuartMenu:addOption(getCrucify.name or "Crucify Stuart Little", isStuartLittle,
            (getCrucify.onSelect) or function ()
              console.log("test");
            end, getCrucify.param1 or true, getCrucify.param2 or true, getCrucify.param3 or true,
            getCrucify.param4 or true, getCrucify.param5 or true, getCrucify.param6 or true, getCrucify.param7 or true,
            getCrucify.param8 or true, getCrucify.param9 or true, getCrucify.param10 or true)
        addCrucify.iconTexture = getTexture('media/textures/item_CrucifiedStuartLittle.png');
        if not (getCrucify) then
            addCrucify.notAvailable = true
        end

Is coming back with a null table error?

#

i tried to check for every null value I could using that method

#

basically what i'm trying to do is take all my recipes because theres a lot

#

copy them into a new submenu

#

then remove them from the vanilla menu

#

but i'm having trouble passing the paramaters if the option is not available from the start

#

i basically want all the recipes to show in the submenu, but only be enabled if the default function is available (if it already existed)

#

if that makes sense

fading horizon
#

nvm

#

got it figured out

#

now trying to figure out how to copy the default recipe tooltip to the new option

fast galleon
fading horizon
#

cool, that works

#

do you know the default syntax to set a tooltip?

#

addCrucify.toolTip = getCrucify.toolTi or false returns error

fast galleon
#

maybe nil is better than false then

fading horizon
#

found the default tooltip code

#

i think i found the way to do it

#

loading in now

#
 if (getCrucify.toolTip) then 
          addCrucify.toolTip = getCrucify.toolTip 
        else
          addCrucify.toolTip.name = "Crucify"
          addCrucify.toolTip.description = "Not enough materials"
          addCrucify.toolTip.footNote = "- Materials Needed -"
        end
fast galleon
#

recipe option would be added here I think ISInventoryPaneContextMenu.addDynamicalContextMenu, ISRecipeTooltip is the global variable for the local CraftTooltip

fading horizon
#

i'm confused, what would I use that for?

#

dang

#

addCrucify.toolTip = getCrucify.toolTip only works if it's a single item

#

if there's multiple stuart littles, so the crafting recipe goes to the submenu, it doesn't get the recipe

upper helm
#

crucify stuart little

#

pmsl

fading horizon
true nova
#

i cant get any more info from a bed object. everything i've tried returns nil. i wanted tile data like its group name but getTile() gets me nothing. ill have to resort to just sprite names which will be hellded

upper helm
fading horizon
upper helm
#

our fallen soldier

upper helm
fading horizon
#

i was passing parameters incorrectly

#
local getCrucify = context:getOptionFromName("Crucify Stuart Little")

        local name = (getCrucify and getCrucify.name) or "Crucify Stuart Little"
        local onSelect = (getCrucify and getCrucify.onSelect) or function ()
            return
        end

        local param1 = (getCrucify and getCrucify.param1) or false

        local addCrucify = StuartMenu:addOption(name, isStuartLittle, onSelect, param1)
        addCrucify.iconTexture = getTexture('media/textures/item_CrucifiedStuartLittle.png')
        addCrucify.toolTip = getCrucify.toolTip

        if not getCrucify then
            addCrucify.notAvailable = true
        end
#

revised code looks like this

#

i'm trying to figure out a way around the submenu thing and setting a default tooltip currently

fast galleon
fast galleon
fading horizon
#

basically i'm trying to take the "crucify stuart little" default recipe option shown here to be moved to the "Stuart Little" submenu

#

is there a way to change a context menu's location via properties?

fast galleon
#

ah

fading horizon
#

my thought was

#

copy it then remove vanilla

fast galleon
#

you'd need some manual code

fast galleon
#

something similar to

local function addOrGroupContextOption(context, name, ...)
    local subMenu
    local identifier = "M' "..name
    for i,option in ipairs(context.options) do
        if option.name == name then
            if not option.subOption then
                local newOption = context:allocOption(name)
                newOption.id = option.id
                context.options[i] = newOption
                subMenu = context:getNew(context)
                context:addSubMenu(newOption,subMenu)
                option.id = 1
                subMenu.options[1] = option
                subMenu.numOptions = 2
            else
                subMenu = context:getSubMenu(option.subOption)
            end
            break
        end
    end
    if subMenu then
        subMenu:addOption(identifier,...)
    else
        context:addOption(identifier,...)
    end
end

local function addOrReplaceContextOption(context, name,...)
    local identifier = "M' "..name
    for i,option in ipairs(context.options) do
        if option.name == name then
            table.insert(context.optionPool, option)
            local newOption = context:allocOption(identifier,...)
            newOption.id = option.id
            context.options[i] = newOption
            return newOption
        end
    end
    return context:addOption(identifier,...)
end
#

to only remove an option, there is context function to remove it

true nova
fast galleon
true nova
#

ah so that'll give me a table of all of the sprites in relation to that one thank you

lean reef
#

Bit of a newbie question, but can you do local character = self.character; for functions in the server folder?

neon bronze
#

If your โ€žselfโ€œ is defined, sure but if not then you can get the player with getSpecificPlayer(0) for mp compatibilty + put a isClient() check to only have it work for client

#

Client runs (currently) everything

lean reef
#

Okay, and just so I'm understanding getSpecificPlayer correctly will getSpecificPlayer(0) return the client player or would it get, like, the first player indexed in the server?

#

Sorry if I phrased that wrong, still figuring this out lol

neon bronze
#

Its always the client

lean reef
#

Alright thanks!

bronze yoke
#

i think a lot of people here are confused about getSpecificPlayer, i've seen this a couple times recently

neon bronze
#

How does the indexing for players in mp actually work?

bronze yoke
#

it's not for multiplayer compatibility, getPlayer() functions exactly the same in multiplayer

neon bronze
#

Will have two players have the same index for the third player?

#

*its coop

bronze yoke
#

it's for splitscreen, if your code only uses getPlayer() then your code only affects the most recently added player

#

if you just drop in replace it with getSpecificPlayer(0) you don't actually solve this problem

#

as for multiplayer player indexes, online ids are the same across all sides

#

all other indexes are used exclusively by the client that player comes from and are likely undefined for remote players

neon bronze
#

So the only reliable way to grab the same player from multiple clients would be through online ids?

bronze yoke
#

yeah

lean reef
#

Thats pretty neat, I didnt actually know there was splitscreen support! Truth be told, I think the reason I asked my question in the first place wouldn't actually work, but I'm glad it led to me understanding the function better in the future!

fading horizon
#

@fast galleon Thank you. I got it working thanks to your code

bronze yoke
#

getSpecificPlayer should be used in a loop to affect all local players, and in a lot of cases i've seen getting the player object is just redundant to begin with (timed actions already know their player, context menu already knows its player, etc)

neon bronze
#

getSpecificPlayer only works for players that are in the same cell?

bronze yoke
#

in most cases splitscreen support just isn't a priority so not going to that length is fine, but dropping getSpecificPlayer in to replace getPlayer doesn't really improve compatibility

#

getSpecificPlayer only gets the 1-4 characters from this client

neon bronze
#

How does it know which players those should be?

#

Does it just pick the nearest ones in mp?

#

In coop its obvious

bronze yoke
#

it's the ones playing on that computer

neon bronze
#

Oh

#

So no support for that in mp?

bronze yoke
#

full support in mp

neon bronze
#

So how does it pick a player for mp? Does it pick them by their online ids? Or better formulated how does it assign the ints to players locally?

#

Cause the client is always 0 even if its not the case in mp

lean reef
#

0 is the client and there aren't indexes for other online players?

bronze yoke
#

the first player to start playing on that client is 0, second is 1, etc

#

players from other clients are not included in the list it uses

neon bronze
#

So you couldnt then call getSpecificPlayer(2) in mp without erroring?

lean reef
#

Unless you were in mp and also splitscreen LMAO
I suppose I odnt know if you can actually play splitscreen in mp

bronze yoke
#

you would get the third splitscreen player if they exist

neon bronze
#

Can you play splitscreen in mp?

bronze yoke
#

you can - and the fact that literally no mods support splitscreen caused so many security issues that there's now an option to turn that off for the server

neon bronze
#

Im just thinking: who would want to play splitscreen in mp?

lean reef
#

Fascinating! See, thats the sorta thing I woulda never known about unless I started looking into mod development

lean reef
neon bronze
#

Then wouldnt you just play coop instead?

#

Cause coop and mp are two different things in pz if im not wrong

lean reef
#

But what if you also wanted to play with your friend in another country?

#

idk, i didnt even know this functionality existed, im just making stuff up

vagrant valley
#

It's such an esoteric scenario

neon bronze
#

Its the most fringe case i can think of

lean reef
#

yeah, I imagine its only really brought up by people trying to exploit or whatever

bronze yoke
#

well i don't think it was too much effort to support

#

it might have been harder not to support it even

#

all of the vanilla code is structured around splitscreen

lean reef
#

but i like to imagine there is like one guy who got disappointed because they couldn't play on their buddy's favorite server with them while they were over at their house or something

neon bronze
#

I hope b42 rolls around soonish

#

Finally move client stuff to server

lean reef
#

Is that a thing that's happening?

tardy wren
#

Inventory will all happen server-side

neon bronze
#

Yep thatโ€™s great

tardy wren
#

I've found no way to modify an item's Tags with Lua... There's only a Getter, not a Setter... Anyone experimented with it in the past?

neon bronze
#

DoParam?

#

Does it not work?

lean reef
#

I wonder if I should be writing my stuff differently in preperation or if it'll be as easy as dragging all my lua client files to the server file. I suppose I can't test anything if I don't write things for how they work now but still good to know

bronze yoke
#

you don't need to set it

neon bronze
#

You could getTags .. your Tags and then doParam

bronze yoke
#

objects are passed by reference

#

if you get the tags object, add a new tag to it, you are done

tardy wren
#

Oh, really?

lean reef
#

yeah! I actually just did that a couple days ago, looks something like

#

local tags = item:getTags()
tags:add("TagToAdd")

tardy wren
#

So I can append stuff to the end? Nice, I can edit items to be ethanol-eligible while maintaining mod compatibility

#

Oh yeah, it's an ArrayList

lean reef
#

Yeah! Mod compatibility was also the reason I was figuring it out so it's nice that its avaliable

tardy wren
#

So, best I do that in Shared, right?

bronze yoke
#

yep

tardy wren
#

Alright... I guess I can safely go back to rewriting the water pouring scripts to pour ethanol

drifting ore
#

How do you spawn a zombie with specific clothing?

fading horizon
#

@fast galleon

#

thanks again

#

this custom menu is much better

drifting ore
#

"belittle stuart little "
"crucify stuart little "
that went from 0 to 1000 LMAO

drifting ore
fast galleon
fast galleon
fading horizon
#

that's where outfits are defined

#

my goth backpacks mod or backpack flags mod adds new simple outfits that are easy to follow if you want an example

true nova
#

is there a way to search the closest tiles for objects other than to go through all of the isodirections and checking them ?

drifting ore
fast galleon
# true nova is there a way to search the closest tiles for objects other than to go through ...

update: sorry might be wrong mod

***
I think you might find this mod interesting to check. When adding options it uses vanilla function to get all objects of gridlist and checks if all objects exist or if it's partial / broken.

https://steamcommunity.com/sharedfiles/filedetails/?id=2964456536
https://steamcommunity.com/sharedfiles/filedetails/?id=2971843681

lean reef
#

I messed something up LMAO

#

I think I know how to fix it, just thought it was funny
It was actually a little spooky this late at night (or, well, it's technically early in the morning but i've been up all night and it's dark in my coding dungeon rn)

tardy wren
#

Anybody know if adding a ReplaceTypes pair that can't be fulfilled(For example EthanolSource WaterBottleWithEthanol) breaks the game somehow? I don't even know how to create my EthanolSource yet

upper helm
tardy wren
#

What's an event that runs early to modify items?

#

Probably before the game starts to load a save.

crystal terrace
#

Maybe check OnworldInit

drifting ore
#

Sorry a bit of a noob question, but how do you call built-in lua functions like math?
tried return tostring(random_gender_and_skincolor[math.random(1, #random_gender_and_skincolor)])

But it says object tried to call nil in functionname

neon bronze
#

ZombRand

#

pz has its own rng function

drifting ore
#

Thank you haram gaming

weak sierra
#

mind that it runs 0-N while things in lua run 1-N

#

so in many use cases u wanna +1 to the result

#

when using it to index into things for instance

vivid imp
#

Hello,
quick question, why do some filenames in lua scripts start with "IS"?

sour island
#

Consider it a finger print

vivid imp
#

Ahhhh

#

I feel dumb now

sour island
#

No need to

#

I thought it was related to Isometric

lean reef
#

Haha I thought it was too!

proven vortex
#

Hello everyone, I'm new to working with mods, and I'm trying to translate a mod into my "PTBR" language, but I'm having a problem when translating a mod's description. I create the translation but it doesn't appear inside the game, I've done it with some other mods but this one in particular I'm not getting it, could someone give me a hand?

fast galleon
proven vortex
#

I achieved! the "Tooltip" was directly in the script and that's why it wasn't translating, I corrected it and now I managed to create the translation!

proven vortex
steady forge
#

Heyo! Looking to break into modding PZ, was wondering if there are any tools, extensions, etc. to help me get started with the lua side of things

#

I've got plenty of experience with Lua itself, just looking to see if there are any toolchains, packages, extensions, etc.

bronze yoke
#

there's an extension for zomboid's item/recipe/etc format for vscode, otherwise i don't know of anything

weak sierra
#

Caused by: java.lang.RuntimeException: unknown location "JawStab"

#
    local mark = zombie:getInventory():AddItem("Base.ScreecherMark")
    zombie:setWornItem("JawStab", mark)```
#

isn't JawStab a vanilla location

#

but even if it isn't, the mod i am working with does it via attached weapon def

#
AttachedWeaponDefinitions.ScreecherMark= {
    chance = 100,
    outfit = {"Screecher","ScreecherNoKatana"},
    weaponLocation = {"JawStab"},
    bloodLocations = nil,
    addHoles = false,
    daySurvived = 0,
    weapons = {
        "Base.ScreecherMark",
    },
}```
#

which would lead one to think that the location exists fine

#

unless i need some kind of more complex path for the weapon location in this context

#

appears to be fine, vanilla just does "Back" in places

bronze yoke
#

body locations and attached locations aren't the same thing

weak sierra
#

how can i manually attach it then

steady forge
bronze yoke
#

use setAttachedItem(String location, InventoryItem item)

weak sierra
#

much thanks albion

#

have never run into need to mess with this

#

xD

steady forge
#

do I have to really worry about Java when modding in Lua?

weak sierra
bronze yoke
#

sort of

weak sierra
#

e.g., you will run into java arrays

#

at the minimum

#

depends on what u make tho

bronze yoke
#

yeah you'll be playing with java objects most of the time

weak sierra
#

if u just make item scripts and distributions for them then maybe not

#

lol

steady forge
#

nah i wanna do more than just scripts

weak sierra
#

then yeah u'll at least have to learn the basics of interop

steady forge
#

okay sick

weak sierra
#

u dont need to straight-up know java or anything tho

steady forge
#

are there any resources for that?

weak sierra
#

biggest thing to know is java indexes are 0-based, lua is 1-based

bronze yoke
#

you don't really need to understand java, though understanding some of the theory might help if you don't have a background with other languages

steady forge
#

I know Java too haha but would rather stick with one language

weak sierra
#

the rest is basically the API which u can see in the wikis

#

ah then u shud do well

steady forge
#

okay API love that

weak sierra
#

basically kahlua exposes certain classes and functions to lua

#

and lua can mess with those

bronze yoke
#

since you know java i recommend decompiling

weak sierra
#

and then reflect to get access to a few it doesn't (But not just any)

#

yeah u can reference the source to understand what functions do then

bronze yoke
#

a lot of questions get asked here that can be answered by simply actually checking what a method does

steady forge
#

okay I guess what I'm specifically asking about is how the Java code and Lua code interface

weak sierra
#

KahLua

#

lets them map java->lua

steady forge
#

never heard of it ๐Ÿ˜ญ

weak sierra
#

they chose which things to allow lua to see/use

bronze yoke
#

it's outdated and obscure

weak sierra
#

it's messy

#

tbh

bronze yoke
#

absolutely

steady forge
#

is this the right place to be looking?

bronze yoke
#

it uses metatables to emulate classes, if you've done oop in lua before it should be familiar

steady forge
bronze yoke
#

great, you should be able to pick things up easily then

#

zombie.Lua is for stuff that was written specifically for lua usage, most of the stuff in the zombie package is exposed

weak sierra
#

u can get most of the info u need from the API website(s) but they are out of date and dont always tell u what a function does (usually dont) and def dont explain the args

#

at which point the decompile is helpful

bronze yoke
#

the website isn't too outdated anymore

weak sierra
#

well yeah the code got stagnant

#

there's more than one site tho

#

some are still 41.65

bronze yoke
#

the site they're on already is the one i'd recommend

weak sierra
#

just be careful if u end up googling for it multiple sites will come up

steady forge
#

yeah classic

weak sierra
#

like "zomboid isozombie" etc. i tend to google to find stuff faster

bronze yoke
#

it's 41.77 but i haven't noticed a huge amount of api changes, there's a community run site for 41.78 but it has a bit less documentation

weak sierra
#

41.78 wasn't huge on api yeah

bronze yoke
#

calling it documentation is very approximate but

weak sierra
#

they broke getOnlinePlayers on purpose (returns empty for non-admins or non-server)

#

and changed some java things for security that i disagree with

#

bigget differences in that build imo

bronze yoke
#

there are a few methods with documentation and you at least don't need to decipher what the parameters are supposed to be (in theory)

weak sierra
#

sometimes parameters are obvious

#

sometimes they are mystical

#

lol

bronze yoke
#

the other site will show you parameters like boolean bool1, IsoZombie zombie1, it can be really difficult to decipher

steady forge
#

I guess I'm struggling with the absolute basics of like, how do I actually interact with the API?

weak sierra
#

you just type class names and function names either from the base game's lua or from the java

#

as if they were just in scope

#

cuz they are

steady forge
#

oh so you just treat them all as globals

#

swag

bronze yoke
#

the special exception is any method in zombie.Lua.LuaManager.GlobalObject can be called directly

weak sierra
#

ah yes

bronze yoke
#

e.g. getPlayer() not GlobalObject.getPlayer() as it would be with other classes' static methods

weak sierra
#

i imagine the latter would also work..? though silly

#

but idk, maybe it breaks kek

bronze yoke
#

i feel that it's not actually exposed as a class

weak sierra
#

that would make some sense yeah

#

more like injecting it into the scope

steady forge
#

cool I think I'm starting to get it haha

weak sierra
#

will also help to inspect others' mods and the basegame code

#

find something similar to what u wanna make

#

poke thru it

steady forge
#

yeah that's what I'm doing atm, poking through some mods I like and seeing how they work

#

i might skip making mods and just create tools first haha

#

I miss my old workflow

steady forge
#

this is what the directory looks like

#

It's only adding type hintings for files that are open

#

Oh do I have to require in first?

bronze yoke
#

i don't really know why that doesn't work, but adding the umbrella folder to the lua extension's library setting does

#

i don't use vscode myself so i can't be too sure

fast galleon
steady forge
bronze yoke
#

yeah!

steady forge
#

I was gonna try to use it as that seems to be the default, but its Vim plugin is too slow for me ๐Ÿ˜…

#

might be making this harder for myself

bronze yoke
#

i'd stick to vscode, idea's lua plugin is garbage

#

if you're more comfortable with idea then it might be worthwhile using it instead (though there are caveats to using umbrella with it) but overall i'd recommend vscode

steady forge
#

I'm definitely more comfortable with vscode so happy to hear that advice!

#

It looks like the language server wasn't preloading Umbrella's stuff because they were submodules

#

so i just deleted the .gitmodules

#

hacky solution but will do while I'm learning!

#

ty for your help everyone โœจ

fathom barn
#

How to make/edit maps in PZ?

tardy wren
fathom barn
#

didn't saw that, even though it's 2 rooms below

crystal terrace
#

and dirk's tutorials on mapping, solid stuff.

tardy wren
#

Do translation txt files work like the sandbox options txt files, as in they're appended to the big array if they don't specifically overwrite a value?

crystal terrace
bronze yoke
#

if i understand your question, yes

drifting ore
#

Can you spawn blood on the floor? if so how?
What about ambient sound? i want to play some of the vanilla ones.

tardy wren
#

No sub-items yet but I'm working on it now

#

After that it'll be doing the actual pouring action

crystal terrace
crystal terrace
tardy wren
#

Also... is OnGameBoot the earliest event that gets called?

bronze yoke
#

yeah, they aren't file overrides or anything

#

probably

#

there could be specific system init events that fire before that but i'm not aware of it

tardy wren
#

Alright. Suppose it's good for me. Wanted to patch items as early as possible in the game load while still making it an event, so the table of items to patch is externally appendable

bronze yoke
#

if you do it OnInitGlobalModData you'll be able to access sandbox options if that appeals to you

tardy wren
#

I don't need them in this case, I'm already aware of that

#
            for _,item in ipairs(eligibleFuelItems) do
                --check if item is a partially filled item to create the other item's tooltip. Then move to a different function
                if instanceof(item, "DrainableComboItem") then
                    local subOption = subMenu:addOption(item:getName(), items, ISInventoryPaneContextMenu.onTransferWater, ethanolItem, item, player);
                    local tooltip = ISInventoryPaneContextMenu.addToolTip()
                    local tx = getTextManager():MeasureStringX(tooltip.font, getText("ContextMenu_EthanolName") .. ":") + 20
                    tooltip.description = string.format("%s: <SETX:%d> %d / %d",
                            getText("ContextMenu_EthanolName"), tx, item:getDrainableUsesInt(), 1.0 / item:getUseDelta() + 0.0001)
                    subOption.toolTip = tooltip
                else
                    subMenu:addOption(item:getName(), items, ISInventoryPaneContextMenu.onTransferWater, ethanolItem, item, player);
                end
            end
#

I was hoping I could use the vanilla pouring action, but... That makes the character Reverse Jesus

#

They turn alcohol into water

#

Gotta have to write my own fluid transfer code

#

Maybe I can reuse the timed action at least

#

IT works

#

There's just... two issues

#

One is that items that are full still show up...

#

Two is that I still have a lot of copied over vanilla code... Which works, but it's not pretty

worldly olive
#

Hi guys. I need guidance on where (in the code) to look for the stealth mechanics.
I would like to understand how feasible is to make furniture to also affect the player vision cone and also the zombie sight. I would say is impossible due to it being in Java but MAAAAAAAYBE there's a chance?

mellow frigate
#

for sure java only for vision cone

worldly olive
#

Supposed that. Sad. That's what missing to sneaking

limber onyx
#

Hey guys. Thanks for the help with my last mod.

I'm working on something new. I'd like to know how you create mod dependencies and mod modules for the workshop.

#

Like, when you see that someone else's mod is necessary to run another, and then you can have several sub-mods to choose from in game

bronze yoke
#

mod dependencies are just a require=ModA,ModB,ModC in the mod.info, no spaces between ids

#

submods are just separate mods all placed into the Contents folder when uploading

limber onyx
#

cool, thanks mate!

crystal terrace
#

anyone knows where can i find code related to "picking up items" ?

tranquil jackal
#

Hey all, is there a guide for adding UI Elements?

trim mist
#

Hey y'all, idk if y'all know this but. You can highlight objects without doing it in a render function.

#

instead you can toggle an IsoObject (or at least a floor) highlight like so:

#
square:getFloor():setHighlighted(SafehouseMarkers.highlighted, false);
#

I was under the assumption from my research that setHighlighted only worked if you did it per frame. However, something I didn't notice at the time is that the setHighlight function has an overload, for a variable named "renderOnce"

#

with no second variable (in this case a bool) provided, it defaults to true, which means your highlight lasts for only one frame or so. if you set it to false, it behaves intuitively.

#

Figured this could help someone down the line. So just listing it here for posterity

balmy terrace
#

How unethical would it be to make a โ€œmodpack loaderโ€ which would let modpack creators define a list of mods to load and configs to match? Iโ€™m concerned it could be used to make modpacks without mod author permission, but it could be a fun project (not to mention one I could make use of)

granite ginkgo
#

Guys I have an entire model for both back seats,how shhould I assign the model???

#

Like should I just cut it so I have two different models for both back seats?

fast galleon
#

Unless you have another way to hide it.

granite ginkgo
#

I dont have any other way tho

fast galleon
#

what confusion?

#

oh I think I understand

granite ginkgo
#

ill send a ss wait a sec

#

this are the backseats and it's an entire model basically

#

if i assign this model to both the rear seats

#

and i remove one

#

it would still look liek both of them are there

fast galleon
#

I think best way would be to uninstall the other seat too when any of them is removed.

granite ginkgo
#

hmm,yes,I don;t have any scripting knowledge regarding lua,I only know c++

#

Ill try tho I think

fast galleon
#

A part parent is mainly used for syncing animations, perhaps it's something that can be used in this case.

* e.g. You add the seat as main part and 2 children just for the seat areas. Or if it works, you can have one seat for parent part and one as child.

** seats are not assigned to part but to vehicle, so it can be done with one part? In script only the container would be affected by the seat.

granite ginkgo
#

hmm

#

another question

#

to add individual headlights,I gotta add the templates first,right?

faint kestrel
#

I'm thinking of modifying the game files so heavy-duty armor and clothing doesn't take damage from zombies. Stuff like chain mail and kevlar. How would I do this?

rigid mauve
#

I'm not certain, but I think setting "CanHaveHoles = false" is all you need to do for each item.

faint kestrel
vapid quest
#

is there any way to make new command for server?

drifting ore
#

can you spawn blood over furniture or terrain?

tepid dawn
vapid quest
#

yeah

vapid quest
tepid dawn
#

I'm not that particularly experienced at that, but I can think of a way

#

I think that you can write a function that will be triggered on each chat update, which will look for what was said in chat(which will be your command i.e /kill), and then do what it has to do.

#

this is only the general framework though, I think i might be able to help if you get started

vapid quest
#

there is 2 lua events OnAddMessage and OnAdminMessage, i tried but it only work with messages like /say message

tepid dawn
#

i mean entirely independent commands like /safehouse or /faction

#

I guess there was a lua file that handled those commands, I'll try to check it and maybe it can be reverse engineered

vapid quest
#

i want just custom command like when admin type /command it prints hello in log

tepid dawn
#

and you want it to be independent from /say

vapid quest
#

i just want to make commands like default /"name of command"

tepid dawn
#

got it, im trying to think of a way

vapid quest
#

thats another event just to connect client and server with some function, don't it?

tepid dawn
#

well its been a while but i saw some mods using that for custom commands

vapid quest
#

ok but what to do now? how to use this for commands?

tepid dawn
vapid quest
tepid dawn
#

Well i dont know either, i'll try to look if I can find that mod that adds a command of its own. I guess it will be helpful, will inform you if I do.

vapid quest
#

ok, thanks you a lot

tepid dawn
#

i didnt help much but thank you as well lol

vapid quest
#

i can try to do something with onclientcommand, if it'll work i'll say you

tepid dawn
median mantle
rigid mauve
faint kestrel
faint kestrel
#

Do I need to write a Lua file for a mod that adds new (already existing in the games code) variables to a mod's txt files?

bronze yoke
#

no, but modifying items through lua is safer than editing the txts

faint kestrel
#

I got the mod to appear in the game. Just have to make sure the values are being changed.

drifting ore
#

Hey, is there a way i can access the vanilla map cells? i want to modify some of them but i want to retain their original structure

bronze yoke
#

somebody decompiled the vanilla map, it doesn't seem to be pinned but if you ask in #mapping someone probably has it

faint kestrel
#

So I went to testing the armor that I changed so that it wouldn't get holes in it. It's still getting holes so something is missing. I don't want to save the entire mod twice, just trying to make a patch/data value change

frank elbow
#

Really should only need one. Its name escapes me at the moment, but you just need to intercept the command handling, check for and handle your command, and defer to the original if it doesn't match (to try to be compatible with other mods that override it)

update: now at my computer to check; it's ISChat:onCommandEntered

crystal terrace
#

I'd like to interact with mechanic responsible for picking up items on double click, is it some timed action i need to look into? Suggestions?

frank elbow
crystal terrace
#

not the inv, but like when the items are in the world. You double click to pick em up. Although you could say containers ig.

frank elbow
#

It's referred to as the "loot inventory" in code, I believeโ€”what I really intended to ask was whether you were talking about clicking on objects in the world, because I didn't recall that being a thing ๐Ÿ˜„

crystal terrace
#

ah so ISInventoryPane:onMouseDoubleClick this is it right? thanks

vapid quest
frank elbow
vapid quest
#

sorry, i can't to do this now

frank elbow
#

That would be the place to start

vapid quest
#

ok, i'll check it, thanks

uneven mauve
#

Hey I generated a heatmap with possible sledgehammer locations but I can't really test it's accuracy as I am not that familiar with all of its locations, does this map make sense to you? I know the fire station in rosewood is not showing as a possible location lol

faint kestrel
#

Can lua files change true/false values?

brave dew
#

is there a blender rig for the pz character model

#

i wanna make animations with it

covert carbon
#

Ive been trying to get the game to detect if the player is in a car but it keeps returning errors, anybody know why? Print(getPlayer():isSeatedInVehicle())

steady forge
#

otherwise, what's the error?

bronze yoke
#

the capital p seems like the issue

#

the only other reason this should be able to error is if it's being called before a player exists

covert carbon
#

omg

#

thank you

#

ill be back in a second with results

#

it works

#

holy shit ive been trying to fix that code for 2 hours and it never occured to me that my print was capitalized

#

thank you

limber onyx
#

Hey guys. Currently working on a mod to change some values for Capacity, weight reduction for some bags.
I don't know what I'm doing wrong but the game is crashing when I load my mod.

#

These are the files i'm changing and I made sure I didn't place an item from one of them into the other, so I have no idea what could be causing a crash

#

I literally just copied the data from the game files, put it into my own mod and changed some existing values, didn't add new items, didn't add functions or nothing

covert carbon
#

so you are just pasting the recipe from the text file in game and pasted it into your own text file?

#

what did you change in your file

limber onyx
#

weight, weight reduction and carry capacity for a lot of containers

#

and the weight of 2 items in the hats file

covert carbon
#

what is the difference between the clothing_bags file and the newBags file

random finch
#

Which file stores the Non PvP/Safe zone information?

vapid quest
# frank elbow That would be the place to start

so i checked this and have no idea how to do this
part of code:

    local chat = ISChat.instance;

    ISChat.instance:unfocus();
    if not command or command == "" then
        return;
    end

    local commandProcessed = false;
    local chatCommand;
    local chatStreamName;
    for _, stream in ipairs(ISChat.allChatStreams) do
        chatCommand = nil;
        if luautils.stringStarts(command, stream.command) then
            chatCommand = stream.command;
        elseif stream.shortCommand and luautils.stringStarts(command, stream.shortCommand) then
            chatCommand = stream.shortCommand;
        end
        if chatCommand then
            if chat.currentTabID ~= stream.tabID then
                showWrongChatTabMessage(chat.currentTabID - 1, stream.tabID - 1, chatCommand); -- from one-based to zero-based
                commandProcessed = true;
                break;
            end
            chat.chatText.lastChatCommand = chatCommand;
            local originalCommand = command;
            command = string.sub(command, #chatCommand);
            if command ~= "" and command ~= " " then
                chat:logChatCommand(originalCommand);
            end
            chatStreamName = stream.name;
            break;
        end
    end
    if not chatCommand then
        if luautils.stringStarts(command, "/") then
            SendCommandToServer(command);
            chat:logChatCommand(command);
            commandProcessed = true;
        else
            local defaultStream = ISChat.defaultTabStream[chat.currentTabID];
            chatStreamName = defaultStream.name;
            chat:logChatCommand(command);
        end
    end```
frank elbow
vapid quest
#

i think it just checking the command

frank elbow
#

Okay, that's a good high-level understanding of it. What about at a lower level? Do you see where in the code it's checking the command string, for example?

vapid quest
#

if luautils.stringStarts(command, stream.command)

frank elbow
#

Good. What part about it is confusing, then? Are you unsure how you'd go about overriding it?

vapid quest
#

just how should i add my commands to list of standard commands

frank elbow
#

There's a second question in that message ๐Ÿ˜„ Are you familiar with the practice of overwriting vanilla Lua functions & methods?

vapid quest
#

not really

frank elbow
#

Okay, that's fine. I explained it a bit up here #mod_development message, but since this is a method here's a more applicable example:

-- where ISChat.someMethod is a method on ISChat

local _someMethod = ISChat.someMethod
function ISChat:someMethod(...)
  -- add your override behavior
  --- ...
  --- if your override isn't necessary, defer
  return _someMethod(self, ...)
end
#

In your case, ... isn't necessary since onCommandEntered doesn't have parameters iirc

vapid quest
#

sorry, don't get it

frank elbow
#

Be more specificโ€”what don't you get?

vapid quest
#

just all

frank elbow
#

So... no part of that message was comprehensible? ๐Ÿ˜„ It'll be easier to explain if you point out particular things you're unsure about

vapid quest
#

ok, what is _someMethod?

frank elbow
#

The purpose of that variable is to save a copy of the existing method

#

In your case, onCommandEntered; you want a reference to the original function so you can call it in your override

vapid quest
#

so i need to use ISChat.onCommandEntered if i need this?

frank elbow
#

Can you rephrase that question? I'm unsure what you're asking

#

Oh, you mean as the part on the right? Yes

vapid quest
#

if i need method onCommandEntered i need to replace ISChat.someMethod to ISChat.onCommandEntered?

frank elbow
#

Yes

vapid quest
#

what to add in function?

frank elbow
#

You tell me. First step: look at the vanilla code and think about what it's doing to get the command string

vapid quest
#

can you explain pls what is this self.textEntry.onCommandEntered = ISChat.onCommandEntered;?

frank elbow
#

You don't have to worry all that much about that part, but what it's doing is setting the callback function that will be called when text is entered in the ISTextEntryBox to that method

#

The reason you don't have to worry about it is that it will run after your override has already occurred, assuming you do it in the main body of one of your scripts

vapid quest
#

also what is this local command = ISChat.instance.textEntry:getText(); local chat = ISChat.instance;?

#

like how variables are getting

frank elbow
#

What's your assumption, based on the code around it?

frank elbow
vapid quest
frank elbow
#

ISChat.instance points to the single instance of ISChat. As you noticed in createChildren, ISChat sets up a text entry box (textEntry). ISChat.instance.textEntry will point to that

vapid quest
#
            chatCommand = stream.command;
        elseif stream.shortCommand and luautils.stringStarts(command, stream.shortCommand) then
            chatCommand = stream.shortCommand;
        end``` i think this part of code is checking the command to its full version or short, yes?
frank elbow
#

Yes. Do you see where stream comes from?

vapid quest
#

no

#

oh yes

frank elbow
#

& where's that

vapid quest
#

for _, stream in ipairs(ISChat.allChatStreams) do

frank elbow
#

Do you get what that line is doing?

vapid quest
#

not really

#

just don't know what stream is using for

#

oh i think i found sth

#
ISChat.allChatStreams[1] = {name = "say", command = "/say ", shortCommand = "/s ", tabID = 1};
ISChat.allChatStreams[2] = {name = "yell", command = "/yell ", shortCommand = "/y ", tabID = 1};
ISChat.allChatStreams[3] = {name = "whisper", command = "/whisper ", shortCommand = "/w ", tabID = 1};
ISChat.allChatStreams[4] = {name = "faction", command = "/faction ", shortCommand = "/f ", tabID = 1};
ISChat.allChatStreams[5] = {name = "safehouse", command = "/safehouse ", shortCommand = "/sh ", tabID = 1};
ISChat.allChatStreams[6] = {name = "general", command = "/all ", tabID = 1};
ISChat.allChatStreams[7] = {name = "admin", command = "/admin ", shortCommand = "/a ", tabID = 2};```
frank elbow
#

Okay, good. Side note: I highly recommend reading the Lua manual for Lua 5.1โ€”it doesn't map exactly 1:1 with the Lua PZ uses, but it's very close

vapid quest
#

ok, i'll read it later

frank elbow
vapid quest
#

thanks

frank elbow
#

I mention this because being familiar with the language used for modding will be a significant help

#

Knowing that the above is a loop would help to interpret the code

vapid quest
#

i don't understand sth

#
            if chat.currentTabID ~= stream.tabID then
                showWrongChatTabMessage(chat.currentTabID - 1, stream.tabID - 1, chatCommand); -- from one-based to zero-based
                commandProcessed = true;
                break;
            end
            chat.chatText.lastChatCommand = chatCommand;
            local originalCommand = command;
            command = string.sub(command, #chatCommand);
            if command ~= "" and command ~= " " then
                chat:logChatCommand(originalCommand);
            end
            chatStreamName = stream.name;
            break;
        end```
#

why are they did these

#

if they have chatCommand

frank elbow
#

Take a look at where chatCommand is assigned (other than the nil assignment)โ€”it's in an if statement with an elseif branch. No else branch โ†’ it isn't necessarily set โ†’ it can be nil

#

They're checking to see if it exists before using it & assigning chatStreamName

vapid quest
#

also don't understand how can they check if not chatCommand then if in chatCommand have to be something after previous loop

frank elbow
#

Why does chatCommand have to be something after the previous loop?

vapid quest
#

because of this chatCommand = stream.command; and this chatCommand = stream.shortCommand; no?

vapid quest
#

what is chat:logChatCommand?

frank elbow
#

Did you search for logChatCommand?

vapid quest
#

no

frank elbow
#

Okay, try that

vapid quest
#

so its just sending commands to log?

frank elbow
#

Yes, it's just keeping a list of recent commands

vapid quest
#

so can't i just add my commands to allChatStreams, and just make function like processSayMessage but with my code

#

ohhhhh

frank elbow
#

You can do something similar to that, yes. It isn't strictly necessary to add your commands to allChatStreams, since your own code will handle your custom commands

#

But that is the essential idea. Well done

vapid quest
#

thanks for help ๐Ÿ™‚

frank elbow
#

No problem

vapid quest
#

also what is tabID?

frank elbow
#

It specifies which chat tab a stream should be available in. If you haven't played as an admin, you've only ever seen 1 chat tab (which doesn't display the tabs)

vapid quest
#

thanks

#

also i don't know how to send messages in chat for all players, i tried some ways but it didn't helped

frank elbow
#

I'm assuming you're talking about a server message, anyway. Is that not the case?

vapid quest
#

yes

frank elbow
#

This is essentially how I implemented it, with some details removed:

local InfoMessage = {
    isServerAlert = function(self) return self.isServerAlert end,
    getText = function(self) return self.text end,
    getTextWithPrefix = function(self)
        -- you may want to transform `text` here to match usual server messages
        return self.text
    end,
    new = function(self, text, isServerAlert)
        return setmetatable({
            text = tostring(text),
            isServerAlert = isServerAlert
        }, self)
    end,
}
InfoMessage.__index = InfoMessage

-- to add a server message:
ISChat.addLineInChat(InfoMessage:new('message text'), ISChat.instance.currentTabID - 1)
#

You'll need to handle actually sending it to every player, which you can do via client/server commands. These have been covered by others; I'd recommend checking the pins or searching

vapid quest
#

thanks

#

also want to ask about SendCommandToServer(), in server code i need to put OnClientCommand like when using SendClientCommand?

frank elbow
#

SendCommandToServer is not related to those; that's specifically for sending chat commands to the server for handling

vapid quest
#

thanks

#

what difference between ipairs and pairs

frank elbow
#

In case that doesn't answer: pairs loops all key-value pairs, ipairs loops numeric key-value pairs & assumes they're in order starting at 1 (i.e., it will ignore non-numeric keys & any gaps will terminate the loop)

vapid quest
#

thanks

frank elbow
#

The manual also has an index of built-in functions that explains what they do, for similar questions

bronze yoke
#

to my knowledge any case where you can use ipairs, you can use a for i loop instead which runs a lot better

vapid quest
#

i have an error in this line SendClientCommand("cmd", "hello", {});

#

its in checking of chatstreams name

#
            SendClientCommand("cmd", "hello", {});```
median mantle
#

sendClientCommand

#

not 'S'

vapid quest
#

oh thanks

#

now i have no errors but still no prints,
server code:

    if module == "cmd" and command == "hello" then
        print("Hello World!")
    end
end

Events.OnClientCommand.Add(cmds) ```
bronze yoke
#

if you're testing in multiplayer, make sure you're checking the right log file

vapid quest
#

which file i should check?

bronze yoke
#

coop-console.txt

#

assuming it's in-game hosted

vapid quest
#

oh thanks, its working

#

which type i should use for checkbox in sandbox-options?

bronze yoke
#

boolean

vapid quest
limber onyx