#mod_development

1 messages · Page 340 of 1

tranquil reef
#

This is a dumb question, but do the developers of the game design sounds from the perspective of being the player, or from the distance of the camera

bronze yoke
#

the distance is modelled around the player's location, but spatialisation happens around the camera

gloomy hatch
#

Nothing I did worked. I can’t expect others to babysit me, but if anyone has run into this error specifically on Linux - feel free to share. Not really sure what I’m missing.

#

At least I fixed the file directory 👍.

dusky quiver
#

I've straced it to failing syscall

linkat(AT_FDCWD, "/proc/self/fd/42", AT_FDCWD, "/home/lexx/.TileZed/Tilesets.txt", AT_SYMLINK_FOLLOW) = -1 EXDEV (Invalid cross-device link)

and backtrace from debugger showed

Thread 1 "TileZed" hit Breakpoint 1, 0x00007ffff5bb2310 in linkat () from /usr/lib64/libc.so.6
(gdb) bt
#0  0x00007ffff5bb2310 in linkat () from /usr/lib64/libc.so.6
#1  0x00007ffff61dbf92 in QTemporaryFile::rename(QString const&) () from ./lib/libQt5Core.so.5
#2  0x0000555555772389 in SimpleFile::write(QString const&) ()
#3  0x0000555555712e78 in TilesetsTxtFile::write(QString const&, int, int, QList<TilesetsTxtFile::Tileset*> const&, QList<TilesetsTxtFile::MetaEnum> const&) ()
#4  0x0000555555831beb in Tiled::Internal::TileMetaInfoMgr::mergeTxt() ()
#5  0x00005555558324b5 in Tiled::Internal::TileMetaInfoMgr::readTxt() ()
#6  0x00005555556745d7 in Tiled::Internal::MainWindow::InitConfigFiles() ()
#7  0x00005555556216f0 in main ()

so clearly usage of QTemporaryFile::rename across filesystems is the issue, and it can be worked around like in mentioned commit

ancient grail
#

anyone know if global moddata is available during character creation / profession creation menus
figured it out

thin swan
#

lmao, never knew that sprinting into a wall makes you fall down.
Guess I got no excuse now not to implement crashing into things and falling off the bicycle

crystal canyon
#

how can i mod it so scythes can take down corn plants/stalks?

#

they dont need to return anything, just want to reclaim space

sharp plinth
mellow frigate
crystal canyon
#

yes

crystal canyon
#

<@&671452400221159444>

#

Crypto spam

simple wraith
#

Hello, I would like to know how to place objects with 100% probability in a specific container with a script and in which directory to place it for build41.

true nova
#

ah i misunderstood. you just want it removed

#

you can modify ISRemoveGrass timed action and add the scythe to it and change whatever values for it

simple wraith
#

@bright fog but si 100% chance . I need crate a base for misión military

simple wraith
#

I need to create a map and have specific containers with specific items inside it and they must appear in the quantities I want.

bright fog
#

So all you have to do is verify that it is the right container

#

And then add the item

queen oasis
#

I have a mod that is conflicting with another mod and I'm curious if I'm mucking with this function in a bad way to cause the issue:

 -- my code
local old_ISGrabItemAction_new = ISGrabItemAction.new
function ISGrabItemAction:new(character, item, time, dest)
    local t = old_ISGrabItemAction_new(self, character, item, time)
    if dest ~= nil then
        t.destContainer = dest
    end
    return t
end

-- their code
local OriginalGrabItemAction = ISGrabItemAction.transferItem
function ISGrabItemAction:transferItem(obj)
    local item = obj:getItem()
    if something then doSomething end
    OriginalGrabItemAction(self, item)
end```
bright fog
#

If yes, make sure to return its result in your function

#

Else

bright fog
#

Are you SURE you have a conflict ? Decorating a function means it'll appear in the stacktrace of an error in that function called from other mods

bronze yoke
#

not passing in the dest argument can be problematic, but it looks like you're dropping it on purpose, is there a need for that?

bright fog
#

He added a custom one

queen oasis
#

dest is added, it's not in the original function

bright fog
#

Does that other mod do that too ?

bronze yoke
#

i'm gonna say don't do that, that is problematic 😅

bright fog
#

Yea definitely won't make it as a compatible as expected

bronze yoke
#

why do you need to override if all you're doing is adding an argument? can't you use an entirely separate function?

queen oasis
#

I figured I was safe as long as long as another mod wasn't trying to do what I did

bronze yoke
#
local function createWithDest(character, item, time, dest)
    local t = ISGrabItemAction:new(character, item, time)
    if dest ~= nil then
        t.destContainer = dest
    end
    return t
end
bright fog
#

You don't modify the original calls of the functions in the vanilla code anyway, you're using a custom function at the end of the day

#

So there really is no need for that

bronze yoke
#

you really want to avoid making api changes

bright fog
#

Or that means you're modifying how the original function is called at some various places (which still probably should use a specific function for that)

queen oasis
#

tunnel vision is fun

bright fog
#

Happens

glacial flicker
#

I really hope the person making Inventory Tetris can make all of PZ mods compatible because it's so much fun.

tranquil reef
#

Is it possible to disable / enable certain sounds from playing for specific players, like if they want to disable a notification sound or change it, in their personal mod options rather than sandbox

tranquil reef
#

moyai Just made the same mistake, tried so many different things in code for like 40 minutes

ancient grail
deep vale
#

Hey guys i was wondering, is it possible to implement something for a pvp server such as, when a player enters a certain area "hot pvp spot area" , lets say WestPoint, his location becomes visible to everyone on map / all those in the same "hot spot".

#

Or maybe has someone tried something like this before?

river ore
#

Anyone got an EAS alert mod that plays in radio and TV? Like a real time updating one?

#

One that updates whwre quarantine areas and just general news about the knox virus?

icy sail
#

@deep vale Sry for late response, been afk for a while. You can do this, all you need is to determine absolute x and y range of your hot spot area, check if player x and y in that range and show player on map (check out players on map mod)

mild cloak
#

Guys how do i make a texture mod for a car, if i dont want it replace existing but kind of add it to already existing textures so the car with the texture is gonna be spawned with some chance

ancient grail
#

but you sorta need to spam maybe
there might be other ways

hot eagle
#

guys what is the best way to learn how to create mods for project zomboid ?

drifting ore
hot eagle
#

yeah i need to try with small mods at first ofc

#

but idk what is the best guide to read

drifting ore
#

Idk, start reading. 👍

hot eagle
#

cuz i feel i am lost bcuz idk how i can make items, i am lost between 3d and 2d

#

okay then

drifting ore
#

Only been modding for like a week so far.

#

Someone else might know more!

tranquil reef
#

Is there a context menu tooltip max length

latent locust
#

Hey so I have models made for scars and stuff but I have no idea how to code it can anyone help out?

silent zealot
# hot eagle guys what is the best way to learn how to create mods for project zomboid ?

Do you have a specific mod idea you'd like to make? As well as the modding wiki (which is an excellect resource) we can point you in the best direction to get started, or to break it down into smaller pieces to get started with.

(Or we can shatter your dreams by pointing out that what you need is handled in java and not accessible to mods, but that's just part of Zomboid modding.)

rancid tendon
#

hey folks, is there a way to make a bag that only accepts items of a certain displaycategory?

silent zealot
#

Yes, there is the option to add a filter function to a conatiner.

#

Look at the vanilla items like ammo bandolier, wallet etc

rancid tendon
#

i do know of OnlyAcceptCategory, but that seems to apply only to the item Category and not its display category

silent zealot
#

there will be a line in the item's script naming a lua function that decides what is/isn't allowed.

rancid tendon
#

and i couldn't seem to find anything about filtering specifically for the display category

silent zealot
#

And since it's a lua function, it can use any logic you like to decide if an item is allowed.

rancid tendon
#

oh i see what you mean now, ok i'll sniff around!

silent zealot
#

AcceptItemFunction

#

The vanilla ones are all in AccecptItemFunction.lua, but you don't need to use that namespace - just make a non-local function with (container, item) as the prarameters that returns true the item is allowed.

#
--***********************************************************
--**                    THE INDIE STONE                    **
--***********************************************************

AcceptItemFunction = {}

-- The item.AcceptItemFunction script property for item containers
-- specifies the name of a Lua function that will be called to test
-- whether an item is allowed inside a container.  The function name
-- may contain "." characters. For example:
--     AcceptItemFunction = AcceptItemFunction.FirstAidKit,

-- Example: not used
function AcceptItemFunction.FirstAidKit(container, item)
    return item:getStringItemType() == "Medical"
end

-- -- Example: not used
-- function AcceptItemFunction.KeyRing(container, item)
--     return item:getCategory() == "Key"
-- end

function AcceptItemFunction.AmmoStrap_Bullets(container, item)
    return item:hasTag("Ammo") and not item:hasTag("ShotgunShell")
end

function AcceptItemFunction.AmmoStrap_Shells(container, item)
    return item:hasTag("ShotgunShell")
end

function AcceptItemFunction.KeyRing(container, item)
    return item:getCategory() == "Key" or item:hasTag("FitsKeyRing")
end

function AcceptItemFunction.HolsterShoulder(container, item)
    return item:hasTag("PistolMagazine") and container:getItems():size() < 2
end

function AcceptItemFunction.Wallet(container, item)
    return item:IsMap() or item:IsLiterature() or item:hasTag("FitsWallet");
end
rancid tendon
#

oh this is perfect, should be super easy, thank you!!

silent zealot
#

yep, just use item:getDisplayCategory() (and hope the display category hasn't been changed by other mods)

tranquil reef
#

The black part of the ears also registers as eyebrows

#

Took me a long time to see it the right way, now I do if I actually look at it, but I still see the face when I see it in the corner of my eye. Just thought this was important info i needed to share with you

silent zealot
#

I tried but I can't see it like that

#

But thank you for sharing

maiden thistle
#

so why is the model floating? it check the model in blender and the .txt files and they look fine

spring veldt
#

I've made a clothing mod, but whenever i put it on my character, he becomes invisible, how do i fix this?

maiden thistle
thin swan
bright fog
#

I don't see it haha

muted garnet
#

what does self:adjustMaxTime do in TimedActions?

bronze yoke
#

it returns a duration adjusted by negative moodles

#

so things like unhappiness, drunkenness slow down timed actions

muted garnet
#

Got it, thank you!

thin swan
#

Anyone know if the watch UI (the one showing in the top right corner when you equip a watch) is fully java side or if it can be manipulated with Lua? From my digging it seems to be java sided but thought I'd ask

crystal canyon
thin swan
crystal canyon
#

Yeah, i just need it while I play, but storing it does make sense

thin swan
# crystal canyon Yeah, i just need it while I play, but storing it does make sense

Just add this to your script tag:

document.querySelectorAll('input[type="checkbox"]').forEach(cb => {
    cb.addEventListener('change', () => {
        localStorage.setItem(cb.id, cb.checked);
    });
});

window.addEventListener('DOMContentLoaded', () => {
    document.querySelectorAll('input[type="checkbox"]').forEach(cb => {
        const saved = localStorage.getItem(cb.id);
        cb.checked = saved === 'true';
    });
});
crystal canyon
#

Thanks! beat me to it lol was working on it already

#

I was gonna do it like:

    document.querySelectorAll('input[type="checkbox"]').forEach(cb => {
        const key = cb.id;
        cb.checked = localStorage.getItem(key) === 'true';
        cb.addEventListener('change', () => {
            localStorage.setItem(key, cb.checked);
        });
    });
thin swan
#

Yeah that definitely works as well and is more compact

queen oasis
thin swan
tranquil reef
tranquil reef
#

It's times like these when everyone's listing problems in my mods that are based entirely on zomboid limitations that I realize how actually bad modding is PensiveCowboy

#

Too many things locked behind java and too much jank. I know it's lower priority than working on the actual base game, but it's burning me out

jolly goblet
#

Help. How can I make an item that can be translated into different languages? Try to follow what the page says.

bronze yoke
#
ItemName_EN = {
    Base.LoreNote001 = "Whispers in the Dark",
}
#

the display name you set does not matter, it's just the item's full type (but you have to set one for some reason, or translation will not work)

orchid marten
#

every mod i've seen shows your ammo in MORE places, has anyone ever considered i don't want to see it at all

jolly goblet
bronze yoke
#

what you want would probably involve InventoryUI.getTooltipElementByLabel and InventoryUI.removeTooltipElement

drifting ore
orchid marten
thin swan
vital sedge
thin swan
vital sedge
#

yes, it fixes that!

#

and works with the obsolete chance to aim mode

#

even if you dont hit the zombie, it do a simple "raycast" with checking zombies around cursor

#

well technically CanSee innate function in pz is raycast but its not costly

#

it should be less performance heavy than atro that does actual raycast/collision

#

i also have an old mod i was working on that attached guns to zombies on spawn, create holster if necessary and then spawn appropriate randomized ammo and mags upon death, but idk if i release it, i worked on containers spawns too, would have to prune code and do a simple branch with just zombies.

floral tangle
#

hello! i am new to the mod world and wanted to create my first mod where i chose pz as the game (b42). to learn modding the game, i wanted to make a very simple mod where it adds spoilage timers to dry breakfast foods like cereal, oats, tea, and coffee in the game (changing the food properties as a mod). i was about going to test it but i am not sure how my mod directory supposed to look like and where do i put it to the game folder for testing? i attempted to put it in "zomboid/mods" folder which the mod fail to appear. i watched some videos of making pz mod but i feel like i am missing steps. mind helping out?

#

also do i have to import my mod file here to diagnose the problem?

vital sedge
#

@floral tangle copy existing mod and then adapt it

floral tangle
#

tried it

vital sedge
#

lack of empty common folder is also a culprit

floral tangle
#

empty common filder hm?

vital sedge
#

make sure id of the mod is differnet

#

and no spaces there

floral tangle
vital sedge
#

also you have very nice idea, yes

#

for those that long play could be interesting

#

instead of just hoarding

floral tangle
vital sedge
#

flour definitely spoils after some time, i had a pack of flour opened for six months and it got stale

floral tangle
#

true! thats why i am trying to make a mod that expires all dry food

#

but i am conducting on a small scale first

#

however the mod still not showing up

#

my mod ids are right

vital sedge
#

wheres b42 folder?

floral tangle
#

its all coming together now

#

no wonder i saw several other mods with b42 folder

vital sedge
floral tangle
#

earlier you mentioned empty common folder

#

whats that supposed to do?

vital sedge
#

idk but my mod didnt list without it

floral tangle
#

hmmm

#

i see alright give me a minute i will apply this

vital sedge
#

game is janky so all kinds of stuff is expected but not immediately obvious

floral tangle
#

heh i am new the the modding world so this is a pretty steep dive

floral tangle
vital sedge
#

yes

floral tangle
#

got it!

bronze yoke
#

the common folder holds files that are used by every version of the mod (usually assets), it's probably a bug that you have to have one though

floral tangle
#

that makes sense

#

anyway i am going to boot up zomboid and see if it loads up

#

seems like no

#

hmmm

vital sedge
#

really just copy other person mod, change name and id and it should work

vital sedge
#

to make sure name your lua folder as the id, and your script too

#

oh and your mod folder too

floral tangle
#

saw it on other peoples mod

vital sedge
#

yes you copy every stuff beside common folder and put it in 42

#

42 srry

floral tangle
#

ahhh

#

i have a strong feeling it would work!

vital sedge
#

its not rocket science, you will get it eventually

floral tangle
#

oh cmon it still doesnt appear

#

i think the game mod loader havent refresh the list yet

#

or do i have to create common file who knows

#

huh

#

all of my b42 mods i subscribed have common folder

#

i will give it a try now

#

doing that before i literally copy someones mod info

#

i think thats my mod

#

FINALLY

vital sedge
#

copy other people shit, change names, change folder names, and it will work bro

#

nice

floral tangle
#

i think thats because

#

i uh

#

earlier i spaced the lines

#

or because of i do this in separate mod info in 42 folder

#

or both

#

i am going to try mess around

#

AHHH

vital sedge
#

yes the mod info file has to match

floral tangle
#

now i see

floral tangle
#

wait i meant

vital sedge
#

what spaces i dont see them

floral tangle
vital sedge
#

ah you added empty white spaces after the lines?

floral tangle
#

yeah tabs

vital sedge
#

parser should solve this, must be some bug then

floral tangle
#

well since the mods loaded even though i removed specifed version

#

i am going to keep empty common files though...

vital sedge
#

nothing like forgetting to remove git folder before uploading your mod where your email is stored...

#

im that stupid

#

now i will get penis pump spam for sure lol

floral tangle
#

XDDDD

#

@vital sedgebut anyways i am going to say i am very grateful for your guide on making my first mod! its been a headache trying to solve it only to end up with the most simple fix

vital sedge
#

version control is a nice feature and i cant go back to coding in notepad but stuff like this can happen

#

@floral tangle no problem!

vital sedge
#

you can for sure, but vs code is just better

#

i used visual studio before for c# and web development was very sceptical of vs code, but in the end its great for small-medium size projects.

floral tangle
vital sedge
#

you can hook it to github and dont worry about losing code

floral tangle
#

but it fails to install when i run the installer for idk reason

vital sedge
#

visual studio is humungous stuff for this, its like trying to squash a a fly with sledgehammer

floral tangle
vital sedge
#

vs code has too!

floral tangle
#

maybe i will find a way to fix the installer issue of mine

vital sedge
#

check the net framework

floral tangle
#

hm i will

vital sedge
#

have all the aio installed

floral tangle
#

after i done test this mod of mine which is going to take a short time

#

ahahaha! it does work!!!!

#

i am now in ultimate peace

#

oh wait i havent checked if it also expire if i pour it in a bowl

vital sedge
#

use the expiry bar mod to check the expiry date.

floral tangle
#

man i maybe should increase the amount of cooking items because i am trying to find bowls on 2 house and got none

floral tangle
#

but first i am going to find a bowl

#

huh 3 house and still no bowl,how annoying

#

oh comeon

#

oh wait i forgot to just use milk carton

#

wait a minute

#

why i am doing this

#

its already on default

#

i am sooo silly

#

i am actually plan to make this mod to make all dry foods perishable even though they last long

#

but it seems i should include other food items such as milk carton,juices and other drinks that also should expire
followed with settings such as when a can is opened the expiration date will be sooner similar to canned food mechanism

thin swan
floral tangle
#

had to reminiscing back. its my dream to make a mod for porject zomboid since its being my most favourite game of all time. the dream was like 1-2 years ago. didnt think i managed to make one today

floral tangle
#

i will look it up

thin swan
floral tangle
#

i used to do this to run debug mode in b41

#

its been a while since i run debug...

vital sedge
#

afaik you can also create scenario or option and add necessary items so you have them each time you start game. Restarting is sometimes useful as the reload lua option/reload particular script not always work for all the code i think. @floral tangle

floral tangle
ancient grail
vital sedge
#

@floral tangle i see you launched your mod, congrats.

floral tangle
#

did it really become popular that quick?

#

oh sometimes i forgot most recent panel exist

vital sedge
#

i wish PZ had inheritance and dynamic editing of item properties because any mod that edit item will confict with any other mod that also edit some other properties of said items

floral tangle
vital sedge
#

nah, it's TIS job to replace the legacy code, the new additions like cars[not exactly new lol], crafting, they start to move into modern coding practices, PZ started as a small project so direct typed items were the easiest path

floral tangle
#

fair point

vital sedge
#

like i wanted to make a stone that can be heated in campfire, just extend the regular stone class and then it could be used in all the relevant recipes, but nope thats not possible. As for why i want to heat stones, it could be used to purify water in primitive survival using also a carved wooden log

floral tangle
#

right now i am working on the rest of dry foods subset and man i have been like working on this mod for 13 hours straight

#

my head hurts imo

vital sedge
#

leverage ai to do the bulk of mundane work like batch replace something

floral tangle
#

i did try to attempt that but then some ai could recognize and cant accept full code lines

#

so i take the old school route

vital sedge
#

if you cant paste whole file into ai. then ask for let say python script to read file and batch change something

floral tangle
vital sedge
#

you can add iscookable to stone, but that will replace base game files/definition and thats just bad for compatibility :/

#

but thats the PZ problem for all the mods that touch items unfortunately

#

unless you make new items then thats fine

#

sapph for example use some lua to intercept stuff too beside changing item def

#

but i stopped using that mod, too much bugs still

floral tangle
vital sedge
#

yes

floral tangle
#

aaand you gotta import frying pan function to it

#

well,its a pan technically

vital sedge
#

i think TIS is slowly reworking stuff, but they are very risk averse to overhauling what works, theres so much stuff that would be needed to change, refactoring all the code, big task. Maybe with next engine update in next few years.

floral tangle
#

asked ai to gather real life expiry data to certain foods

#

damn thats alot

vital sedge
#

well thats a good idea

#

i noticed that people get uppity when a mod has some ai images

#

i used ai to make my poster lol

floral tangle
vital sedge
#

i dont have graphic tablet and i dont know art so thats the only way

vital sedge
#

i remember when it wasnt the case

floral tangle
floral tangle
vital sedge
#

given the amount of crap that is happening with higher zombie population, legacy code and java not being the premier choice for big games, it runs quite well

#

wow 4 cores in 2025 is pain

floral tangle
#

yeah its gen 7th

vital sedge
#

i replaced my ryzen 3600 for 7700 because i felt it hit the limit

#

if i wasnt poor i would get 9800x3d lol

floral tangle
#

i planned to earn money to get a am4 mobo and ryzen 5600x this upcoming sem holiday

#

funny

vital sedge
#

dd4 is cheap, am4 too and 5600x thats within reach i guess

floral tangle
#

yesterday i finished my math finals and straight to making this mod, and ended up to 4:21 am rn

vital sedge
#

well when you get your first job you will have the money heh

floral tangle
#

xDDD

vital sedge
#

ouch

floral tangle
#

this cpu and mobo is soo old

#

even i play with my gpu bottlenecked too

vital sedge
#

PZ bottlenecking gpu is pretty impossible, it would have to be potato level like intel HD graphics

#

i feel like even old gtx 1660 is enough

floral tangle
#

i meant more like other games that demands quite huge of gpu power

ancient grail
vital sedge
#

so i can edit some value of item without fucking other mods?

ancient grail
#

yes

#

not unless youre both editing the same property

vital sedge
#

thats good to know, yes understandable

#

hmm but thats through lua i see, that will apply on runtime i guess?

#

it could work with predistribution merge?

ancient grail
#

during load but it does work even after

ancient grail
vital sedge
#

not really making item mod now :/

orchid marten
#

are there parameters to pass to lua function hooks? specifically i'm using OnWeaponSwing, seems like there's attacker and weapon but i can't figure out how to pass them

orchid marten
#

nevermind i got it
it just wasn't working because i put (attacker,weapon) in front of my function name in .Add

south oriole
#

I have a silly mod idea, basically. If you have bunnies living within the vicinity of your base, after you sleep there is a chance a bunnies will be at the end of your bed and will leave a few carrots there for you. Depending on how many bunnies you have, the higher chance of them giving you carrots are.

bright fog
vital sedge
#

NVM it was wrong mod order applied by default

slim swan
#

anyone know how to not show worldcontextmenu when right click on some special object

slim swan
#

when u right click the world,it always open a world context menus,i want it not show up in some particular case‌

bright fog
#

And that's doable yes

slim swan
#

im making the build menu mod,but when u set drag ,it can use right click to cancel building,but it would show the ground context menu

#

it is super annoying

rancid tendon
#

hey i forget, is it possible to make a single tile that has multiple containers? i'm sure there's an obvious example of it somewhere in the game but i've forgotten

rancid tendon
#

DUH

#

thank you sorry haha i'm a little inebriated

bright fog
bright fog
ancient grail
red tiger
#

It'd be nice if future renditions of the modding API has something for transaction events ('E.G: Spawning an item as part of a mod), had a way to sign the transaction so that the anti-cheat (or third-party ones like mine) can see that and act on it with that signature.

#

With server-side inventories starting in build 42's future multiplayer, this would be the right time to formulate how mods would handle a server-sided simulation of item / inventory transactions with something like a signature.

#

It could be something as simple as the API passing a non-nullable ChooseGameInfo.Mod reference when executing some API call for the action.

#

Saying this out of frustration with how 41 has too much ambiguity with actions, causing a lot of conversations about how the anti-cheats I write are kicking players when it's their mods causing false-positives.

bronze yoke
#

what cheating exactly are you intending to prevent when inventories will be server auth anyway?

red tiger
#

Sledgehammer stuff, building, destroying, fixing, healing, etc.

#

Transformative actions, generically speaking.

bright fog
#

In B42, timed actions will be server side too

#

That'll probably help ?

red tiger
bronze yoke
#

how is the player going to cheat to spawn items when the server controls items? if a mod has some exploit that lets the client trigger e.g. item spawns when it shouldn't, that's on the mod and really difficult for you to deal with externally anyway

bright fog
#

Yea

red tiger
bright fog
#

I had such an issue in my own mod with a duplication glitch

red tiger
#

(Mod exception lists for anti-cheat checks is one example)

#

I can't make a check for all mods but server admins can place something that can match the signature of the authoring mod for an action.

#

So if this mod triggers a false-positive, it can be added to some list that then the anti-cheat in this case would say "Ok. Carry on. This is normal."

#

This would help the game's vanilla anti-cheat too.

#

I'm not mad, but frustrated. This is a great time in the development timeline for such a feature to be deployed.

#

Would save a lot of time / checks if in place. x)

lone gale
#

Hey, is there a list somewhere of code changes for b42 to make updating mods easier? Like for several games I make mods for when the game updates and there are API or structure changes there's usually an accompanying list of those changes for modders somewhere. Just trying to save me having to go through dozens of files one by one checking what I need to change in my mods.

bright fog
#

@bronze yoke has every java side changes in terms of functions parameters etc thx to Umbrella but it doesn't go in detail of the changes
As for Lua, no list either

#

You have the JavaDocs for both B41 and B42

#

And overall the changes aren't too drastic meaning a lot of stuff don't require much changes

bronze yoke
bright fog
#

Main changes I can think about are TimedActions being in shared instead of client now (tho even defining them in client they should work)
And the recipe changes

bright fog
bronze yoke
bright fog
#

It'll be problematic when MP comes out, which you have some time before

bronze yoke
#

there's code that implies they're even still supposed to work in multiplayer but that might just be a temporary measure

#

since not even all the vanilla timed actions have been converted

red tiger
#

I forsee actions giving me a lot of headaches in 42 mp.

lone gale
#

Ok thank you, when you say @bronze yoke has every java side change of functions etc where can I find that?
From the sounds of it I'll mostly just need to alter recipes and maybe pre-emptively move my timed actions to shared instead of client which shouldn't be too hard at least.

bronze yoke
#

only numbered commits are game updates, everything else is changes to our tools which can be ignored

lone gale
#

Thank you, that's very helpful!!

crystal canyon
#

There needs to be a psa announcement for modders to use proper casing in their mods. Just switched to linux again from windows and a lot of mods dont load/arent visible because Commnon =/= common

cinder storm
#

How do you attach a proper recipe name to a craftrecipe in b42?

#

I'd much rather it say, for example, "Make Regular Tire - Standard" or something similar.

thin swan
cinder storm
#

Thank you very much!

lone gale
#

I do not want to say how long I've just spent scratching my head wondering why my lua function wasn't being called from a recipe properly before realising OnCreate:function had been changed to OnCreate = function....

drifting ore
#

Ah wait. Alex got it.

crystal canyon
#

Is there a way to transfer a character from one map to another by copying the playerdb?

heady shoal
#

hey trying to update my map mod to b42, but having some troubles, now it is in a separate world from vanilla instead of merged into it, anyone knows why? thanks

orchid marten
#

yay my mod is somehow causing a memory leak because the game crashes before the main menu loads with an out of memory error !

orchid marten
#

okay apparently forgetting one } in your item script file will do that to you

mighty pelican
#

Anyone ever make a b41 mod that shows me what my host games are initialising so Ik if the folder is borked without wasting 30 min of my life?

bright fog
#

Tho tbh that's a game issue not properly handling casings imo

#

But this was an issue I had with 2 mods having Mod.info instead of mod.info when I switched to Linux earlier this year

hard wharf
craggy delta
#

do we have to declare new tags some where?
I am getting -> Tag has no items: ShredPaper

crystal canyon
crystal canyon
craggy delta
#

I did (but the IndexCard, should be the same thing though)

crystal canyon
#

mind if I take a look at your recipe and modified item script?

craggy delta
#
item IndexCard
{
    DisplayCategory = Junk,
    Weight = 0.1,
    Type = Literature,
    DisplayName = Index Card,
    Icon = IndexCard,
    CanBeWrite = true,
    PageToWrite = 1,
    WorldStaticModel = IndexCard,
    Tags = ShredPaper
}
    
craftRecipe ShredPaper
{
    timedAction = RipClothing,
    Time = 25,
    Tags = InHandCraft;CanBeDoneInDark;RemoveResultItems,
    OnCreate = Recipe.OnCreate.RipClothing,
    Tooltip = Tooltip_Recipe_ClothingNotWorn,
    inputs
    {
        item 1 tags[ShredPaper],
    }
    outputs
    {
        item 1 Base.PaperShreds,
    }
}```
crystal canyon
#

missing comma

#

after ShredPaper

craggy delta
#

you need a trailing comma anyway?

crystal canyon
#

yep

craggy delta
#

weird.. ok, let me try that

bright fog
#

Windows doesn't give a shit about caps

#

Linux does

#

So it's not a "windows handles it well" it's just "caps matters on Linux"

#

That's it

crystal canyon
#

yup, i guess the game could look for mod.info or Mod.info, etc but would have to account for all possible casing

bright fog
#

My guess would either be regex if it allows you to check for any case or handle everything low case in a way

crystal canyon
#

I asked gpt to make a quick and dirty script to at least let me load my save and let me play lol

craggy delta
crystal canyon
#

Thanks! just ran it lol

craggy delta
#

its there a way to randomize the amount of the result of a craftRecipe?

#

like I want to get between 5 - 8 of something..

bright fog
#

B41 or B42 ?

craggy delta
#

42 only

bright fog
#

B42 just saw your craft yea

#

So yea in the OnCreate function you can randomly add an amount of item

craggy delta
#

I should have been more specific.. I meant can you do it from the craftRecipe meaning without lua.. so, no I need the function.. I will add that later then.. thank you!

bright fog
#

To my knowledge that's not a feature at least

craggy delta
#

thats fine.. I am just working through all the declarations first, then I will add the lua

bright fog
#

Make sure to check the wiki page of craftRecipe if you haven't yet

brave light
#

So, item defs' Icon property will look in the "textures" folder for the name with a prefix of "item_". So Icon = charm will look for the file textures/item_charm.png. Now, I would love to have my icons in a different subfolder, textures/icons. How would I do this? Icon=icons/charm with the file textures/icons/item_charm.png?

bright fog
#

As for the subfolders, there's a secret tech

brave light
#

Oooh, I love secret tech! Well, I love knowing it, not so much that it exists undocumented. But you know what I mean 🙂

bright fog
#

It was @sour island that had shared it, but basically you can do

media/textures/item_icons/charm.png with your script entry for icon being Icon = icons/charm.png

#

If I'm not mistaken

brave light
#

I'll try that, it would save so much hassle if I don't have to have the item_ prefix on every one of them 🙂

#

Hmm... This didn't work. I'll try reverting the names, so it's icons/item_Charm.png and see if that works.

bright fog
#

hmm

brave light
#

Takes a hot minute for my game to restart, just going back to menu and restarting didn't work, so testing if a full restart of the game works better. Give it a moment 🙂

#

Yeah, no, this didn't work either... Guess I'll have to put the icons in the root. The textures folder worked fine for the textures though, using the same method, but those don't have that prefix so I don't know. Just me trying to be organized and fancy and stuff.

bright fog
#

Chuck might be able to give some insight into how he did it

#

I don't remember where he wrote that down

brave light
#

You know what did work though? media/textures/item_/icons/Charm.png with Icon = icons/charm. Though I think that icons/ would just be for my own organisation, because it will be the only subfolder of item_ in this particular one, considering I only got one type of item to put in there. I can see it being useful later, for things like item_/clothes or item_/bags.

bright fog
#

Ok I definitely don't remember it working like that, that's weird

brave light
#

B42 quirk? My crappy laptop quirk? I dunno, it worked, so I'm happy 🙂

bright fog
#

I would assume B42 quirk

brave light
#

Until next time I restart the game fully, and it is broken again, I guess. But we'll see when that happens. I'm still just learning how to mod PZ, trying to wrap my head around the quirks before I go on to my first actual project.

bright fog
#

Reloading Lua from the main menu does the job in most cases and you rarely need a proper game restart

brave light
brave light
#

Yeah, ignore that, it didn't work after restarting the game, so the textures must have been cached. textures/item_Charm.png it is then. Not a biggie, can still sort everything else in folders.

bright fog
#

You need to reload Lua when you do that to apply changes

#

This will reload most of the assets

#

most

brave light
#

Do they mean "reload assets" when they say "reload lua"? Because I haven't even touched lua yet, it's all models, textures and item definitions so far. So I just assumed "reloading lua" when hitting "continue" would do the same thing. This could save me so much time if it works!

bright fog
#

And Lua is one of them and this usually tends to reload assets too, it notably is used to reload every scripts too

drifting ore
#

I think possibly icons won’t get loaded until you fully restart the game though, if I’m remembering right

boreal ledge
#

To patch another mod, how can I make an overwriting change without actually just including her file?
Can I, e.g., make a new record of the same name in the same module in my file?

#

e.g they have in their .txt

module theirModule
{
  item rock 
  {
  weight = 1;
  }
}````

can i then in my own .txt do
```lua
module theirModule
{
  item rock 
  {
  weight = 2;
  }
}```
and have it be overwritten with 2 weight rather than this having defined a second rock item?

B41 for completeness
bright fog
#

Also no you can't do what you just wrote

boreal ledge
#

How should I?
I would much rather not include as much of their files as possible

bright fog
#

One method is that you can copy pasta the whole definition of their item in your own mod however this will be both incompatible with other mods patching AND any changes from the original mod in their own script won't transcribe to your own mod unless you copy pasta again their original changed script and do your own changes again

#

The real good method to do it, is to patch from the Lua

boreal ledge
#

You can change item/recipe definitions from lua?

bright fog
#

Yes

boreal ledge
#

interdasting and much better
is there documentation on this anywhere so I don't need to pester you for sage wisdom?

bright fog
#

The way you do it is by using a DoParam function on an Item class
For that you retrieve the Item definition with this function:
item = getItem(itemFullType)
And then
item:DoParam("weight = 2,")

#

Note that I do not know the whole thing perfectly and thus I might have made a mistake

#

As for recipes it's a similar method but with recipe definitions

boreal ledge
#

If I want to add or remove fields of a class, can I do this also?

#

like adding an AttachmentType to something that didn't have one

bright fog
#

I'm not familiar enough with the process

boreal ledge
#

Time to pore over the docs, i spose

bright fog
#

For Item

#

I need to document the process on the wiki at some point

boreal ledge
#

It's not immediately obvious that fields can be removed
That's alright, I didn't actually need to do that anyway

#

The other salient question about this is, when or how do I actually run lua scripts
is there boilerplate I need to run a script on load?

bright fog
#

You can learn more about it on the wiki page regarding Lua events

#

But in this case, you can run it directly without an event

boreal ledge
#

I didn't realize Lua even supported events
Do you mean things like OnCreate that run functions from recipes?

Also, thanks
I'll have to read that a bit later today

bright fog
#

They aren't classified as Lua events

#

But you could say they act the same because they will trigger a function when a specific action happens

brave light
#

I guess it is technically an action callback, but from a coder's standpoint they are pretty much the same and used the same way.

bright fog
bright fog
#

Basically

#

Tho when we refer to one we don't refer to the other usually

#

Bcs they aren't used and defined the same way

boreal ledge
#

Yeah this response sequence is basically my reasoning

lone gale
#

With the new recipe system, can you now give multiple (different) items directly via the outputs? Or do you still have to use an OnCreate and AddItem that way?

earnest grove
#

do you guys think its possible to create a mod wherein i can stop the player character from taking off their masks whenever they have to eat? basically just revert it to how it was in b41. Thanks!

silent zealot
#

There's a setting in masks that decides if a player can eat while wearing them or not.

earnest grove
#

where is this setting

bright fog
#

They mean a parameter probably

#

In their script

silent zealot
#

You just use a bit of lua to loop through items and set it to the value that lets you eat

lone gale
#

Nice, that's very handy.

silent zealot
#

I don't have my reference environment up to check quickly but look at vanilla masks

earnest grove
#

Ok please walk me through like, the basics, where can i get the lua script for the masks so i can edit it

silent zealot
#

Look at similar mods that adjust a specific property of existing items, like the one that makes jewelry weightless.

red tiger
silent zealot
#

The high level logic is

##### NOT ACTUAL CODE #####
for each item in item database
{
  if item matches conditions for me wanting to change it
  {
    item:DoParam(property=newvalue)
  }
}
##### NOT ACTUAL CODE #####
red tiger
#

Random thought in the dark.

bright fog
silent zealot
#

makes it easier to show how things are nested

bright fog
silent zealot
#

just a sec...

bright fog
#

That might something I will do in the future yes

silent zealot
#

there.

bright fog
#

Fine 💀

bronze yoke
bright fog
bronze yoke
#

loading a game only reloads lua if your mod list is different, leaving a game always reloads lua

bright fog
#

It never takes ages to exist a game, not as long as it takes to load Lua when launching the game or reloading Lua via the menu button or mod list changes

#

So I'm having a hard time believing that

bronze yoke
#

i literally just went in-game to verify i wasn't wrong

#

so idk about your weird loading stuff because it does reload lua lol

silent zealot
#

It doesn't reload lua for me, but I always make sure the modes selected in the game & the mods selected in the the save match so I don;t have to wait through reloading.

bronze yoke
#

the implication here is that you can play on multiple different saves without reloading lua once

#

i'm not sure what to say because it does reload lua for me, and always has

silent zealot
#

Yes, you can, provided every save has the same modlist and the game's modlist also matches.

#

Well, I can.

#

laughs

bright fog
#

I'm testing it out because from what it did when I played with lots of mod it never felt like a Lua reload due to the speed of existing a save never taking as long as took to load every mods

bronze yoke
#

lua reload has never taken very long for me

bright fog
#

No of course, not if you play with very few mods

#

But when you play with a fuck ton of mods, it does

#

And you do notice it

silent zealot
#

I use a mod managing mod so it's easy to get thing 100% matching (update modlist from save/update save from active list)

#

You mean like a low-mod run with only the 120 most essential mods?

#

😂

bright fog
#

That's not a lot compared to the amount I'm talking about, dw 😅

bronze yoke
#

most of the time i'm paying attention i probably have 1 or 2 enabled 😅

silent zealot
#

For testing someting I'm writing 1 or 2, for playing... a lot more

bright fog
#

Ok so it does reload when existing

#

Does it reload everything like a classic Lua reload ?

bronze yoke
silent zealot
#

hahahaha

#

not since 42.8

#

Also Rimworld came out with an update so I'm distracted

bright fog
bronze yoke
#

i'm still chewing through abiotic factor 1.0, no time for zomboid really

bright fog
#

Only a few mods enabled for debugging and my own mod I'm working on

bright fog
silent zealot
#

Damn it's nice to have everything in XML and C#

bright fog
silent zealot
#

Try fishing they said. Nice and relaxing.

#

Well this is what happened when I took my boat to the river!

bright fog
#

lol that's cool

silent zealot
#

Odyssey expansion is really good. Being able to fly away from your troubles... provided you can keep your gravship operational.

bright fog
#

I missed the 3 last DLC since I had last played the game so that's probably not going to be my first DLC to try as I'm not too interested in it

silent zealot
#

Biotech is very much worth picking up, both for what it gives directly and for the huge scope it opens up for mods

bright fog
#

Yea that's the one I went with

#

Definitely feels like an extension of Ideology

#

With the huge customization it provides

silent zealot
#

Royalty is a bit meh, Ideology is nice but not essential, Biotech is the best by far, Anomly is really good if you want creepy horror stuff but otherwise ignorable, Odyysesy is great

#

Or to use the names they should have:
Rimworld
Ideology
Mechinators++
Weird Shit
Odyssey

bright fog
#

The psycast from Royalty is the only interesting thing imo

#

Anomaly I'm interested in testing it yea

#

Love some creepy shit

silent zealot
#

Vanilla Faction Expanded: Empire and Vanilla Faction Expanded: Deserters adds a lot to the Royalty

bright fog
#

It'll be my next one, I only miss it and Odyssey rn

silent zealot
#

VAnilal Psycasts Expanded adds a huge amount but gets very overpowered very quick.

bright fog
#

Yea I'll add the VFE mods in once I've dug a bit in Biotech

silent zealot
#

(Says the person currently testing out a superhero gene mod)

bright fog
silent zealot
#

Yes, lots of different psycast trees and a lot of prerequisates to be able to start

#

Not all balanced againast each other, but all fun in some way

bright fog
#

It looks more interesting than the way Psycasts work rn

silent zealot
#

Ironically you can do more with Zombies than you can in Zomboid 😂

bright fog
#

Yea the necro shit from Anomaly looks cool !

silent zealot
#

Ghouls are really good defence becuase you can just stick them back together after they get "killed"

#

But... don't run out of raw meat.

bright fog
#

Yea I was watching Hazzor's videos and saw his video on Ghouls

silent zealot
#

Any entry chamber full of corpses and a deadlife IED that ressurects everything around it when triggered will kill your FPS and any hostiles...

bright fog
#

There's IEDs that resurect shit ? 😭

silent zealot
#

hell yeah.

bright fog
#

That's cool

silent zealot
#

Collect the toughest corpses your can find

bright fog
#

I need to fuck with the mechanoid shit from Biotech rn, I've yet to touch that

silent zealot
#

Junker pirates doen't look so tough when they are facing down a bunch of undread rhonos. bears and thrumbo

#

I've done full-mechinator playthroughs, what I do now is only use the simple small mechs (cleaner, hauler, crafter, paramedic)

bright fog
#

Also I noticed there seems to be a lot of tribal factions now with Biotech and heard a ytber mention it in a video too. Is that a thing and if so how to modify it to not have that many tribal factions ? Tho I'll possibly try a medieval playthrough next save

silent zealot
#

It was fun having a mechanoid army though

bright fog
silent zealot
#

When you start a new world you can choose which factions will be there.

bright fog
#

Ah yea

#

True

silent zealot
#

Get rid of the boring ones. And hostile impid tribe can get @#$%@#%ed.

bright fog
#

lol

silent zealot
#

I like variety. 🤣

bright fog
#

oof

#

Wouldn't that cause problems ?

silent zealot
#

No, Rimworld mods tend to play nicely with each other.

bright fog
#

Also what's the best bionic mod rn in your opinion ? I remember Rah's Bionics from back then but is that still the goated bionic mod ?

silent zealot
#

And nearly all of those are from Vanilla Expaned or Big and Small, which adds a lot of fantasy stuff

#

EPOE, Expanded Prosthetics and Organ Engineering

bright fog
silent zealot
#

Gives a nice progression for crafting bionics, adds more stuff that fits in with teh vanilla powerlevel.

bright fog
#

But overall how relations with factions happen, since you get so many different factions, to have more interactions with the same factions

bright fog
silent zealot
#

Well, as Supremacist Raiders people mostly hate me anyway

bright fog
#

lol

silent zealot
#

but that just means more people to raid

bright fog
#

Are manual mod order stuff still needed now ?

silent zealot
#

On my "what if instead of a nice Kansas family Superman was adopted by a bunch of meth-head pirates?" playthrough.

silent zealot
#

RimPy. It's a little python utility that will handle that. The in-game sort works too, since every mod will have requires/load before/load after rules.

bright fog
#

Yea I think I remember RimPy, it's an app with an interface right ?

silent zealot
#

There's a Rimpy mod, but that is just the way they keep the rimpy database updated .... it has extra sorting rules based on what peopel have determiend workes best

bright fog
#

Yea that

#

I remember that one

silent zealot
#

choose mods, sort, save, done.

bright fog
#

Tho the in-game mod order works ?

silent zealot
#

Yes, I've not had issues with it. it's nice to be able to adjust mods without having to strat the game (loading all the mods) only to have to then restart after changing.

bright fog
silent zealot
#

1.6 has some nice performance boosts, but the "cache processed xml database" thing is only a speedup if nothing has changed.

bright fog
#

Also I love these new storage, comes and compliment Neat Storage very well

#

I'm happy to see all the stuff from back then in like 1.2 or so being in updated forms

#

Also there's that VFE mod that adds Oil refining but that was another mod right ?

#

I forgot its name, I loved that mod back then

silent zealot
#

Two main oil mods: Vanilla Chemfuel expanded and Rimfeller.

bright fog
#

Rimfeller yea

#

That was the only one back then

silent zealot
#

VE: Chemfuel is simple and vanilla like, rimfeller is good if you want to feel more industrial

#

And rimfeller mod author also made rimatomics, which is a very good nuclear reactor mod

bright fog
#

Yea I remember that a bit but I didn't use it too much I believe

silent zealot
#

instead of just "build a nuclear reactor" you will have a reactor, cooling systems, mange loading in uranium rods, etc etc.

#

and it has a lot of crazy weapon turrets to use all teh power

bright fog
#

Ok so I thought that that new VCE mod was basically Rimefeller but introduced as a VFE way

silent zealot
#

chemfuel expanded you get "deepchem" similar to deepdrilling, then refine that into chemfuel

#

works with their pipe networks.

bright fog
#

Bcs VCE looked almost exactly like Rimefeller in how it works 😅

silent zealot
bright fog
terse delta
#

Tynon is insane for this

#

I heard he invented MULTITHREADING and SMART TICKING

#

That's crazy, how he came up to these technologies?

#

I'm not as glad as I would be tbh since this broke a lot of mods

#

Tynon never leaves modmakers without work drunk

#

Just as cough cough someone

sour island
#

He invented multi threading?

bright fog
red tiger
#

Yeah. You'd implement not invent

late ingot
#

How do you go about having dependencies for a mod? Like I know my mod will require another mod but I'm not sure what that looks like

bronze yoke
#

the dependency on the steam workshop is added separately through the mod's page after you upload it

late ingot
#

If you are modifying another mod's lua, do you just name it the same in your mod then it overrides via loadorder?

#

(My brain might be inventing complications where there are none)

bronze yoke
#

yes, although we usually discourage total file overrides if it can be avoided

late ingot
#

I'm very new to the more code based lua/java mods, how would I go about modifying just part of an if statement to add an additional (not self.character:HasTrait("EasyGo"))

#

(I'm wanting to make a mod for mp for servers that use skill recovery journal for people who want vanilla stakes but don't want to shoot themselves in the foot)

bronze yoke
#

from a different file, you can override one single function (assuming that function is accessible from the outside), which is much more future proof than overriding a full file

late ingot
#

Perfect!

#

How

bronze yoke
#

if the function is global, it's as easy as just defining your version of the function with the same name

late ingot
#

Its local

bronze yoke
#

then you might be unable to do this 😅

#

file overrides are regrettably necessary in some cases

tranquil reef
#

Is it better to just edit mods directly in the workshop folder, or should I continue to do what I usually do where I copy paste the files from mods to the one in the workshop folder

#

Just dawned on me that there's probably no actual reason not to

silent zealot
silent zealot
silent zealot
# late ingot Even if it's a local function?

Same as vanilla... meaning you can't patch a local function. You might be able to patch the function that calls the local function. Or ask the mod author to make an adjustment so it's non-local and can be patched.

tranquil reef
silent zealot
#

I find git is a huge help - checkin when things are working and never have the frustration of HOW DID I BREAK THIS IT WAS WORKING 30 MINUTES AGO!

tranquil reef
#

I also use git control on the mod version but not workshop. Having it for the entire thing would be nice

silent zealot
#

I use git at the mod level, not the workshop folder level, but that's just becaus eI start in /Mods instead of /Worskip/Cntent/mods.

tranquil reef
#

Like giving a Neanderthal a pickaxe

late ingot
#

Anyone know a good link for learning how to modify vanilla lua script, without just duplicating the base file?

#

All my mods so far have been txt scripts.

#

I think it might not actually be a local function?

brave light
#

So, a question that just popped into my head and I did zero research on as a brand new PZ modder... Does the game allow more than just texture maps for our models? Like, could we put in roughness or alpha maps too? I'm assuming it is just the texture map... Not important at all, models are way too tiny to see things like roughness on, and that can be painted onto the texture already, just interested to see how far I can take stuff 🙂

tranquil kindle
#

I do use substance painter and it allows me to draw heights, adjust roughness/metaic and such and i do all my textures like that, and at the end i simply export 2d view

bright fog
#

But it is a bit buggy, other models tend to not render behind transparency, like beards behind a visor

tranquil kindle
#

Oh yeah, forgot about alpha

tranquil kindle
#

But apart from Alpha, yeah... only texture

bright fog
#

Yup

#

And a single texture too

#

For a model

tranquil kindle
#

Vehicles have some kind of shaders, but my knowledge about it is limited

bright fog
#

Yea

brave light
#

Yeah, but that's always been a thing with Alpha. Was the same back in Second Life, when people still used alpha maps there. The alpha is applied to the whole model, and when you attach several models together, they count as one, so you can still see the chair behind the character, but there would be a hole straight through if it was a bodypart. Or you'd see the character's chest if the jacket was done as a solid object with an alpha for the open zipper, even if you wore a shirt.

#

So don't use alpha to avoid having to do actual modelling 🙂

#

I'm not sure what I would've used it for yet, but I was thinking stuff like light maps for static objects. But that wouldn't matter, because I can just set up a light rig in Blender and bake the light data onto the actual texture, so not sure why my mind even went there.

bronze yoke
#

you are limited to just one texture, you can use custom shaders for most things but it's fairly limited what you can actually do with them since you can't pass in extra textures

#

jab made some headway with passing in custom uniforms by abusing reflection but i don't think there's much you can do with them still, especially not in a practical manner

bright fog
bright fog
#

<@&671452400221159444>

amber crown
amber crown
#

explaining the "license"

#

and its just gray

bright fog
#

Where ?

#

You're supposed to add it to the Steam page description

bronze yoke
#

it's a little weird there's no description, but, free for all literally means free for all

#

you reserve no rights and anyone can do anything whatsoever with your mod

bright fog
#

Ah yea I see

amber crown
#

With the html

bright fog
#

That's not html

amber crown
#

I know

#

But

bright fog
#

But yes I see what you mean

#

That's what Albion said

amber crown
#

Ok

bright fog
#

It's self explanatory

#

"free for all", anyone can use it

amber crown
#

just making sure

#

Better safe than sorry

bright fog
#

True

terse delta
#

Having game like this on one thread is absolutely terrible.

heavy swift
#

games saying im missing a mod.info file when its right here???

bright fog
#

Recheck your mod structure

#

You're missing a folder

dense goblet
#

Any code example for being able to "spawn a dead body" that can be picked up by a player (B41)? I currently have code that waits for a specific square to be loaded and then I've tried all assortments of AddZombieInOutfit()->kill()->IsoDeadBody.new() or createRandomDeadBody(), .. I get a dead body just the way I want, I can loot it, but I can never seem to get the new body to be able to be picked up (Grab Corpse), until i log out and back in (to the dedicated server).

bright fog
#

In the spore zone mod

dense goblet
# bright fog In the spore zone mod

Copied code same issue. It looks like the same code in the "Trash and Corpses" mod which someone has commented doesn't work in MP. It's weird because the dead body sprite can sometimes be in front of the player.
(logging out and back it, and everything works correctly)

bright fog
#

Unless that wasn't what you meant ?

dense goblet
#

yes sir! Multiplayer weirdness

manic canyon
#

Hello survivors! I want to further customize a wilderness world, I havent made mods before but i have basic knowledge in coding, how doable is to make a mode (or use an existing mod?) to essentially randomly spawn various animals around the map?

rich hearth
#

hello

#

i got a question

#

why did you guys not make a mod that grabs the 2d mini map and makes it into a raycasting system

#

so you can see in first person

bronze yoke
#

because it's not nearly that simple

rich hearth
#

yea but its still possible

#

i'll try to make it but idk how to script so i got learn

#

the hard way

#

prob i will give up

#

in a few days

manic canyon
#

is there a mod that already allows customizing the start fo the run? maybe it can allow me to spawn animals like that at the start of the run instead of having to debug mode it

bright fog
#

Not to my knowledge at least

floral tangle
#

its quite confusing to make a character from a video game model

#

can someone guide me?

#

i have little idea of what i am doing

#

texture work was never in my field of knowledge

#

i am trying to create a mod of replacing pz character with this

#

but i am not sure where to start, i looked up other mods from modders and i barely understand anything

bright fog
bright fog
#

Is that what you are using ?

#

I'm rewriting a wiki page a bit and realized I had given this as an example for constructors, which is exactly what you were looking for

dense goblet
# bright fog ```lua -- create the IsoZombie instance local isoZombie = IsoZombie.new(getCell(...

That usually ends up with two corpses. This one of the "working" sets of code I have (in which it spawns, is visible, is lootable, but i can't pickup the corpse until I log out and back in). Probably a lot of overkill stuff, mostly trying to get it to sync the corpse.

    --Create a new zombie
    -- local zombies =  addZombiesInOutfit(x, y, z, 1, "Default", 50, false, false, false, false, 50)
    -- local zombie = zombies:get(0)
    -- if not zombie then
    --     print("Failed to spawn zombie.")
    --     return false
    -- end

    -- zombie:setHealth(0.0) -- Kill the zombie immediately
    -- zombie:Kill(nil)
    -- print("[RFTCQ] Zombie killed at " .. x .. "," .. y .. "," .. z)

    -- local body = IsoDeadBody.new(zombie, false)
    -- body:setNoPicking(false)
    -- body:getContainer():setExplored(true)

    -- print("[RFTCQ] Body created at " .. x .. "," .. y .. "," .. z)
    -- zombie:removeFromWorld()
    -- zombie:removeFromSquare()
    -- getCell():getZombieList():remove(zombie)

    -- body:transmitModData()
    -- body:transmitUpdatedSpriteToClients()
    -- body:transmitCompleteItemToClients()

    -- sq:RecalcAllWithNeighbours(true)
    -- sq:DirtySlice()
    -- sq:transmitModdata()
bright fog
#

Hmm

dense goblet
#

It seems that IsoDeadBody.new(zombie, false) puts a dead body where the zombie location was. Thus I remove the zombie. (zombie:Kill(nil) simply shows splattered blood)

bright fog
#

The zombie doesn't spawn when you instanciate a zombie that way

#

That's what I explain in the wiki section where I found this code

#

Something very important to take note of is that this will not create an actual zombie, but simply an instance of IsoZombie which can be used for different operations which require an IsoZombie instance. This is the usual usage of the constructor, and creating entities is mostly done with different kinds of methods.

#

It shouldn't spawn a zombie

dense goblet
#

Maybe that's the secret sauce, ill try it now

bright fog
#

The zombie became a corpse with the IsoDeadBody.new

#

So if you kill it, you end up with two corpses

#

And since the instance still technically exists (see IsoZombie wiki page and the recycling explanation) well you can technically still access a zombie there

dense goblet
#
    local zombies =  addZombiesInOutfit(x, y, z, 1, "Default", 50, false, false, false, false, 50)
    local zombie = zombies:get(0)
    if not zombie then
        print("Failed to spawn zombie.")
        return false
    end
    local body = IsoDeadBody.new(zombie, false)  -- no dead body until logout and back in
 
    sq:addCorpse(body, false) -- if this line is added, same issue as above.
    
#
    local zombies =  addZombiesInOutfit(x, y, z, 1, "Default", 50, false, false, false, false, 50)
    local zombie = zombies:get(0)
    if not zombie then
        print("Failed to spawn zombie.")
        return false
    end
    local body = IsoDeadBody.new(zombie, false)
    body:transmitModData()
    body:transmitUpdatedSpriteToClients()
    body:transmitCompleteItemToClients() -- corpse is visible, loot-able, but cannot be picked up
bright fog
#

That's not the code I sent you

#

That's completely different

#

Here you spawn an instance of IsoZombie on the map

#

The method I send does not spawn the zombie

#

It only gives you an instance of IsoZombie to do anything you want with then

dense goblet
#

Oh.. so then i have to fill out the worn and inventory items

bright fog
#

No you can dress the instance before adding it the corpse

#

And add any visuals you want to it like any other zombies

#

But the zombie does not exist on the map, that's the difference

bright fog
#

Don't change anything, don't do anything silly

#

Just those two lines for now

#

You're doing your tests in MP or solo rn ?

dense goblet
#

MP, I had to chnange the second line to isoZombie since the first line references the variable isoZombie not zombie only thing I changed...

bright fog
#

Oh yea nice catch, that's a mistake on my end

dense goblet
#

no worries at all!! I'm just super happy to get some help man, thank you soo sooo much

bright fog
#

Yea reason is because those were two separated snippets

#

Fixed it in the wiki anyway thx

dense goblet
#

No corpse appeared on the ground when the code ran, logged out and back in, no corpse as well.

    local isoZombie = IsoZombie.new(getCell())
    sq:addCorpse(IsoDeadBody.new(isoZombie), false)
bright fog
#

Can you try in solo ?

dense goblet
#

oh wait what is getCell() ?

#

oh I see

bright fog
#

Retrieves the player loaded area

dense goblet
#

oh this is code on the lua/server

bright fog
#

Hmm

#

You might still be able to do that tho

#

I'm unsure

bright fog
#

Can an IsoCell be retrieved server side to run this for any squares ?

#

Actually maybe there's other methods to instantiate a zombie here without creating one on the map still

dense goblet
#

can do:

   local isoZombie = IsoZombie.new(sq:getCell())
bright fog
#

True

dense goblet
#

Didn't help, no corpse on join->tick, no corpse on logout/login

bright fog
#

Hmm

dense goblet
#

weird, I have spawning items (at the right height), spawning containers (boxes) and adding items, spawning cars, with keys.. all working but a week working on trying to spawn a doctpr corpse with a journal on him hahah

bright fog
#

Yea it's because corpses aren't really items and aren't exactly entities either

dense goblet
#

right.. it's just funny how easy the other stuff has been comparitively

dense goblet
#

You know I SWEAR I tried this and it didn't work...

local body = createRandomDeadBody(sq, 0)

Darn.. yeah I had to log out and back in to see it

true nova
#

dead bodies are jank

#

i was having these issues when trying to move them around for elevators

ancient grail
#

what i did before was sorta hacky
i transfered the corpse to the players inventory and the back on the ground
that refreshed the data for some reason

i did that in an instant and not by using timed action

true nova
#

interesting. maybe make a container on its square and take it in and out?

#

my mod is all ran in OnTick. I think that is possible, ill have to revisit

dense goblet
#

Shouldn't be hard to remove / readd the deadbody to the square.. I'll try real quick

dense goblet
ancient grail
#

additem i guess

radiant tundra
#

is it possible to create a ledge hang mod? a context option on open windows to hang using the Bob_ClimbWindowGrab with either infinite or finite grip (strength related) parametrized, option to let go or pull up Bob_ClimbWindowGrabIn. I tried with AI and got stuck xd

dense goblet
true nova
bright fog
#

triggerEvent("OnContainerUpdate")

#

When the corpse appears

dense goblet
#
triggerEvent("OnContainerUpdate")
// or
triggerEvent("OnContainerUpdate", sq)
// or ?
sturdy salmon
#
local function OnContainerUpdate(object)
    -- your code here
end

Events.OnContainerUpdate.Add(OnContainerUpdate)
dense goblet
#

I'm extremely new to lua/zomboid (25 years programming). Are you referring to telling the client that it's inventory has been updated?

sturdy salmon
#

Fires when a container is added or removed from the world.

#

Zombie bodies, upon death, become item containers.

#

What you want to do with them, I have no idea. If you want to give me some context, you can write me privately.

#

TriggerEvents are basically like hooks in C++. If they're invoked, they fire; if not, the game continues running in vanilla mode.
They're used within mods to modify the game's basic behavior.

bright fog
#

Yea

#

Second one

#

I think ?

#

Tho can't be the square I think

#

Probably needs to pass the world inventory of the square

sturdy salmon
#

Depending on which area of the code is being referenced, it seems to check for a parameter, but not always. In most databases, it seems to run without parameters.

dense goblet
#

look like it does for IsoDeadBody?

bright fog
#

Hmm

bright fog
dense goblet
#
    local body = createRandomDeadBody(sq, 0)
    triggerEvent("OnContainerUpdate")
``` ?
bright fog
#

Yea just try that

#

Wait

#

It's client only

#

That won't do anything server side

sturdy salmon
#

I now understand what he wants to do, because he explained it to me privately. I told him, just in case, to exit the chunk and return to it again. From what he told me, it resolves itself when he closes the game/server. So, it's obviously a status issue when defining the container.

#

We need to search for what triggers the "grab zombie" context menu. By finding that, we'll be able to determine what state the body needs to be defined. When the corpse dies and spawns naturally, the game must be defining a boolean or something, which we don't, and therefore, we can't grab the body. When you exit the chunk or close the game, the map must detect the body and add that flag.

sturdy salmon
#

In single player, at least, when creating the body, you can grab it. Perhaps in multiplayer, it requires some extra changes.

floral tangle
#

i get that you meant to replace the character bones with default pz character rig

bright fog
#

I just know that you'll have to do that at some point

floral tangle
#

yalla i am cooked

bright fog
#

#modeling will probably better regarding that too

floral tangle
#

i have been trying to finish this since yesterday

floral tangle
queen oasis
#

is there anything inherently bad about setting mod data on an item? like "Bag_ShotgunDblSawnoffBag"

#

I vaguely remember reading somewhere that you shouldn't do that, but I can't find that info

bright fog
#

Probably

#

But no it's not a bad thing

#

It's just a bad thing to have custom parameters that will add mod data to every single item instance

#

Even when not needed

queen oasis
#

cool. someone is trying to use my capacity mod for "upgraded" bags and of course setType doesn't stick between loads. I'm trying to help figure out a workaround for it

bright fog
#

uh

queen oasis
#

that's what I said too

bright fog
#

Tell them to come here and ask about it

queen oasis
#

that sounds like a threat 🙂 ha

bright fog
#

lol no that's not what I meant 😂

bronze yoke
#

basically, items can be given default mod data in their script, but it is wasteful to do that for values that don't change (because mod data is per item instance, it will bloat the save file with identical data)

#

so the only real use is a default value that is expected to change

#

it sounds like they wouldn't be using script mod data so it should be fine, mod data itself is fine

fleet bridge
#

You can make it stick via setters if you're changing carry weight or reduction

queen oasis
#

my thought was to setType on the bag, like "Bag_ShotgunDblSawnoffBagUpgrade1", since my mod uses a lookup table for type. but I guess the type doesn't stick between loads. I'll ask them to hop in here

fleet bridge
#

I've never gotten settype to persist

bronze yoke
#

i would not mess with the type, that's a disaster waiting to happen

queen oasis
#

I don't think I did either. I remember messing with the player inventory type and I had to set it every load

bronze yoke
#

it would be ideal if your mod supported overriding capacity per-instance in some way, possibly through mod data on the item

queen oasis
#

my ideas are usually disasters waiting to happen

#

that was my 2nd thought, mod data if it's upgraded, check on load and set capacity then

bronze yoke
#

e.g.```lua
local capacity = item:getModData()["JB_CapacityOverride"]
if not capacity then
-- capacity = whatever you normally do
end

queen oasis
#

my problem is - my mod depends on checking types to set capacity

queen oasis
fleet bridge
#

if your backpack has context menu wear options, it will nuke all the mod data on switch

queen oasis
fleet bridge
#

Trying to think of a mod that has it, I think kattaj military backpack?

queen oasis
fleet bridge
#

maybe, but each mod has its own specific function so you'd have to make a compatibility for every one

#

and im not sure the result item gets passed down either

queen oasis
#

after I ate some lunch, I thought it might be more feasible to just change to a new item after an "upgrade"

tribal lake
#

I never modded before. I want to start. I want to ignore modeling, and focus on game mechanics for now. Is there a guide, step-by-step, or hands-on tutorial that will expose me to how experienced modders do the run-change-break-fix loop?

bright fog
#

I invite you to check the pinned messages

#

You will find a message from me which details a bunch of resources you can find in the wiki to get started

queen oasis
fleet bridge
#

Like there are bags that are "lite" version

#

That has different slot options etc.?

queen oasis
#

I don't think they're looking at creating a new item. I guess it wouldn't be a big deal to copy the mod data over if they were. Sounds more reliable than changing type or overwriting the capacity for every bag of that type
Equip just calls ISWearClothing, which is where I tested for persistence. I'll just toss in some checks for mod data in my code and see what happens.

#

oof, and then I look at my code and that's easier said then done

queen oasis
#

that was quick

#

gone before I could call the fbi

queen oasis
#

that was easier than I thought it would be except for ItemContainer:getContainingItem() took me awhile to find

local modData = container:getModData()["JB_MaxCapacityOverride"]
local containerCapacity = (modData and modData.capacity) or overrideData.capacity
#

upload and steam immediately goes down

shy mantle
#

exactly on the hour is very unfortunate

queen oasis
#

so I guess fridges and counters can't have mod data. real fun finding that bug after uploading to the workshop. or more likely I'm just checking in my usual heavy handed way and breaking stuff

ancient grail
bronze yoke
#

he does nil check it before trying to access it though

ancient grail
bright fog
cold skiff
#

Can someone help me? I'm going crazy. I have a finished addon, but the object distribution in the world isn't working. It's a hydration pack:
-- Police Lockers
table.insert(ProceduralDistributions.list["PoliceLockers"].items, "LB.Bag_new")
table.insert(ProceduralDistributions.list["PoliceLockers"].items, 500)
Even setting a value of 500 doesn't show up, so I'm guessing it's something new for hydration packs. Can someone enlighten me?

bright fog
cold skiff
#

excuseme i don't see lootzed in debug menu where is it?

#

Sorry, I found it in the cheat menu.

cold skiff
#

Thank you, this tool is very useful for calculating weights correctly. Thank you very much.

bright fog
#

Bcs there's a lot more parameters

#

This is only an estimation I believe

silent zealot
#

Also worth noting: LootZed gives information based on the lua loot table, the actual loot generation is handled by a copy of the table in the Java. Normally they will be the same if you update the loot table when your lua file is loaded, but if you do this later for some reason you need to call ItemPickerJava:Parse() to update the java loot table.

small topaz
#

Hi! In a clothing item's xml file, is the ordering of the entries relevant? For example, here is the xml

<clothingItem>
    <m_MaleModel></m_MaleModel>
    <m_FemaleModel></m_FemaleModel>
    <m_GUID>86ffb73b-9b5b-4ffa-a46f-49846b1e9731</m_GUID>
    <m_Static>false</m_Static>
    <m_AllowRandomTint>false</m_AllowRandomTint>
    <m_AttachBone></m_AttachBone>
    <m_BaseTextures>clothes\boliersuit\longjohns</m_BaseTextures>
</clothingItem>```

Would it be save to exchange the position of the "m_GUID" and "m_FemaleModel" entries?
queen oasis
ancient grail
bronze yoke
#

for array members the order will affect the order they are placed into the array, but that generally shouldn't matter

#

for all other members the position doesn't matter whatsoever

queen oasis
#

I can't find a good way to get the object from an ItemContainer

bright fog
#

The item ?

bronze yoke
#

container:getParent()

#

container:getContainingItem() if it is a container item

queen oasis
queen oasis
bronze yoke
bright fog
queen oasis
#

I'll give getParent a try again. it was late. I'm trying to avoid anything too heavy since these functions get called almost every tick when you're near any container

bright fog
#

What are you doing exactly ?

queen oasis
#

adding a "per container" capacity override using mod data to the max capacity override. Say you want all Bag_BreakdownBag's to have a capacity of 75, but you can somehow upgrade that to 100. Just set the mod data on that container to 100, the other Bag_BreakdownBag's will still be 75.

#

instead of having to spawn a new container, or change the type, or change all the containers

bright fog
#

Aaah yes I see, but why run it every tick ?

queen oasis
#

that's how often the game calls these functions

#

overwriting the java with some sweet lua

bright fog
#

Which functions ?

#

That still doesn't explain why in your application here, you need to check every tick

#

You could simply update the container once and done ?

queen oasis
#

the container is updated only once but the game looks for capacity almost every tick so I need to give it the "modded" capacity

#

it's part of ItemContainer.getCapacity and ItemContainer.getEffectiveCapacity

#

and VehiclePart.getContainerCapacity

#

I got it working for ItemContainers that are also InventoryContainers, like duffel bags, etc. just having trouble with ItemContainers like counters and fridges, etc

#

so yea, getParent() works, it gave me the object and I can check for mod data on that object. thanks!

#

it works, nice