#mod_development

1 messages ยท Page 297 of 1

copper abyss
silent zealot
#

And the recipe parser is a piece of junk.

round thorn
#

they should be in the 41 folder now, try not to rely on the common folder.

bronze yoke
#

if they're in the b42 version

hot plinth
#

Can anyone do me a favor and open up items_smoking.txt and tell me what the custom eat sound was for them, i managed to accidentally replace the lines with empty "CustomEatSound = ," and save while trying to steal definitions xD

copper abyss
hot plinth
#

media\scripts\items\

dull moss
hot plinth
#

Oh they are just empty? could have sworn they had something there. Oh well thank you.

dull moss
primal tundra
#

When i add and equip a ALICE Belt Suspension to the player on spawn the UI and the logic for extra slots dont triggers.
I use this code to add and equip it:

player:setWornItem("Webbing", aliceBeltBag)```
There must be a function to trigger the update but i am clueless where to search.
umbral raptor
#

No need for a hole lol. I meant to drink water.

#

Like if you have a hand drill in you hand use it to breach the ice and fish or drink water

#

but yeah, its likely to cause performance issues unless its limited to areas around the player

#

no need to render the entire map's water into ice

#

just the few chunks the player is in

silent zealot
#

Even limited to areas around the player, you need to check every cell as you load to see if there are water/ice tiles that need updating.

umbral raptor
#

maybe make it update every long time

#

no need to have it melt the instant it becomes -4.9 c

#

like every 12 hours ig or something

silent zealot
#

Wont' matter.

#

IT's summer, I explore.

#

I's winter, now I explore

#

you reload the chunk I went to previously

#

the water is all water, but choudl be ice

umbral raptor
#

i mean doesn't snow literally cover the entire map? causing a change in texture and checks happen

#

its not that far off from how from snow works

silent zealot
#

That's why I suggested seeing if you can update the water tiles "live" instead of swapping them.

#

But you might find you can't change the "can be walked on" propelrty without reloading the game, or some other such thing

#

Give it a go, it's a good idea.

umbral raptor
#

ill check it out later

#

but its prolly too much work and debugging

silent zealot
#

You can make water possible to move over, there's swimming in.. um.. Aquatsar? for B41.

#

but that's a "all the water, all the time" thing that does not change.

hidden jungle
#

hey, so i'm trying to update my mod to b42 and my xp modifier code is broken.
its too big to paste here, but i'm doing this;

function XPMult(Player, Perk, Amount)
local Modifier = 1
--Change Modifier based on conditions and what perk is getting xp
Player:getXp():AddXP(Perk, Amount*(Modifier-1),false,false,false)
end
Events.AddXP.Add(XPMult)

this worked in b41, now it seems to instantly max out whatever perk it triggers on.
what changed about the xp functions?

#

okay i think i already figured out whats going on. it looks like AddXP() is calling back to the event. the 3rd arg used to be a callback boolean that would disable that. need to go find the xp code again..

bronze yoke
#

looks like they disabled that feature in 42

#

the third argument just does nothing now

hidden jungle
#

where are you seeing that? i cant find it

#

@bronze yoke

bronze yoke
#

i just looked through my decompile

hidden jungle
#

were you able to just search it? because thats something ive been trying to do for a while

bronze yoke
#

yeah, i have it open in my ide

hidden jungle
#

i fixed the instant max xp issue, for anyone finding this later.
The issue is that the AddXP() function calls back to the AddXp event with the amount of xp it gives. so it creates an infinite loop of giving the player xp.
you have to add a manual debounce to the function now since you can't prevent the callback anymore in b42;

Debounce = false
function XPMult(Player, Perk, Amount)
  if Debounce then return end -- if Debounce is true we "reject" the entire event call.

  local Modifier = 1
  if Perk == Perks.Strength then
    --Change Modifier based on conditions and/or what perk is getting xp
  end

  Debounce = true
  Player:getXp():AddXP(Perk, Amount*(Modifier-1),false,false,false) -- Debounce being true while this line runs means that when it calls back to the AddXP event, the debounce will stop it from running again.
  Debounce = false -- can immediately set it back so the next xp instance doesnt get rejected.
end
Events.AddXP.Add(XPMult)
#

Unfortunately this means that multiple mods trying to modifiy the same xp gain will now be forced to interact with each other, this can cause some wierd effects like 2 different 50% xp bonuses giving you 150% more xp instead of 100 or 112.5.
this is because both mods see the initial amount and then both mods see eachothers bonus xp call. this scales exponentially with the number of mods looking at the xp

you gain 10 xp
mod A sees 10, gives 5, then B sees the 5 and gives 2.5
then B sees the 10 and gives 5, and A sees that 5 and gives 2.5
totalling 5+5+2.5+2.5 = 15 bonus xp.

with 3 mods this scales again. totalling +26.25 xp, or +262.5% xp from what should be 3 separate +50%
round thorn
abstract cairn
#

I am going crazy why can I not make mod data on the player and transmit it, and have the server look at that mod data

#

it says this when transmitting data

#

did you ever figure this out (sorry for necro ping) chuck seems to have answered my confusion

#

Is there a work-around for adding mod data to the player reference? I'm trying to add mod data to the player and I keep getting this error.

bronze yoke
#

mod data has to be set on a player from their client

abstract cairn
#

yes but it isnt apparently transmitting across to the server, as the traits aren't either (until rejoining)

#

I'm at the point that i might just make a mod data table on the server

#

but I don't know how global mod data works

#

or rather i forgor

bronze yoke
#

that would be better

#

player mod data isn't really reliable over the network

abstract cairn
#

do isoplayer references change between sessions

#

im assuming so

#

which means i need to use steam ID

bronze yoke
#

all object references are volatile

abstract cairn
#

so steam ID is the only way to have persistent data for the players across sessions because mod data on IsoPlayers simply doesnt work

bronze yoke
#

it works fine but it's not reliable to query or edit from other clients or the server

abstract cairn
#

i have it set up so the client adds mod data to themself, then transmits it

#

the server is getting nil from this transmission, and according to what chuck said transmitting mod data in reference to the player simply no worky

#

from my understanding transmit mod data needs to be done on the object that has the mod data, to then transmit it to the server (unless I am wrong)

abstract cairn
bronze yoke
#

ModData.getOrCreate is best

#

most applications don't need anything else

abstract cairn
vague tide
#

I had a mod idea but dont know how to make a mod, is there anyone i can ask to create a mod (if the idea interests them of course)? If not, then any tutorials maybe?

bronze yoke
round thorn
vague tide
#

alright

abstract cairn
bronze yoke
#

no, the table itself is saved

vague tide
abstract cairn
#

wait I don't need to manually save it

bronze yoke
#

you don't

abstract cairn
#

oml

#

thats amazing

#

thank you

#

albion clutch again

round thorn
vague tide
primal tundra
#

Is anyone able to help me out how i can change the rgb tint of an item that is tintable using lua?

silent zealot
#

Which was a real mess to get my head around.

bronze yoke
#

java objects aren't really tables but they do act the most like them

#

the only real trait they have is having a metatable

round thorn
#

if you can would basicially need to just make the zombie unable to see the player and it would be passive.

#

or look into how the Bandits mod works, it basically uses the Zombie logic to make NPCs.

#

if the vision modifier on headgear applies to zombies, could make a mask that has a 100% vision blocking and that should do it, how you get it on a zombie I have no idea unless it spawns with it.

vague tide
#

I know of 2 mods on the workshop. "The Whisperer Mod" which is very buggy but the process of making the mask seems more fair and pretty hard. I currently use "Dead Skin Mask" which functions great, minimal bugs but the process of obtaining it is way to easy, you can get it on day one of playing

round thorn
round thorn
#

make a mod and in your mod overwrite the recipe file by making it the same name. load it after the mod you want to change.

#

make the file the same name, not the mod.

vague tide
#

Alright Ill look into that

round thorn
# vague tide Alright Ill look into that

should be pretty straight forward, copy the mod you want to change into your mod directory, remove any part of it you dont want to change, edit what you do, and then load the patch mod after its parent, of course edit the mod.info so that it uses a new name so it shows up in the mod list.

vague tide
#

Any tutorials i can use?

round thorn
#

Not really, stuff pinned in this channel is about it.

distant inlet
#

has anyone gotten a lua remote debugger to work? I'm trying ZeroBrane's mobdebug with no luck so far..

silent zealot
#

B41 mod that lets you use a corpse to disguide yourself, then Zombies are non-agressive to you until it wears off.

round thorn
#

Neat, but it was GrumLuker asking for the whisper stuff ๐Ÿ˜„

silent zealot
#

@vague tide see comment two comments up ๐Ÿ”ผ๐Ÿ”ผ๐Ÿ”ผ๐Ÿ”ผ

vague tide
round thorn
#

I mostly look for stuff that increases mid to late game difficulty, it gets way too easy eventually.

vague tide
#

Thats fair

round thorn
#

"THIS IS HOW YOU DIED" unless you live more than a week. then its "THIS IS HOW YOU GOT BORED AND FOUND A WAY TO CREATIVLEY KILL YOURSELF"

#

I usually make it so that peak zombie pop kicks in later than normal, but is way higher, but this has really nasty results on performance.

vague tide
#

Makes sense

round thorn
#

might have to see if I can make the zombies tougher and or faster as time goes on, like adjusting the percentage spawns on a timescale.

left blade
#

I feel like modders are most likely to have seen the relevant code, so I ask here: The "% chance for building to be looted" is calculated one time, when you first visit/generate a cell, right? Can't see how it would work any other way

round thorn
#

prety sure its when the cell is generated.

left blade
#

So it would follow that you can drive around in the early game to 'lock in' important POIs with a low chance to be looted? Thinkge

#

I don't want to clear Guns Unlimited rn but I'm very close and could just cruise by

bronze yoke
#

i haven't seen that specifically, but basically everything simlar works that way

round thorn
#

buildings dont spawn/generate containers until they are entered.

left blade
#

That can't be true you can look in the windows and see shelves occupied or not

bronze yoke
#

that's not correct, containers are populated as soon as the squares load

round thorn
#

I mean the container itself is there, the contents arent

left blade
#

You can see that the shelves have contents thru the window

#

The sprite is different

bronze yoke
#

add a listener to OnFillContainer and you'll see it fires for every single container that loads, when it loads

#

this is a myth

round thorn
#

thats fine, im wrong then. silly system honestly if you just drive around the map for the first few days.

left blade
#

Anyway, it would be really weird if you could visit an area, then return to find it looted. That would require the game to track which buildings you have looted or not, first of all

left blade
#

My last save it was a pain in the ass and several important things were looted by the time I got there

bronze yoke
#

it does actually track that anyway but for loot respawn reasons

round thorn
#

thats in the sandbox settings.

#

you can also reduce the chance of a building being fully looted, I think by default its only 50%

left blade
#

I want to survive 1 full year on default apoc settings heh

#

I feel that sandbox settings is basically cheating

round thorn
#

whats the point if you cheese it?

left blade
#

What cheese?

round thorn
#

you dont want to cheat, but you are basically going to cheat in another way?

#

driving around locking in all the loot early. pretty cheesy.

#

you do you, I don't care either way.

left blade
#

That's not what cheese means at all. I want to play the game by the rules, not change the rules

round thorn
#

riiight.

left blade
#

Easy block

#

@bronze yokeThanks for your help! catkiss

round thorn
#

oh no someone doesnt agree with me, I must block them!

#

tool.

undone elbow
#
public Nutrition(IsoPlayer player) {
  this.parent = player;
  if (this.isFemale) {
    this.setWeight(60.0D);
  } else {
    this.setWeight(80.0D);
  }
  this.setCalories(800.0F);
}

Why is it still 80 for females?

bronze yoke
#

this is the constructor, and it does not set isFemale, so when this is called isFemale will never be anything but the default value (false)

faint sonnet
#

hi, i want to make a mod that convert ammos to being simple like pistol ammo, revolver ammo, rifle ammo, sniper ammo and rocket ammo. Any help is appreciated

low badge
# faint sonnet hi, i want to make a mod that convert ammos to being simple like pistol ammo, re...

Sounds like the easiest way to do this to me would be to group them into the 3 weapons categories: Handguns, Shotguns and Rifles. Probably easier to make them all compatible with an existing ammo type. Like 9mm for handguns, shotguns all use the same already, and .308 for the rifles.
Then modify the ProjectZomboid\media\scripts\items_weapons_firearms.txt file so that they all use the same AmmoBox and AmmoType
You'll also have to update the ProjectZomboid\media\scripts\items_weapons_ammunition.txt so that the weapon clips/magazines take the same AmmoType as well.
Then modify the disribution file so that only your selected ammo types spawn.
I'm probably missing something, but that's my first thought.

unique harbor
#

Can I somehow define that my mod should load before another one for other people?

silent zealot
#

Every gun will have two or three parameters to change, depending on if it uses a magazine or not: AmmoBox = 556Box, AmmoType = Base.556Bullets, MagazineType = Base.556Clip,

silent zealot
winter bolt
silent zealot
#

Spongie with the useful answer instead of my vague hints. ๐Ÿ˜›

unique harbor
#

Thanks both of you, will give it a try! ๐Ÿ˜„

#

Hmm.. I guess it will only show in the mod load order menu that it needs to be before something

bronze yoke
#

the code to set it is probably just commented out

#

all the other gender mechanics in there have constants but no code

honest sierra
#

Hey everyone, I'm currently trying to get an if then query with my own sandbox variables into the VehicleZoneDistribution.

  • in my VehicleZoneDistribution.lua I change the codes for the police zone so that PickUpVanLightsPolice and CarLightsPolice spawn with different skins (index = -1) -> works
  • for B42 I deleted ProfessionVehicles.PickUpVanLightsPolice and ProfessionVehicles.CarLightsPolice so that zone-specific vehicles no longer spawn on my own map. -> works
  • the lower part also works, where I introduce two new zones, "morepolice" and "forcedpolice".

What I'm wondering now is whether I can add a query to my sandbox settings here. If the "VanillaReskin" option is switched on, two more vehicles should spawn in the police zone (and in my own two zones). However, it doesn't work the way I think it should. With the if then query in the screenshot, I currently achieve the following result: If my sandbox option defaults to "true", the two vehicles spawn regardless of whether I then switch the option on or off in the game. If I set the default to false, the vehicles do not spawn, regardless of whether I switch the option on or off in the game.

So I assume that "basically" the query works, but it only looks at the default and not the current selection.

winter bolt
#

right now its just doing all of this as soon as the lua file is loaded at startup which means its only using the default sandbox options

#

local function onInitGlobalModData()
    --do stuff here
end
Events.OnInitGlobalModData.Add(onInitGlobalModData)
#

this should set the spawns when loading into the game after the sandbox options are set

strong jasper
#

Hello. Can anyone tell me how I can hide the character model?

umbral raptor
#

I just realized something

#

There are no suitcases in PZ.

lapis moth
#

player has a invisible flag

strong jasper
#

I mean that the player does not see the model of his character

tranquil reef
#

Is there a function to see if an item of a certain type exists in the game registry

main pasture
# strong jasper I mean that the player does not see the model of his character

Not sure if the best way to do it, but this seems to work (setTargetAlpha is used to hide other players when they shouldn't be seen, so it hides everything, not only the model): ```function setPlayerInvisible()
local player = getPlayer()
if player ~= nil then
player:setTargetAlpha(0.0)
end
end

Events.OnRenderTick.Add(setPlayerInvisible)```

bright fog
main pasture
bright fog
#

Thanks for confirming

#

I'll add that to the wiki

bright fog
main pasture
#

Tested setting it once and every tick, but didn't work then. Might have done something wrong, I can confirm they don't work if you think this would be useful to someone

bright fog
main pasture
bright fog
#

Just your sentence was confusing bcs you said it doesn't work when setting it once or every ticks

main pasture
#

I mean OnTick

bright fog
#

๐Ÿ‘Œ

main pasture
#

OnRenderTick works. OnGameStart and OnTick don't. Maybe there are some other that works, but I think it has to be constantly set to work

#

Looks like this

#

Setting it to something between 0 and 1 might be more useful

lethal dawn
#

Think I might have imagined seeing something like this but is there a clothing tag to make something unrepairable but still able to be ripped?

winter bolt
#

just replace Cotton with Denim or Leather

#

in b41 theyre both connected to FabricType though so its not possible there

bright fog
#

I'll add that to the wiki

lethal dawn
tardy mural
#

Hello, anyone knows what the "NoBrokenItems" flag does in craftRecipes ?
For example right here:
item 1 tags[Screwdriver] mode:keep flags[MayDegradeLight;NoBrokenItems],
I tried to modify the recipe and removed the flag but I still couldn't craft the recipe with a broken screwdriver. So what is this flag actually doing?

warm vector
#

Hey, been thinking for a while and one of the things that REALLY bothers me about Project Zomboid is the whole progression system with reading books.
Think it's a bit annoying and distruptive to the gameplay.
Does anyone know of or ever considered making a mod that removes all the default skill books entirely from the game.
And rather reward a very very tiny % of multiplier for each action you did towards a skill?
So that the more you did e.g. metalworking ingame, the higher your multiplier would become over time?

bright fog
bright fog
#

That could be an interesting system

warm vector
bright fog
#

Understandable

warm vector
#

and if I just make book speed 10000% then its just a perma multiplier and is "too easy"

#

so was curious if anyone knew of such mod or ever thought of making it

bright fog
#

No mod does that no

tardy mural
tight blade
tardy mural
#

Yes I tested this in B42. Also I found this line of script I posted here within B42 files on the game.

candid egret
winter bolt
#

those icons look sick

warm vector
winter bolt
#

isnt there a mod that changes skill books to work like in CDDA where it just gives you the xp instead of a multiplier

#

i havent seen it in years though so i have no clue if its been updated

warm vector
#

Yea no idea @winter bolt just never seen any system that tries to fully remove the books/reading system

#

But it's more of doing the actions than touching books

#

this right?

hard nova
#

Holy smokes do I miss Cedar Hill unhappy

bright fog
lilac flower
#

I feel really dumb but I am in the middle of updating my mod to B42 and when I moved it over to the Workshop directory for submit, the mod no longer appears in my mod list and I do not know what I am doing wrong.

Anyone has an idea on what is going on?

lilac flower
#

What if I wanted to publish multiple mods as a single workshop entry? What would the file structure look like?

frank elbow
#

So, the same file structure per mod, just with multiple subfolders under that folder

hidden jungle
#

i fucking hate coding dude..
I just spent 3 hours trying to figure out why my fucking table was giving nil values only to realise that the table saved in PlayerModData() isnt being updated to the changes i'm making. because it saves it between loads.. UGH

hidden jungle
#

note; if you store functions in a table in ModData. those functions will be nil when the world reloads. this was also messing me up

sturdy shale
#

A

fleet bridge
bronze yoke
#

there's an entry for it as a flag (so it technically exists) but it is never checked or used

undone elbow
undone elbow
tardy mural
fervent bay
#

how do you make a B42 mod that adds NPCs you can spawn and control? i look at Week-One mod and think "it can be done, but how?"

bright fog
#

I suggest you start small tbh

rapid fulcrum
#

i want to make a mod for zomboid and for test issues i try to remove all zombie clothes but somehow it doesnt work, what is wrong in this code? (i know nothing about coding)

local function removeZombieClothes(zombie)
if zombie then
zombie:setClothingItem("Hat", nil)
zombie:setClothingItem("Shirt", nil)
zombie:setClothingItem("Pants", nil)
zombie:setClothingItem("Shoes", nil)
zombie:setClothingItem("Bag", nil)
zombie:setClothingItem("Vest", nil)
zombie:setClothingItem("Underwear", nil)
zombie:setClothingItem("Jacket", nil)
zombie:setClothingItem("Gloves", nil)
zombie:setClothingItem("Socks", nil)
end
end

Events.OnZombieAdded.Add(function(zombie)
removeZombieClothes(zombie)
end)

winter bolt
#

i think it is possible to make an addon for bandits that lets you spawn and control npcs? im pretty sure braven made a friendly npc mod that uses bandits

bright fog
#

But if he asks the question it means he probably doesn't know shit about zombies or the Bandits mod in general

rapid fulcrum
sour island
#

setClothingItem isn't a thing either lol

bright fog
#

ChatGPT will make mistakes

rapid fulcrum
#

๐Ÿ˜ญ

#

any tutorials i can watch?

fervent bay
#

all i want is to spawn them and they auto-attack any zombies that can be seen with weapons i chose. that's it

bright fog
fervent bay
bright fog
#

The creator made debug tools to spawn them

#

Bandits are zombies

#

Technically

fervent bay
#

so use debug mode?

bright fog
#

Yea

fervent bay
#

alright, i'll give it a try

ancient grail
fervent bay
# bright fog Yea

i spawned one and it instantly left the area before i could interact with it

nimble badger
fervent bay
#

i made it so only friendlies spawn

nimble badger
#

Talking about bandits, there is an issue where they can insta-kill you if they spawn in the same room you're in

nimble badger
fervent bay
#

no

#

i called out and attracted zombies instead๐Ÿ˜‘

#

unfortunately it doesn't work well with the Sixth Sense mod, since they count as zombies

#

it always thinks one is nearby

half minnow
#

hey guys I was wondering if anyone can give me a bit of guidance here, I am trying to make a mod that makes the trunks of cars that the player enters invincible. I haven't modded PZ before.

I don't think the code is the issue, it might be the way my folder structure is organized?
I didn't really understand much from the wiki and the github example. Debug console gives no error.

I am loading the mod through the Workshop and testing it in singleplayer. here's how the structure looks in ..\Project Zomboid:

Project Zomboid/
โ”œโ”€ Workshop/
โ”‚  โ”œโ”€ indestructible_trunks/
โ”‚  โ”‚  โ”œโ”€ Contents/
โ”‚  โ”‚  โ”‚  โ”œโ”€ mods/
โ”‚  โ”‚  โ”‚  โ”‚  โ”œโ”€ Indestructible_trunks/
โ”‚  โ”‚  โ”‚  โ”‚  โ”‚  โ”œโ”€ 42/
โ”‚  โ”‚  โ”‚  โ”‚  โ”‚  โ”‚  โ”œโ”€ media/
โ”‚  โ”‚  โ”‚  โ”‚  โ”‚  โ”‚  โ”‚  โ”œโ”€ lua/
โ”‚  โ”‚  โ”‚  โ”‚  โ”‚  โ”‚  โ”‚  โ”‚  โ”œโ”€ indestructible_trunks.lua
โ”‚  โ”‚  โ”‚  โ”‚  โ”‚  โ”‚  โ”œโ”€ mod.info
โ”‚  โ”‚  โ”‚  โ”‚  โ”‚  โ”‚  โ”œโ”€ poster.png
โ”‚  โ”‚  โ”‚  โ”‚  โ”‚  โ”œโ”€ common/
โ”‚  โ”‚  โ”œโ”€ preview.png
โ”‚  โ”‚  โ”œโ”€ workshop.txt
bronze yoke
#

move your mod to %UserProfile%/Zomboid/Workshop/

#

the one in the ProjectZomboid folder isn't used

bright fog
bright fog
fervent bay
bright fog
#

It's either you reprogram the entire Bandits AI into your own mod and make something to customize them, or you just directly use Bandits

#

Make a custom UI to spawn bandits with specific weapons or clothing

#

That'd be very easy to do

fervent bay
#

i've never made a mod before, let alone an addon

#

i don't even know where to start

bright fog
#

That's why I suggested starting with something smaller

#

Bcs you're going to be having a terrible time, and the first option of reprogramming Bandits AI in a standalone mod is a no no

fervent bay
#

smaller = ?

spring bramble
#

Hey, quick question is there a some way to apply different properties to the tiles or combine them? Sort of making a 3 in one 1 tile with a stove counter and microwave functional all at once?

bright fog
#

A simpler mod

#

get used a bit to the API

true plinth
dusty egret
#

When I press 1 or 2 it doesn't play any animation, it was working in build 41

mod folder structure
42
media/
AnimSets/player/idle/Test_Idle.xml
lua/
client/AnimationGuide.lua

common
media/
anims_X/
AnimationGuide.fbx
AnimSets/
player/idle/Test_Idle.xml

//
AnimaitonGuide.lua

local onKeyStartPressed = function(key)
local source = getPlayer(); if not source then return end

if key == Keyboard.KEY_NUMPAD1 then
    source:setVariable("IsAnimationGuide", "true")
end

if key == Keyboard.KEY_NUMPAD2 then
    source:setVariable("IsAnimationGuide", "false")
end

end

Events.OnKeyStartPressed.Add(onKeyStartPressed);

shut sapphire
dull moss
bronze yoke
dull moss
#

lmao

bronze yoke
#

so copy it to mods/MyMod/media/AnimSets/ (not inside common or 42) as well as leaving it where it currently is

#

the one in the common folder (or 42) is the one that will actually load, it just won't find it if there isn't also one there

undone elbow
#

Or: lua/server/indestructible_trunks.lua

dusty egret
#

AnimationGuide/
โ”œโ”€ common/
โ”‚ โ”œโ”€ media/
โ”‚ โ”‚ โ”œโ”€ anims_X/
โ”œโ”€ Test_Idle.xml
โ”œโ”€ 42/
โ”‚ โ”œโ”€ media/
โ”‚ โ”‚ โ”œโ”€ AnimSets/
โ”‚ โ”‚ โ”‚ โ”œโ”€ player/
โ”‚ โ”‚ โ”‚ โ”‚ โ”œโ”€ idle/
โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ โ”œโ”€ Test_Idle.xml
โ”œโ”€ media/
โ”‚ โ”œโ”€ AnimSets/
โ”‚ โ”‚ โ”œโ”€ Test_Idle.xml

bronze yoke
#

it needs to be in the exact same filepath as your actual animset

#

so AnimSets/player/idle/Test_Idle.mxl

#

just a weird bug where it still searches the media/ folder for the names of files to load, but correctly searches 42/media/ and common/media/ folders when actually loading them

true plinth
half minnow
true plinth
#

you can format item/recipe/fixing file, you can also see the definition of all vanilla "Base.ITEM" (by default the extension will look inside C:\Program Files (x86)\Steam\steamapps\common\ProjectZomboid\media\scripts, but you can change it in your settings)

#

you can also hover a base.ITEM and see the definition

#

like that :

winter bolt
#

wait this is sick

rapid fulcrum
#

can someone show me a basic reference code for giving zombies clothes

bright fog
vivid imp
#

Thanks Batman

fading horizon
#

is there a way to get the bottom row first table cell to take up the full row? Like a colspan feature?

#

i cant seem to figure it out with the steam formatting

abstract cairn
#

Code isnt working as intended.
Print debug says the array size is 2 both before and after this removal. [originally is a list of all online players]

Thoughts?

#

Oh the remove funciton uses an object reference.

undone elbow
#
private void updateWeight() {
  this.setIncWeight(false);
  this.setIncWeightLot(false);
  this.setDecWeight(false);
  float baseCalorieThreshold = 1000.0F;
  float maxCalorieIntake = 4000.0F;
  float calorieDeficitThreshold = 0.0F;
  if (this.isFemale) {
    baseCalorieThreshold = 1000.0F;
    maxCalorieIntake = 4000.0F;
  }

  if (this.parent.Traits.WeightGain.isSet()) {
    calorieDeficitThreshold = -200.0F;
  }

  if (this.parent.Traits.WeightLoss.isSet()) {
    calorieDeficitThreshold = 200.0F;
  }

  if (this.getWeight() < 90.0D && this.parent.Traits.WeightGain.isSet()) {
    baseCalorieThreshold = 700.0F;
  }

  if (this.getWeight() > 70.0D && this.parent.Traits.WeightLoss.isSet()) {
    baseCalorieThreshold = 1800.0F;
  }

  float weightBasedThresholdAdjustment = (float)((this.getWeight() - 80.0D) * 40.0D);
  baseCalorieThreshold += weightBasedThresholdAdjustment;
  calorieDeficitThreshold = (float)((this.getWeight() - 70.0D) * 30.0D);
  if (calorieDeficitThreshold > 0.0F) {
    calorieDeficitThreshold = 0.0F;
  }
  // .....

Is it true that calorieDeficitThreshold = -200.0F and calorieDeficitThreshold = 200.0F are useless because later there is just calorieDeficitThreshold = ...?

#

When I read code, I assume that it is thought out. So in such cases I always doubt, maybe there is something wrong with me?

onyx valve
#

Hi, Is it possible to make sandbox settings that block or prevent recipes from appearing?

bronze yoke
#

that's my reading too and my ide even points it out as a mistake

round thorn
#

I thought chicken-pocalypse was a joke, but its real and I hate it, I had six chickens, went to bed, I now have 170 chickens...

whole swan
#

Is there a way to get the name of a tile? trying to get the unclimable military/prison fencing but i can only get the gid

#

is there a list or something i can look at

distant inlet
#

@whole swan do you mean something like:
null:location_trailer_01_8:location_trailer_01_8:zombie.iso.objects.IsoWindowFrame@7e6e6a87? Sorry, not sure what you mean by name of a tile I'm new too

whole swan
#

possibly, but I'm not entirely certain, i'm referring to something like carpentry_01_20, like as is used in DebugUIs/Scenarios/Trailer2Scenario.lua at line 158

#

i'm familiar with tilezed but i wasn't sure if there was a way to get the name of a tile from that

hot plinth
#

Is this correct?
mods\modname "Any pre 42 mod files and folders"
mods\modname\42\ Version 42 specific files like scripts
mods\modname\42.1\ Version 42.1 specific files like scripts
mods\modname\common\ any files for 42 that arent version specific, models, xml files etc etc.

bronze yoke
#

yeah

sour island
#

It also uses nearest version number.

bronze yoke
#

build 42 will load any files from the highest numbered folder that is equal to or lower than the current game version, and from common, with the version folder taking priority

hot plinth
#

ok makes sense now. Dunno why but i kept failing to set it up right previously but was probably due to conflicting examples in other mods lol. but yeah seems simple enough

zealous wing
jovial valley
#

goal)for this post, just to add some items
problem) the items I make aren't being recognized by the game
how i know) not appearing in the debug item list
build)42
things I have tried) changing the file location around, comparing to my items to other modded items, and comparing to regular in game items
code) (hopefully I do discord code box right)

{
    imports
    {
        Base,
    }
/****************************** FOUND ITEMS ******************************/
    item StoneOfIntrest1
    {
        DisplayCategory = Material,
        Weight    =    0.3,
        Type    =    Normal,
        DisplayName    =    Stone Containing Iorn,
        Icon    =    Rock,
        WorldStaticModel = Stone,
    }

/****************************** ITEMS MADE ******************************/


    item StoneOfIntrest1bund
    {
        DisplayCategory = Material,
        Weight    =    0.3,
        Type    =    Normal,
        DisplayName    =    Bundle Of Iorn Ore,
        Icon    =    Rock,
        WorldStaticModel = Stone,
        Tags = SmeltableIronSmall,
    }
}```
#

Also please @ me to get a quick response

ebon dagger
#

Can the module name have a dash? That might be an issue.

Does the module name show at the top of the debug item list?

jovial valley
#

Ok Let me test that, because the module named is not show up in the debug list

#

I'm trying to test out your suggestion but, now the game isn't recognizing that I have a mod in the mods folder at all. -_-

#

Okay I fixed the mod not being recognized issue but, the suggestion didn't fix it though

jovial valley
undone elbow
#

I don't see any related errors there.

jovial valley
#

So what do I do, I'm relatively new to modding so I don't know what else I can do to provide information

ebon dagger
#

Can you post your ModInfo file?

jovial valley
#
poster=poster.png
id=HBRC
description=a full colection of mods by HotheadB```
silent sky
#

anyone know how i can make a melee weapon have more then 1 texture

#

or how a texture is assigned to the model i have made a melee weapon and it has its texture but i do not know where its being called from

ornate sand
#

I'm pretty sure a weapon can only have one texture. You'd have to make separate entries for more than one.

silent sky
#

right okay so i have done that

#

here and the blue one does not have a texture

#

i even tried making a seperate model cause i thought maybe the texture was inbeaded into the model

silent sky
#

seems that calling for it is not chanfing anything

#

changing

ornate sand
#

Yeah my axes & blades don't even have a texture entry.

#

Just mesh

silent sky
#

so where do you think the texture is being pulled from the model just knows

#

i know fbx files can do that

ornate sand
#

WeaponSpritesByIndex probably

silent sky
drifting ore
#

https://pastebin.com/XfpvJKLF

When using ReduceFoodSickness, the game only removes sickness when consuming the item the first time, and will not remove any more until you exit and reload... is there a time restriction on it reducing food sickness, and is there a way around it?

round thorn
#

Thoughts on a material crafting recipe: 3 Sacks of Dirt and sifter = 1 Bag of Sand 1 Bag of Gravel and 1 Unity of Clay, Return the Sifter and 1 empty sack?

#

maybe add a bucket of water for the class? and return an empty bucket as well?

#

I also think it would be great if we could have a "dirt pit" and when spending time using it, it generates Dirt, Sand, and Gravel randomly as long as you have empty sacks and a shovel. Collecting Dirt, Gravel, and Sand is tedious and makes the map look really ugly.

bright fog
round thorn
#

I wondered the same, but had not gotten around to trying it yet.

bronze yoke
#

only dirt

#

stone further down but it's difficult to dig downwards until tis fix a bug associated with it

honest sierra
# winter bolt you have to move all this into a function added to the OnInitGlobalModData event...

Thank you very much, it works perfectly.

I was now able to set it so that when the option is switched on, the vanilla "police" zone is emptied and vehicles are loaded with the reskinned scripts instead of the vanilla scripts. In the vehicle script itself, I change the skins or add more skins.

I do a similar thing with mod vehicles, which means that mod vehicles, provided I have reskinned them, are displayed correctly. To do this, however, I have to include the script file of the mod vehicle in my mod, which means I will ask the relevant authors for permission. Their mods are still necessary for the vehicles to appear for me, as I do not include any other files from other modders - only the script file, as I cannot avoid it. (and of course the reskinned texture files).

Do you or any of you here have any other ideas/suggestions?

dusty egret
gaunt leaf
#

Hello boys, Is there someone I could talk in private about dev. ? Iam trying currently make a clothing but strugling.

fathom dust
#

How do I log from lua?

gaunt leaf
#

Ah ... a moment, I might see what I done bad.

bright fog
fathom dust
# bright fog Wdym ?

There's a log view in debug mode once you enter a game. How do I log to that from a mod's lua script?

old ginkgo
#

Print function.

fathom dust
#

Is the syntax documented somewhere? I tried Print("message") but that did not work

#

Ah I see it's print not Print

#

thank you for the assist @old ginkgo

vapid nest
#

Someone please update Jiggas Green Fire โค๏ธ

vapid nest
dull moss
#

"someone please spend their time on this thing that I want"

winter bolt
#

actually no it has tooltips but its saying theres no keyword?

vapid nest
dull moss
#

I mean this is not really a channel for mod requests or update requests. However if you do start updating it yourself and have questions you'll get completely different kind of replies shrug

#

Like there are hundreds of thousands of mods out there

#

imagine if ppl would start coming here asking for updates

#

that's why ppl generally not liking these kind of msgs

#

but we'll be happy to answer lua or modding questions :)

inner seal
#

i am trying to make a sword tha lights zombies on fire its not working

local burningZombies = {}

local function OnFlamingSwordHit(character, weapon, target, damage)
if weapon and weapon:getType() == "FireSword" and instanceof(target, "IsoZombie") then
print("FireSword hit detected!")
print("Zombie health before hit: " .. target:getHealth())

    if not burningZombies[target] then
        burningZombies[target] = true

        target:getBodyDamage():setOnFire(true)

        addSound(target, target:getX(), target:getY(), target:getZ(), 20, 20)
        getWorldSoundManager():addSound(character, target:getX(), target:getY(), target:getZ(), 30, 30, false, 0.5)

        print("Zombie set on fire!")
    end
end

end

local function UpdateBurningZombies()
for zombie, _ in pairs(burningZombies) do
if zombie:getHealth() > 0 then
if not zombie:getBodyDamage():isOnFire() then
zombie:getBodyDamage():setOnFire(true)
print("Reapplying fire effect!")
end
local delta = getGameTime():getMultiplier()
zombie:setHealth(zombie:getHealth() - 0.02 * delta)

        print("Burning zombie health: " .. zombie:getHealth())
    else
        burningZombies[zombie] = nil
        zombie:getBodyDamage():setOnFire(false)
        print("Zombie died from fire!")
    end
end

end

local function ManuallySetZombieOnFire()
local player = getPlayer()
if player then
local zombies = player:getCell():getZombieList()
if zombies and zombies:size() > 0 then
local z = zombies:get(0)
if z and instanceof(z, "IsoZombie") then
burningZombies[z] = true
z:getBodyDamage():setOnFire(true)
print("Zombie manually set to burning")
else
print("Invalid zombie target.")
end
else
print("No zombies found nearby to set on fire.")
end
else
print("Player not found.")
end
end

_G.ManuallySetZombieOnFire = ManuallySetZombieOnFire

Events.OnWeaponHitCharacter.Add(OnFlamingSwordHit)

Events.OnTick.Add(UpdateBurningZombies)

vapid nest
#

Awesome well, Im going to attempt to learn lua and work on the mod instead then any questions I may have I'll post here, ty ๐Ÿ™‚

dull moss
#

also why do you have to manually update burning zombies?

#

can't you just hook up to something in base game and jsut call it from your code? PepeThink

#

also "not working" is vague. You have a bunch of printouts, how are they looking? What is not printing out?

silent zealot
bright fog
bright fog
#

Learn how to mod, we'll gladly help you

silent zealot
#

Should just need

    if weapon and weapon:getType() == "FireSword" and instanceof(target, "IsoZombie") then target:setOnFire()
end

Events.OnWeaponHitCharacter.Add(OnFlamingSwordHit)    ```
bright fog
#

But randomly begging random modders you don't even know to update such an old mod ? Hell no

dull moss
#

I wouldn't call it begging, it was a decent and not rude request, it's just imagine if everyone would come and ask for updates. Not the purpose of the channel

silent zealot
sharp plinth
silent zealot
#

This channel is really good for getting help when you get stuck, but think of it more as a bunch of helpful people that will offer directions but then you still need to get there yourself.

silent zealot
sharp plinth
#

There's a mod manager build into it, uses SteamCMD to download mods from steam ID. Actually, it completely works automatically when selecting the mod folder.

silent zealot
#

I do recommend hosting external content using https using a domain name, a lot of people will freak out when they see http://45.10.161.92:5051/

sharp plinth
#

Yeah I've got the domain, not worried about it right now

silent zealot
#

But I assume that's a placeholder.

sharp plinth
#

Sure is

#

Not worried about getting people on it at all, just trying get it on the same level as tcadmin / pertodactyl

trim quartz
#

Hey all, firstly sorry if this has been asked before, but is isTool() on the InputScript class busted at the moment? (B42 obviously)

#

I'm getting instances where input items like hammers and saws etc are returning false on that function

inner seal
scarlet dawn
#

Mod Idea:
Name of the mod (just a suggestion): Useful Heli's
Premise of the mod: making the helicopter not a burden, but a godsend. making it so the helicopter can pick up your character and bring them to salvation
Pros: helicopter events are a good thing now
Cons: helicopter events are unneedingly rare now to make balance (can be changed via sandbox settings)

inner seal
#

maybe its a problem with this
Events.OnWeaponHitCharacter.Add(OnFlamingSwordHit)
it needs o be OnZombieHit

#

or something

half minnow
#

does anyone know how you could make the capacity of trunks be unaffected by the trunks condition? I wrote this in 42/media/scripts:

module Base
{
    item SmallTrunk1
    {
        ConditionAffectsCapacity = false,
    }
    etc...
}
template vehicle Trunk
{
    part TruckBed
    {
        container
        {
            ConditionAffectsCapacity = false
        }
    }
    part TruckBedOpen
    {
        container
        {
            ConditionAffectsCapacity = false
        }
    }
}

but it doesn't seem to work, trunk capacity still gets lowered with condition.

inner seal
#

maybe you need to assign the Capacity value inside Container

#

container { Capacity = 100, ConditionAffectsCapacity = false, }

bright fog
#

The code he provided is good

inner seal
#

it doesnt work but there is also no errors

bronze yoke
#

it's missing an end so there should be a syntax error

true plinth
half minnow
# inner seal `container { Capacity = 100, ConditionAffectsCap...

i noticed individual vehicle script files, like vehicle "Offroad" use the item "SmallTrunk" instead of something like "SmallTrunk1/2" like in the vehicle items file.

part TruckBed
        {
            itemType = Base.SmallTrunk,

            container
            {
                capacity = 40,
                test = Vehicles.ContainerAccess.TruckBedOpenInside,
            }
        }
#

maybe this "smalltrunk" is defined somewhere else?

true plinth
dull moss
scarlet dawn
#

not 'round here pardner

dull moss
round thorn
#

Has anyone started a flow chart for crafting material usage yet?

vernal ferry
#

How do I go about making a map mod?

round thorn
#

Older vids but still relevant.

dull moss
#

was player:getXp():setPerkBoost(perk, newBoost) changed?
used to work in b41 but now it doesn't seem to do anything confus

nevemind i got it fucked up somewhere

bright fog
#

@true plinth so cool thing, it also formats my console file

fading horizon
quick wagon
#

Heyo! I'm just getting into modding zomboid, and I'm struggling to find any robust documentation. I have an empty trait, but I want it to give the player moodlets when they have facial hair, is that possible? Is there any specific wiki pages that are relevent to any systems that would involve?
My previous experience modding is with Minecraft Fabric, if that helps put me on a map for my knowledge at all :P

dull moss
#

not sure about facial hair but since there's beard grow it should be possible to check if player has beard

#

for moodles you'd need moodle framework, its on workshop

inner seal
quick wagon
#

awesome, is there a way i can print info into a debug console anywhere?

#

sorry for asking all the basic stuff i promise ive been looking before asking โœจ

bronze yoke
#

print()

inner seal
trim quartz
#

I'd also highly recommend copying the game code and opening the LUA in another instance of VS code to follow what the base does to learn from

#

all my own experience of course

bronze yoke
trim quartz
#

No I mean the javadocs thing is fantastic for knowing what there is. My main criticism is not knowing a lot of the what each thing is / does (from a docs perspective)

#

I'm probably spoiled from working with more formal documentation that has full descriptions of functions and classes etc

bronze yoke
#

no i totally get it, that's definitely the biggest issue we're facing, just the one i can do the least about unfortunately

trim quartz
#

yeah I get that 100%

quick wagon
bronze yoke
#

we have plans for incorporating community sourced documentation into the javadocs + umbrella but we're a little behind on the technical side, let alone actual documentation

trim quartz
#

would be an interesting use case to see if you could throw the codebase at an LLM of some kind and see what it spat out in terms of descriptive text

trim quartz
trim quartz
#

thought that might be useful

winter bolt
#

the java doc that was posted above is lifechanging though

trim quartz
#

oh yeah, couldnt even imagine trying to mod without that

dusk totem
#

Heya folks, I'm trying to change a vanilla item to be able to add it to soups etc.
I'm using DoParam lua "EvolvedRecipe = Soup:5"
It works perfectly in B41 but doesn't work at all in B42

I tried with RemoveUnhappinessWhenCooked along with EvolvedRecipe on B42 and only RemoveUnhappinessWhenCooked works, once again, not adding the item to EvolvedRecipes
Would really appreciate any help here, as I'm baffled as to why it works fully in B41, but only halfway in B42.

round thorn
#

the metal parts of broken tools should be smeltable.

dull moss
#

am I stupid?

---Adds xp boosts from a trait to a player
---@param traitName string
local function addXPBoostsFromTrait(traitName)
    local player = getPlayer();
    local trait = TraitFactory.getTrait(traitName);
    local xpBoostMap = trait:getXPBoostMap();
    if xpBoostMap then
        local table = transformIntoKahluaTable(xpBoostMap);
        for perkName, boostLevel in pairs(table) do
            logETW(true, "ETW Logger | ETWCommonFunctions.addXPBoostsFromTrait(): perkName:", perkName, ", boostLevel:", boostLevel);

ETW Logger | ETWCommonFunctions.addXPBoostsFromTrait(): perkName: null , boostLevel: null
while if I crash the game by putting print(table .. "a") and inspect the table it's a table that has k,v Electricity 1

round thorn
#

I feel stupid every time I look at LUA. I can do C++ just fine, but Lua hurts for some reason. the lack of structure really breaks my brain.

dull moss
#

lua is fine

round thorn
#

yeah im not saying its not, its just hard to downgrade my brain to a less strict language.

tulip valve
dusk totem
#

I've been trying to search around, and one other guy had the same issue, where Albion helped them, but that was around B41, where like I said, my DoParam:EvolvedRecipe works just fine

bronze yoke
#

it's not something i've tried since 42 released, but it does look like it should work the same way as 41 codewise

#

but it's hard to blame user error if you have the same thing working in 41 so i have no idea

dusk totem
#

Exactly my thought.
Works with no errors, exactly as intended in B41.
Of course I made sure the item is the same in B42, no problem, it's only the EvolvedRecipe part that doesn't work in B42

#

Unhappyness removal when cooked still works, but there's no way I can add the item to stirfries or anything like that.

bronze yoke
dull moss
#

KekW
nah it works

bronze yoke
#

i'm guessing logETW passes the arguments into string.format before printing?

dull moss
bronze yoke
#

oh, does it just append them?

#

if it dumps them all into print you should be aware it has a hardcoded implementation of tostring (it does not call tostring metatables) so it might not convert all things to string properly, here i guess it's a perk object

dull moss
#

so you suggest tostring things?

bronze yoke
#

that would be one solution

dull moss
#
ETW Logger | addTraitToPlayer() : adding trait     AVClub
ETW Logger | ETWCommonFunctions.addRecipes(): adding recipes for trait AVClub
ETW Logger | ETWCommonFunctions.addXPBoostsFromTrait(): trait and type: zombie.characters.traits.TraitFactory$Trait@3be820b3 userdata
ETW Logger | ETWCommonFunctions.addXPBoostsFromTrait(): table:
Electricity = 1
ETW Logger | ETWCommonFunctions.addXPBoostsFromTrait(): perkName: Electricity , boostLevel: 1
ETW Logger | ETWCommonFunctions.addXPBoostsFromTrait(): perk and type: nil nil currentBoost and type: 0 number
ETW Logger | ETWCommonFunctions.addXPBoostsFromTrait():  Electricity newly set boostLevel: 0

getPerkFromName aint getting

#
---Adds xp boosts from a trait to a player
---@param traitName string
local function addXPBoostsFromTrait(traitName)
    local player = getPlayer();
    local trait = TraitFactory.getTrait(traitName);
    logETW(true, "ETW Logger | ETWCommonFunctions.addXPBoostsFromTrait(): trait and type:", tostring(trait), type(trait))
    local xpBoostMap = trait:getXPBoostMap();
    if xpBoostMap then
        local table = transformIntoKahluaTable(xpBoostMap);
        logETW(true, "ETW Logger | ETWCommonFunctions.addXPBoostsFromTrait(): table:");
        printTable(table);
        for perkName, boostLevel in pairs(table) do
            logETW(true, "ETW Logger | ETWCommonFunctions.addXPBoostsFromTrait(): perkName:", tostring(perkName), ", boostLevel:", tostring(boostLevel));
            local perk = PerkFactory.getPerkFromName(tostring(perkName));
            local currentBoost = player:getXp():getPerkBoost(perk);
            logETW(true, "ETW Logger | ETWCommonFunctions.addXPBoostsFromTrait(): perk and type:", tostring(perk), type(perk), "currentBoost and type:", currentBoost, type(currentBoost));
            local newBoost = math.min(currentBoost + tonumber(tostring(boostLevel)), 3);
            ---@cast newBoost integer
            player:getXp():setPerkBoost(perk, newBoost);
            logETW(true, "ETW Logger | ETWCommonFunctions.addXPBoostsFromTrait(): ", tostring(perkName), "newly set boostLevel:", player:getXp():getPerkBoost(perk));
        end
    end
end
#

local perk = PerkFactory.getPerkFromName(tostring(perkName)); this returns nil

#

and i don't really know why

vernal ferry
#

can someone help me learn how to make a map mod?

dull moss
round thorn
vernal ferry
bronze yoke
dusk totem
round thorn
dull moss
dusk totem
bronze yoke
#

on the javadocs you can look at the return type of getXPBoostMap() to know what types the keys and values will be

dull moss
#

yea I was looking at those to make sure everything is correct types, somehow missed the hashmap facepalm

#
ETW Logger | addTraitToPlayer() : adding trait     AVClub
ETW Logger | ETWCommonFunctions.addRecipes(): adding recipes for trait AVClub
ETW Logger | ETWCommonFunctions.addXPBoostsFromTrait(): trait and type: zombie.characters.traits.TraitFactory$Trait@2abb31e6 userdata
ETW Logger | ETWCommonFunctions.addXPBoostsFromTrait(): table:
Electricity = 1
ETW Logger | ETWCommonFunctions.addXPBoostsFromTrait(): perk: Electricity , boostLevel: 1
ETW Logger | ETWCommonFunctions.addXPBoostsFromTrait(): perk and type: Electricity userdata currentBoost and type: 0 number
ETW Logger | ETWCommonFunctions.addXPBoostsFromTrait():  Electricity newly set boostLevel: 1
#

it's always something with types KekW

bright fog
dull moss
outer crypt
#

Speaking of map mods, is the new version of tilezed out and do we have access to the new sprites in the game? I am guessing they need to be unpacked, etcโ€ฆ

half minnow
#

can someone explain how script overrides work? if i have in my mod something like:

module Base
{
    template vehicle Trunk
    {
        part TruckBed
        {
            container
            {
                conditionAffectsCapacity = false
            }
        }
    }
}

what get overwritten from the original template code (which has more than the "conditionAffectsCapacity" field)? the entire "part TruckBed" block or just the line conditionAffectsCapacity?

#

because I don't want to copy paste the entire original block of code just to change one flag in my mod lol, I noticed that I completely break vehicle trunks if I write it as I did above, but they work fine if I copy paste the entire original script with just the flag value changed.

dull moss
whole swan
#

does the OnDisconnect event just apply to the client leaving a server or does it apply to other players leaving the server as well?

dull moss
#

says client and multiplayer. I think if its server side its on any player dc and if client side it's this player dc? not sure

copper meadow
whole swan
dull moss
#

if albion comes in she knows the answer

dull moss
whole swan
#

awesome, thanks y'all ๐Ÿ™‚

fathom dust
#

Anyone know where code that controls when it gets light and dark is located? I found GameTime.dusk and GameTime.dawn but changing those doesn't seem to affect when the sun comes or goes

bronze yoke
fathom dust
#

I mean sure, but where?

silent zealot
#

I looked into a "night brightness affected by moon phase" mod and got as far as confirming that setting the sandbox options for night light level via Chaneg Sandbox Options takes effect right away, but then couldn't replicate that without bringing up the full sandbox options gui and didn't get back to it.

fathom dust
#

fair enough

#

i just found another, separate dusk and dawn property in ErosionSeason, maybe this will lead somewhere

silent zealot
fathom dust
#

i'll take a peek there too thanks

silent zealot
#

Try searching for "nightvision" since that shows up a few places, and cates eye trait & the stubs of nightvision code whould be where light level gets set

fathom dust
#

oh interesting point

jovial valley
#

Sorry if I'm interrupting someone else's question but this should (hopefully) be a one post response.
Based on the responses I got yesterday, when I asked my main question, my syntax for adding a new item is properly done, which means it might be my file path.
So are there any changes to the file path that an item's scripts have to be put in for build 42 other than putting the scripts folder in 42 folder.
Keep in mind I am incredibly new to modding this game as I've been using online tutorials to teach myself.

silent zealot
#

"ambient" is another good term to search for

silent zealot
tranquil reef
#

People say the animsets are broken, do they only mean the fact you have to copy paste it in all directories? I've had problems with them in other circumstances, hoping it's the game being bugged and not me being a dumbass

silent zealot
#

So <mod>/42/media/scripts/items, or whatever - but in theory anything under /media/scripts/ will work

#

Sorry if I'm interrupting someone else's question
That's just the nature of Discord, there's always going to be a few overlapping conversations here because technical modding questions here will often have someone check the channel hours later and have something useful to add.

jovial valley
fathom dust
#

You are missing the "media" folder it seems

jovial valley
#

hold up I just tried to pull up the tutorial for porting to 42, and 2 popped up. one is the original, one says to do some additional steps (what Voltron said is missing)

silent zealot
#

Your B41 mod should have had the items in <mod>/media/scripts/items/... unless some weird quirk let it work without the media folder.

jovial valley
bronze yoke
#

Item not found: HCS-M.StoneOfIntrest1. line: item 3 [HCS-M.StoneOfIntrest1]

jovial valley
#

Ok

silent zealot
#

Guns Less Limited

High level concept: More guns in Guns Unlimited. Additional items gets added directly into appropriate storage containers, so they might be anywhere from the lockers to the storage room but they will be in there somewhere.

Biggest question I have is what would be the best way to format sandbox options? I'm thinking of somthing like this:

[int] number of guaranteed extra pistols
[int] up to this many extra pistols at random
[int] number of added magazines per generated pistol that uses magazines
[same for shotguns, rifles, assault rifles, SMGs]

[int] 12 guage extra rounds
[int] 9mm extra rounds
[same for other calibres, then that many rounds gets added in cartons/boxs/loose]

Then the code makes a list of items to add, there's a list of container co-ordinates I'll make manually, and it just shoves items into containers at random until it is done. The list of weapons to add can include modded items by manually adding "if modIsRunning(BobsGuns) add more to weapon lists"

Anyone got suggestions, especially as it relates to the way of presenting sandbox options... I'm not sold on the simple category approach but I don't want to make it a list of every single gun type.

fathom dust
#

I'm not familiar with coding sandbox options specifically but if you can have a textbox for input, let them enter a comma separated list of weapons to guarantee

#

as an optional input probably

fathom dust
#

Is it possible to override existing java methods? I think the stuff I want to modify is in private fields. =(

bronze yoke
#

not through the lua api

fathom dust
#

makes sense, is there a way though?

bronze yoke
#

if you're java modding you can replace that class's file entirely

fathom dust
#

And that's supported with modding? Or are you talking about overwriting native game code?

bronze yoke
#

that'd be overwriting native game code

#

there is no java modding support or api

fathom dust
#

okay, thanks

mossy fog
#

Hi, this is my first time talking, i need help finding a beginners friendly tutorial or the full documentation about clothing modding, i have seen the pinned messages, but have a hard time understanding the script part in every tutorial because i have no experience with coding, sorry to bother with my question.

jovial valley
#

I'm trying to give my custom items a custom sprite, but it no worky. Am I doing it wrong. Once again I'm new to modding/coding so please bare with me.

bronze yoke
#

icon shouldn't include a module, the icon will look for media/textures/Item_ + what you put in + .png

#

so e.g. Icon = copp_rock, looks for media/textures/Item_copp_rock.png

jovial valley
#

ok

silent zealot
silent zealot
# fathom dust And that's supported with modding? Or are you talking about overwriting native g...

Some mods like "Better Car Physics" modify java - these require you to manually copy files that overwrite the original game files. In my opinion you need a really good reason to make a java mod; it's extra work for users meaning extra questions for you from people that don't follow directions, it risks breaking very badly every game the game update, there are security considerations from running arbitrary java code (not that most users will care)

fathom dust
#

I've moved on to trying to see if there's a way to add a custom action to an equipment item. Like, a ring that lets you shoot a laser at a zombie.

#

Although I'm not optimistic looking over the item script fields

silent zealot
#

Custom action via right click context menu, yes. Very common thing for mods to add.

#

A hotkey that does stuff starting with checking if you have VoltronsMagicRing equipped, also yes.

#

Shoot a laser? Good luck with that.

fathom dust
#

yeah ideally i'd want to utilize the gun aiming system but for a clothing item

mossy fog
silent zealot
#

Are you doing this as pieces of clothing the player can equip, or by replacing the entire player model with your model?

mossy fog
#

Whatever is easy to start, i make a full body one piece HEV Suit and use the hazard suit as a reference of scale

#

But if is easy as pieces i do it that way

mossy fog
silent zealot
#

I've not done any clothing work myself so I can't say how easy it is, but look at CreamPie's stuff for examples of "replace everything" (no promises they do it the best way, but they have a way that works) and for normal clothing you've got all the vanilla items and lots of mods as examples.

silent zealot
mossy fog
#

Exactly XD

#

I want a full Gordon Freeman run

mossy fog
silent zealot
#

Look at the URL for the mod: see the id number?

#

steam will (assuming default install path) download zomboid mods to C:\Games\Steam\steamapps\workshop\content\108600\< id number>

#

So you can subscribe and then look at all the files in the mod

#

Just like you can go to C:\Games\Steam\steamapps\common\ProjectZomboid\media and look at vanilla stuff.

#

example: When I wanted to add a button to the car dashboard, I subscribed to TPMS and looked at how they did that.

mossy fog
#

Ahhhhhh i did not know i can make it that way

#

What a legend you are

#

Thank you so much

#

Sorry to bother

#

I promise to update the progress of the mod

#

Thanks again

silent zealot
#

Not a bother, questions on modding is what this channel is for.

tired hound
#

Hi and good evening everybody. Does anyone know how PZ actually decides which type of zombie to spawn? I have changed the chances in "media\lua\shared\NPCs\ZombiesZoneDefinition.lua" to ridiculously high numbers for the Zeds I'd like to spawn but they still only make up about 50%. Precisely I'd like the Mod "girl zombie" (With thumbnail Waifu Zombie) to spawn it's zombies to a 100%. But not even renaming the original ZombiesZoneDefinition.lua changed the spawn rate.

#

GPT also threw me a short script that supposedly will remove all entries from the original file, still won't work. (for k in pairs(ZombiesZoneDefinition.Default) do ZombiesZoneDefinition.Default[k] = nil end)

#

I want to play with a few friends but one of them is a huge weeb but to scared of the "real" zombies..

silent zealot
#

I think in the java code, ZombiesZoneDefinition.java getRandomDefaultOutfit()

#

And plenty of other functions for picking outfits in different situations.

#

(assuming you want the actual code on how the game is making use of the zone definitiosn etc)

tired hound
#

So in this part the java code loads the ZombiesZoneDefinition.lua right?

silent zealot
#

(also, that link is for B41 but it's probably the same in B42)

silent zealot
#

KahluaTable var4 = (KahluaTable)LuaManager.env.rawget("ZombiesZoneDefinition");

#

so it can be accessed like that when neeed by java.

tired hound
silent zealot
#

You can search for "ZombiesZoneDefinition" in the decompiled java code, and do the same in all the lua files.

tired hound
silent zealot
#

Wait a sec; you said you set chance to a really high number?

#

Try setting it to 1

#

Since most "chance" type numbers in zomboid are a 1 in X chance

#

even though the Zones stuff loosk like percentage.

#

I also don't know how the game picks a zone for spawns, I assume that is set in the mapping tools or in special event code.

tired hound
#

in the .lua it looks like this: `-- total chance can be over 100% we don't care as we'll roll on the totalChance and not a 100 (unlike the specific outfits on top of this)
ZombiesZoneDefinition.Default = {};

--table.insert(ZombiesZoneDefinition.Default,{name = "FitnessInstructor", chance=20000});
table.insert(ZombiesZoneDefinition.Default,{name = "Generic01", chance=20});
table.insert(ZombiesZoneDefinition.Default,{name = "Generic02", chance=20});
table.insert(ZombiesZoneDefinition.Default,{name = "Generic03", chance=20});`

silent zealot
#

ignore trying chance = 1 then

tired hound
#

the -- is commented out, implying it adds all the chances up to whatever number and then rolls a random number

#

So I understood you can have as many entries with whatever chance, they even added the comment with the fitness instructor having a chance of 20000. So un-commenting that would have most zombies spawn as fitnes instructor I guess.

#

As I understood it, the mod basically just adds rows to this list with standard settings each type of their zeds having a chance of 1. (the mod description says "The probability of spawning cute zombie girls has been increased by 10%." But I don't find anything in their files that actually does this?)

whole swan
#

when using :addItem() for an ISScrollingListBox, does the method return the resulting LayoutItem? How do I get it after it's created so I can modify it?

undone elbow
whole swan
#

thanks!

regal flame
#

Does anyone know how to localize a mod effect to a locality on the map? I was looking to add the ability to use the dingo's store mod but only to the edges of the map. Anyone know if this is even possible or if another mod accomplishes the same thing of allowing players on a server to trade resources for gear but only at specific places?

bronze yoke
#

there's no problem just checking the player's location and determining if it's within a certain area before letting them do something

vast pier
#

4 day late reply, turns out swapping pants or replacing your pants with a belt does not unequip items from the belt slots.
I'm assuming this is because the attachment types are identical.

silent zealot
#

That's convenient.

vast pier
#

How do I add a tooltip to an item? I want there to be a tooltip on the pants that have belts

bronze yoke
#

you can set the tooltip in the item script (or with a doparam or load or whatever) but there can only be one

vast pier
#

That's fine, I don't think there are a lot of mods adding tooltips to clothing?

#

I was more so asking what the param is

bronze yoke
#

Tooltip

#

it should be the name of a translation string

#

so Tooltip = Tooltip_HasBelt or something like that

vast pier
#

alrighty, thanks

onyx valve
#

Hello, does anyone know how the Invisible option works? Does it only make you invisible to the zombies or also to the players?

jovial valley
vast pier
bronze yoke
#

the file should just be called Tooltip_EN.txt

#

translation files don't override each other and they actually have to use hardcoded file names to be read

vast pier
#

oh, that's a strange way to do it

bronze yoke
#

everything about the translation system is strange

vast pier
#

Just confused why it's hard coded instead of designed to just search inside the translation directory?

bronze yoke
#

the strings from each file type (so every file of each name from each mod together) are stored in separate hashmaps, and it uses the prefix in the translation name to determine which one to check inside

vast pier
#

Can tooltips be colored?

bronze yoke
#

i have no idea if that's a performance optimisation or what

#

i don't know if this is still true, but in 41 they had separate code for parsing each of them, and they weren't just copy pasted, some had unique bugs

vast pier
#

What a strange dev cycle this game has

bronze yoke
#

i suspect they must have been lua tables in the past because otherwise them being placed in the lua folder and taking the shape of them is baffling

vast pier
bronze yoke
#

try <RGB:0.5, 0.5, 0.5> my text

dawn lynx
#

Can someone please take a look at this and see why its telling me I have no mod.info when I try to upload it to workshop. Trying to upload in b41 but the mod supports b41 and b42

#

nvm

fathom dust
#

Where can I find the image (not texture) associated with an item that is shown in inventory lists to the left of the item name? And how is it associated to the item? Trying to add an item and can't figure out how to set the inventory pic

hot plinth
#

Thats set by "icon = name" with path if necessary, in B42 some icons have been moved to internal files tho, like for instance Rubberducky icon can no longer be found in textures. So either grab them from an install of B41 if they existed or scrape them from the wiki.

bright fog
#

They can be found

#

Just use the modding tools

hot plinth
#

I mean its pretty quick to just google them but yeh if you need to access a lot of them thats the better option for sure

fathom dust
#

Ah Icon field how did i miss that, thanks!

#

Okay the harder part...is it possible to hook into the gun aiming system with a non-gun item?

autumn sierra
#

if anyone knows, where can profession clothing presets (the options you have in the customization menu) be found? im interested in changing a couple of them for a mod

bright fog
fathom dust
#

Is there a way to have an ongoing status effect while an item is equipped? Like a bonus or penalty other than the specific ones defined? Maybe a way to hook into a tick cycle to check if the player is wearing something?

bright fog
#

And whenever the weapon gets equiped, boost stats in x field, and then once unequiped, revert back

fathom dust
#

yeah that would work

#

I found how to check if something is currently equipped but haven't seen an onEquip or similar type of hook

fathom dust
#

Oh I don't know why i didn't expect it there i've been looking at java classes

#

wait no those aren't quite what i want

#

this is for clothing

#

OnClothingUpdated maybe

#

i think that will work, thanks

bright fog
fathom dust
#

Is there a way to store a state? Trying to figure out how to track if the item is already worn or was just equipped

oak hornet
#

So I Did Something With The Animal UI...

#

And Its Working Great. Thanks To All The Help Here

regal flame
silent zealot
#

Depends what the action is. lets say it's a context menu thing. You add a function to the context menu fill event that is basically:

x,y = player's location
if (x,y not at top of mount doom) return
add_to_context_menu("Cast ring into the fires", theOneRingThrowIntoVolcano)```
#

There's no special code for telling if (x.y) is near the map edge, so you'd end up with something like "(if x < 250) or (x> 19500) or (y>15800)

unique harbor
#

Can I somehow make a local function that works like item:isKeyRing() instead of isKeyRing( item )?

silent zealot
#

And tell people not to cheat across the river to the north map edge. Or use more compkicates rules to decide is x,y is where you wnat it to be.

silent zealot
#

So technically yes but in every practical way, no.

unique harbor
#

Hmm I see, thanks!

silent zealot
#

But it's a really easy test: item:hasTag("KeyRing")

#

for some reason vanilla code in various places uses (item:getType() == "KeyRing" or item:hasTag( "KeyRing"))

unique harbor
#

Yeah that's what I just wanted to point out, really confused me that's why I made a function of that xD

silent zealot
#

If you were going to use it 100 times a function would look a bit neater, but it's not a big deal to just test without a dedicated test function

silent zealot
#

Then you can check that value, look at the current game ticks, and decide if it was recent or not.

bright fog
regal flame
silent zealot
#

Now, which parts of that are "border regions"?

regal flame
#

ah i see

silent zealot
#

Imagine drawing a bunch of rectangles on that which are the border region, then each rectangle is just (left <= x <=right) and (up <= y <=bottom)

regal flame
#

is adding a "if x<10" good enough to activate on the western border?

silent zealot
#

Sure, if you want them to get within 10 tiles of the map edge...

regal flame
#

yes, x=10 is the far west of build 42

#

that would satisfy the goal and i could do the same for south i suppose

bright fog
#

Just check basic geometry lessons on how to know if a point is in a rectangle

#

If the math is the problem

silent zealot
#

that tiny green bit is the only access that does not involves a long forest trek

#

And that's a trek after you travel via road as far west as you can go.

regal flame
#

would it not apply to the entire edge if Y is not a factor?

silent zealot
#

yes, but think about how players are going to get there.

#

Also, I think it it would make more sense to make a small trade zone at the end of roads leading off the map instead of the entire edge.

regal flame
#

this would make sense. what would you suggest would be a better solution?

silent zealot
#

(x>=0) and (x<=25) and (y >= 9875) and (y<=9910)

#

for example

#

Then similar at other road exits

#

actually that is the only road exit other than the louisville bridge.

regal flame
#

yah, i havent gone to 42 unstable yet so it looked like there were 3 or 4 in the last build

silent zealot
#

(I'm assuming you're doing this for B42, if not the B41 map has different co-ordinates but the same logic applies)

regal flame
#

the idea will maybe have to wait for 42 stable and then figure another solution out

silent zealot
#

those spots would also work as "edge of map" trading spots, where the road just ends.

#

And they are in locations that are more feasible to drive to from the Eastern sections of teh map, but still a pain to travel to.

regal flame
#

so the text shoudl be something like:

module Fence
{
imports
{
(x>=0) and (x<=25) and (y >= 9875) and (y<=9910)
}
recipe Sell Gold Jewelry $10
{
Necklace_Gold/Necklace_GoldRuby/NecklaceLong_Gold/NoseRing_Gold/NoseStud_Gold/Earring_LoopLrg_Gold/Earring_LoopMed_Gold/Earring_LoopSmall_Gold_Both/Earring_LoopSmall_Gold_Top/Earring_Stud_Gold/Ring_Right_MiddleFinger_Gold/Ring_Left_MiddleFinger_Gold/Ring_Right_RingFinger_Gold/Ring_Left_RingFinger_Gold/WristWatch_Right_ClassicGold/WristWatch_Left_ClassicGold/Bracelet_BangleRightGold/Bracelet_BangleLeftGold/Bracelet_ChainRightGold/Bracelet_ChainLeftGold,
Result: Money=10,
Time: 10,
keep WalkieTalkie1/WalkieTalkie2/WalkieTalkie3/WalkieTalkie4/WalkieTalkie5/WalkieTalkieMakeShift,
Category: The Fence,
}

silent zealot
#

Is that code specifc to the trade mod?

#

Because almost certainly not.... ๐Ÿ˜‚

#

unless it accepts that syntax for valid locations

regal flame
#

this is from the original mod

#

minus location

silent zealot
#

Does the mod support defining a location?

regal flame
#

module Fence
{
imports
{
Base
}
recipe Sell Gold Jewelry $100
{
Necklace_Gold/Necklace_GoldRuby/NecklaceLong_Gold/NoseRing_Gold/NoseStud_Gold/Earring_LoopLrg_Gold/Earring_LoopMed_Gold/Earring_LoopSmall_Gold_Both/Earring_LoopSmall_Gold_Top/Earring_Stud_Gold/Ring_Right_MiddleFinger_Gold/Ring_Left_MiddleFinger_Gold/Ring_Right_RingFinger_Gold/Ring_Left_RingFinger_Gold/WristWatch_Right_ClassicGold/WristWatch_Left_ClassicGold/Bracelet_BangleRightGold/Bracelet_BangleLeftGold/Bracelet_ChainRightGold/Bracelet_ChainLeftGold,
Result: Money=100,
Time: 10,
keep WalkieTalkie1/WalkieTalkie2/WalkieTalkie3/WalkieTalkie4/WalkieTalkie5/WalkieTalkieMakeShift,
Category: The Fence,
}

silent zealot
#

Because if it does, look up how it wants you to define it. If it does not, you're going to need to add code to create that feature.

regal flame
#

iassume"base" is a location

silent zealot
#

No, Base is the generic top level module for items

#

e.g. a shotgun is Base.Shotgun

regal flame
#

ah

silent zealot
#

But you can often just say "Shotgun" and most places will assume you mean "Base.Shotgun"

#

That looks like a recipe to me, so will be completely different in B42 because teh recipe syntax changes so much

#

(for the better, but the changes are a pain)

#

Nothing in vanilla recipes has a "this only works in this map location" feature so that needs to be coded.

regal flame
#

maybe better to revisit this in full 42

silent zealot
#

If you're building off an existing traidng mod makes sense to wait for that to be updated.

#

But I assume it's a mod that is more meant for multiplayer servers?

regal flame
#

eventually

silent zealot
#

You can always ask the mod maker if there is any way to restrict trading to a certain area only.

regal flame
#

modder is mia i think. last update 2022

silent zealot
#

Why the heck is the logic for a washing machine in java

#

That does not need to be optimized

#

it's the exact sort of thing lua is good for

#

But no, lets put it in java and hard-code it to only work on instanceof Clothing so no-one tries tries to clean a pile of dirty rags in there.

round thorn
#

@dull moss I know you mentioned you haven't started looking into More Traits, when you do also consider looking at Even More traits, it has tons that will synergize well with your mod.

vast pier
coarse sinew
#

items ?

vast pier
#

yes

ornate sand
#

Idk about coloring them but you add a tooltip entry to the item's script and then use the translate lua folder to actually give it the text shown

coarse sinew
#

Unfortunately it doesn't work for items, those are different custom tooltips. But you can use those tags for other tooltips, like for sandbox options. You have to put them in the translated value of the tooltip

vast pier
#

Darn

#

Was just wanting it to be more visible when mousing over pairs of pants if they have a belt or not

untold turtle
#

Haio lads I made recipes for B42. However despite them working fine for a couple of weeks now none of them work so the game wont open. Did something change in a recent patch or something? I just want to figure out this simple problem

untold turtle
# bright fog Yes

Can I have an example of what is done wrong now if I put a recipe here? pls

bright fog
#

Give me a sec

untold turtle
#
craftRecipe Caution Visor Helmet [Rook]
{
    timedAction = Making,
Time = 180,
    SkillRequired = Tailoring:6,
NeedToBeLearn = True,
    tags = AnySurfaceCraft,
    category = Tailoring,
    xpAward = Tailoring:1,
AutoLearn = Tailoring:6,
    inputs
    {
        item 1 tags[SewingNeedle] mode:keep,
        item 2 [Base.Thread],
                    item 1 [Base.Hat_Army;Base.Hat_ArmyDesert;Base.Hat_MetalScrapHelmet;Base.Hat_RiotHelmet;Base.Hat_SPHhelmet],
    }
    outputs
    {
        item 1 Base.Caution_Helmet_Rook_FaceShield,
    }
}
untold turtle
#

Nah I have full uniforms for packs. 2 uploaded that work literally same frame, the rest all worked... then I uploaded another 3 days later and it didnt work despite doing so few days ago

#

none work now when all did

round thorn
#

For the day / night timing switch for Zombie Lore, what times do they actually happen?

lapis moth
#

probably the same way in forage system

vast pier
#

https://steamcommunity.com/sharedfiles/filedetails/?id=3416395382

DESCRIPTION
BeltPants adds belt attachment slots to pants that visually have a belt on them, while making them incompatible to wear with belts.
Meaning choosing a pair of pants on character creation that has a belt will cause you to spawn without the leather belt.
Save on that 0.06 carry weight by not needing to wear a belt!

NoBelt makes it so you spawn without a belt, regardless of what pants you choose.
NoBelt does not make any changes to pants like BeltPants does, just removes starting belt on spawn.```
tight elm
#

Is there any way to get exact game version (e.g 41.78.16) from game files except from java method Core.getVersion()?

glass roost
#

hope u have a great day,
today i created 700+ mods mod-pack handselected with countless hours of work made it work in harmony maybe it gonna be a long announcement but intresting things is inside so for no botherin if anybody ask i share the steam workshop collection and also the config files for the easier nearly 1 minute to play form text me private or just ask for the announcement i will send it here but it LONG!!

Best Regards Neoi Mods

glass roost
#

brb

whole swan
#

does :drawText() work? I've been trying to use it with a panel but nothing is appearing.

local entry = ISPanel:new(0,i > 0 and y or 0, list.width, h)
local text = entry:drawText("Me", 0, 0, 0.1, 0.1, 0.1, 0.8, UIFont.Small)```
#

my panel appears just fine but i've just had zero luck with drawtext()

glass roost
#

try to change ui font or more color variants maybe some brighter like 10, 10, 1, 1, 1, 1,

#

just to make sure it's appair if doesn't then the problem somewhere else

whole swan
#

tried that, gonna see if it's returning anything after i call it

#

it returned nil, so maybe it just doesn't work with a panel?

bronze yoke
whole swan
#

ohh okay

#

thanks albion

bronze yoke
# vast pier Darn

if you don't mind adding a dependency you can add a coloured tooltip label using my library

vast pier
#

starlit?

#

I already released the mod or I probably would.
Don't wanna just add dependency randomly for something minor

jovial valley
still rain
glass roost
#

i have to say a very big thanks no matter wich mod you created because every piece of the mods are my favourite one's what i play with! i want to share with others also Toothless_UwU

silent zealot
#

Especially in a channel for mod development - you could be doing anything with your mod and we have no idea.

#

There are two clear errors in your console.txt, with the second saying "I gave up, probably because of teh previous error"

#

The first is because you used Base.log instead of Base.Log.

    java.lang.Exception: Item not found: Base.log. line: item 4 [Base.log] at InputScript.OnPostWorldDictionaryInit(InputScript.java:685).```
silent zealot
whole swan
bronze yoke
#

you don't need to call a ui element's render functions, as long as it's added to the ui manager it'll be called automatically

#

it won't work on those events because ui rendering happens at a separate stage so none of the state needed to actually render ui is set at those times

glass roost
#

but what i use build 42 mod nearly all of them from b41 so generally they work in b41

whole swan
#

do you have to add every element to the UI manager individually? or is it sufficient if i add children and add the main window to the manager?

glass roost
#

there is around 130 mods hidden and 80 broken this is why i share the config files with you

bronze yoke
glass roost
#

read the description are at my collection it's important

whole swan
#

trying to post my code but the server's blocking me for some reason

#

can i DM you albion?

bronze yoke
#

sure!

silent zealot
#

At least one other mod has "B42 ONLY!" in the description.

glass roost
#

but im gonna delete them

glass roost
silent zealot
#

Yeah, B42 only mods won't cause issues but they won't show up at all in B41.

glass roost
#

ohh well thanks m8 i really approciate it

silent zealot
#

Starving Zombies [B42] is B42 only (mod descriptuion)
Canteen Slot is B42 only (my mod, changes an item that does not exist in B41) and Authentic 1990s Battery Charge Detection (my mod, no code for B41 because the value of that mod is less in being used and more as a performance art piece on the mod workshop so I didn't bother backporting it t B41 )

#

It would be worth checking for mods tagged as B42 without the B41 tag to find any others.

lethal dawn
#

Are there any resources for setting up loot distribution files? I hope those haven't changed in B42 because I haven't even set one up before

#

Oh, also if there's anything on the new recipe system for B42, I wanted to make one of my mods b42 compatible but I couldn't really figure it out

lethal dawn
#

that's good to hear, gives me more time to figure them out without worrying about it

silent zealot
#

(fix is to swap to WardrobeGeneric instead)

bronze yoke
#

yeah but it's not surprising the actual loot tables have changed, the game was updated, the loot system hasn't

silent zealot
#

Now I'm really confused about what the developer's goals are with the new aiming system.

#

I hope that's a silly communication failure and not the actual intended behavior.

jovial valley
#

I got 2 questions, but they're a bit complex for me to ask both at the same time. Here is the first
Is there a (hopefully beginner friendly) way to immediately eject items from the players inventory, or at least make it where they don't have to/ automatically pick it up to get it from crafting or foraging?

silent zealot
#

You want to remove an item from the player and immediately place it on the ground?

#

Definitely possible.

jovial valley
#

Yes that, I want that

#

As for why...

left spear
#

no not you

jovial valley
#

It would be weird for you to be able to pick up an entire mine shaft wouldn't it

silent zealot
#

You can see that happening in ISTransferAction:transferItem in ISTransferAction.lua

silent zealot
jovial valley
#

It's automatically being picked up. I don't want it to be

silent zealot
#

Just spawn items where they should be.

jovial valley
#

In the mine, shaft isn't spawning in directly it's being made by the player

silent zealot
#

I'm not sure what a "mineshaft" is exactly

silent zealot
# left spear why??

That was my question too! With a lot more swearing but I left the wwearing out of my reply on the Bug Forum.

silent zealot
#

Are you adding something that gets found via foraging?

jovial valley
# silent zealot Just spawn items where they should be.

Okay so I made it where it's possible to find these "there's iron in the ground here" in the deep Forest areas of the map with foraging level 10. (That will also be ejected from the player's inventory when obtained), then the player can use that item to make a mineshaft.

silent zealot
#

Assuming B42, why not do mining with the new right click on resource node -> use pickaxe/etc to mine

jovial valley
#

I know about that but this is for in mass collection because of my mod will require it

#

I'm adding a lot of endgame stuff for myself

silent zealot
#

What is the item that foraging detects? If it's too heavy for the player it will automatically end up on the ground

#

I've got a not to check that code in my "bypass all container size limits everywhere" mod.

jovial valley
#

That's a way to eject items from the players inventory? If so, it should already be doing that. As it is 9999 lb

silent zealot
#

And what happens when you find it and collect it?

#
  • Foraging (not tested)
    Lua\client\Foraging\ISBaseIcon.lua:118: if plInventory:hasRoomFor(self.character, self.itemObj) and plInventoryHasSpace then
    lua\client\Foraging\ISBaseIcon.lua:146: if (not backpack.inventory:hasRoomFor(self.character, self.itemObj)) or (not plInventoryHasSpace) then
jovial valley
#

To be honest, I made it so rare where I would have to spend quite some time to find it in a deep forest

#

I guess that would be solved by cranking up its spawn right for a temporary time then eh

#

Rate*

silent zealot
#

I think it will just not let you pick it up.

#

if plInventory:hasRoomFor(self.character, self.itemObj) and plInventoryHasSpace then will be false

#

for _, backpack in ipairs(bpList) do local bpItem = backpack and backpack.inventory and backpack.inventory:getContainingItem(); will be false for every backpack equipped

jovial valley
#

is there a way to immediately spawn it in once spotted or do i have to pick it up?

#

if thats the case of course

silent zealot
#

I'd say the assumption is if you find something too heavy you discard it or free up space.

#

You could modify function ISBaseIcon:doContextMenu(_context) to includ "put on ground"

#

But... having an InventoryItem that weighs 9999 makes no sense

jovial valley
#

i want it to not be that moveable

silent zealot
#

Make it a world object

#

Like the stone outcroppings etc

#

You'd have to add some code to the "I found a thing" forage code to do that instead of the normal stuff

jovial valley
#

will that lock it behind lvl 10 foraging?

silent zealot
#

You're the one coding it, so it will if you add "and playerskill"foraging")>=10"

#

This is getting more involved than a simple "add to foraging tables"

#

What about having the character find a chunk of ironstone that can be smelted?

jovial valley
#

wait i just realized an easier way

#

"You want to remove an item from the player and immediately place it on the ground?
Definitely possible." ... how, because if i just make it eject, and not weigh much...

#

i can pick it up from foraging and have it on the ground

silent zealot
#

If you pick up a light object from foraging, why would it be on the ground? You just picked it up.

#

scroll up a bit, I pisted a vanilla function name + screenshot of code

jovial valley
#

ok

silent zealot
#

you might even be able to call that existing function directly instead of making your own based on it.

jovial valley
#

an for why i want it... its not really an "object," but more of a concept

silent zealot
#

The foraging system is for finding items and spawning them into player inventory when picked up. You're fighting with it to do something that different.

#

Even the concept of using an item to make a location with iron is odd.

#

I really think you're better off adding a world item, "exposed iron vein" that can be right click -> mined like other resource nodes but doesn't despawn once used.

#

Then decide on what logic you want to spawn one.

jovial valley
#
  1. I've seen it in build 41 mods, just for things like "has animal tracks" instead, I'm just making it where you can't pick up the item and take it to a safe place
  2. at the end of the day im a beginner, im trying to teach my self off of existing advice and tutorials, also (off topic) why are all the good video tutorials for food items anyways lmao pain
#

i dont know the names of the mentioned 41 mods off the top of my head though

silent zealot
#

If you know a mod that does what you want (or at least part of what you want) look at how that mod did it.

#

Might not be the best way, but it works.

#

And that gives you a starting point for your own code.

jovial valley
#

the problem is im trying to do the part that is not there

#

the concept of using an item to make a location is thogh

#

*though

silent zealot
#

The mod you base this on - what exactly is it spawning via teh foraging system?

#

And is it just adding an item or is it adding an item and lua code to change the vanilla foraging behavior?

silent zealot
#

Or it does the "you found something" from foraging but then you don't actually get the option to pick it up (i.e.: there is never an InventoryItem)

jovial valley
#

i think it was an item that could be picked up, its why i it. i designed my sprite after what they used so leme pull it up

#

*un downloaded

silent zealot
#

What is the mod name and we can look at the code they use

#

But... "I think it was" means we don't have any clarity on what you're actually trying to do.

jovial valley
#

hold on leme clear it up

onyx valve
#

FoodEffects.OnEat_FullHealthFood = function(food, player, percent)
local bodyDamage = player:getBodyDamage()

bodyDamage:RestoreToFullHealth()

if bodyDamage:IsInfected() then
    bodyDamage:SetInfected(false)
    bodyDamage:setInfectionLevel(0)
end

bodyDamage:setOverallBodyHealth(100) 

end

Could this work in MP even if getPlayer() is not used? In SP it works, but I worry about mp.

silent zealot
#

if the player parameter is the player object to affect, yes.

#

It's up to whatever is calling that function to put the correct playerobject in there.

jovial valley
#

im making (what the code will see as) an item, but it will eject from the inventory on pickup. i've already done evrything else i need.

#

the RP concept is something your PC realizes about the environment

onyx valve
silent zealot
#

For the most part, that's how client/shared/server folders work.

onyx valve
#

oooh what a good way to explain jjajaj

#

Thank you very much and sorry for the inconvenience

silent zealot
# jovial valley im making (what the code will see as) an item, but it will eject from the invent...

You probably want to modify the foraging code then, because I don't think there is any "item put in inventory" event listener you can add a function to and if you're going to patch vanilla code if makes more sense (and will be a lot easier, and better performing) to patch the foraging code to put the item on the ground than to patch the inevtory code to decide every time an item is moved if it should be put on the ground.

silent zealot
#

The exceptions I know are: server code loads later than client and shared code. But in a weird way you probably can't rely on.

#

the stuff in shared/translate isn't really lua, it just pretends. And unlike everything else you want to use the same filenames for your translation strings.

jovial valley
#

hmm so there no "OnPickupItem" or what ever it would be called function?

silent zealot
#

Maybe OnProcessTransaction

#

but that looks like it might be for world items, not inventory items.

#

adding an OnCreate is no good because that happens before the item is placed into an inventory.

jovial valley
#

is there a way to get the player to make a world item?

silent zealot
#

depends what you mean by "player make"

#

you can create world items

#

happens every time you put down a piece of funriture.

#

But it's not the player object creating it, it's whatever code triggered to create it

#

But now we're going in circles and discussing spawning world items again.

fathom dust
#

Anyone know if there's a way to differentiate between a shove and a stomp? They both appear to use the same "Bare Hands" weapon.

silent zealot
#

"what difference?"

jovial valley
#

is it possible to tie dropping the item to a action that almost guaranteed after its picked up, like the player moving?

fathom dust
#

Is there a way to access public member variables on java classes from lua or are only methods available?

#

ah i see the documentation for that now

silent zealot
#

make certain you set a very low cost check that aborts if yoru code is not needed, bcause onUpdate runs more-or-les once with every frame.

#
   if not HotHead.NeedsToDrop then 
     return
   else     
     <drop item here>
     HotHead.NeedsToDrop=false
    end
   end```
#

Checking a bool on every update is fine, going through the whole player inventory checking items is going to be a perfomance hit.

#

And obviously you'd want to set HotHead.NeedsToDrop, but that can be done with an OnCreate function attached to the item.

#

There is a potential timing issue with OnCreate and when the item goes in your inventory and when OnUpdate is called, safe way is to handle it with some safeguards around the drop code; "if I've tried more than 3 times to do this then give up, log an error, set HotHead.NeedsToDrop=false"

hot plinth
#

can someone look at my clothing.xml and tell my why literally only the tights spawn? Ive tried to base this on other working mods that add zeds and i have no idea honestly.

hot plinth
#

You know what, i thought about it, im guessing i need to include all the base game items in my own fileguidtable. ๐Ÿ˜ฎโ€๐Ÿ’จ

native swift
#

im having the hardest time with a simple beanie mod for some reason. everything looks textbook and good. however the icon in my inventory is tinted sometimes, but its not tinted in the crafting menu. and when i put the hat on its invisible. and then when i drop it on the ground, it makes me invisible until i walk away from it lol. any ideas? im driving myself crazy over this lol

hot plinth
#

Id check your beanies clothing xml clothing/clothingitems/youritem.xml
for random tint function
<m_AllowRandomTint>false</m_AllowRandomTint>
Assuming your icon is just called "item_name" and its setup doesnt include anything like _mask _tint etc it should be fine

#

I mean thats if you dont want the item to be tinting.
If you do want it tinting you could download my tinted tights mod and see how ive copied the base game files to get that working right.

native swift
#

idk why it is only tinting in the inventory tho its weird. and i have it false already. in crafting menu the color is fine. just the inventory of my persons is tinted

#

my main thing is why is it making me invisible when i drop it on the ground

native swift
#

So somehow I fixed it. I looked at another hat mod and they had more directories than mine. Like the textures were deeper in folders which I didnโ€™t thought should matter. Iโ€™ve done several mods where textures arenโ€™t but one or two folders deep. Idk if itโ€™s different cuz itโ€™s a hat? And the texture png I changed to 128x128, which is weird cuz all my other mods have been bigger. But those two changes fixed it

#

I rlly donโ€™t know how it fixed

hot plinth
#

Honestly clothing i find extremely confusing, i had a shirt with custom decal in my duck mod and decided to just delete it. After many fixes and spending probably more time on the shirt than the entirety of the mod i just said stuff it lol

#

Like in the end i couldnt make it not tint the decal so i was like stuff it i hate this xD

native swift
#

Itโ€™s honestly been pretty straightforward once I saw the structure. Iโ€™m new but Iโ€™ve messed around before and I got some to work pretty easily just by studying structures of other mods. But the hat was the only one that really screwed me over it just took me like 7 hours to get it to show up I was going mad. But I guess you just have to have a specific order of directory names or something which I didnโ€™t have to do for pants or shoes. Idk itโ€™s weird af

plush wraith
#

Looking for some input or direction on how to display a model dynamically on the character model somewhere.

I want to display the cigarette on the characters mouth when conditions are met, ideally looking for a way to just display it and not make it into a wearable item

silent zealot
#

Can a clothing item have it's status toggled between two states that display differently? Actually yes that must be possible - things like hoodie hood up/hood down, Spongies' jackest, etc. Which does not get away from having a clothing item... no idea about that.

#

I wonder if you could use the "impaled by a weapon" feature somehow.

bronze yoke
#

you can mess with item visuals directly without actually equipping a clothing item but it's pretty complex

silent zealot
#

Out of curiosity, what conditions are you planning for showing/hiding a cigarette?

#

Since you have the cigarete in your hand when doing the smoking action.

plush wraith
#

I wrote a smoking mod that extends the smoking mechanics, gives smokes duration/length, you can puff them, they burn at variable rates, etc. Wanted to look into displaying it on the mouth when not actively being puffed as thats my intended mechanic happening.

silent zealot
#

So less "smoke a cigarette, get back to doing stuff" and more "I nearly always have a cigarette in my mouth, but sometimes it's just resting there and I take a puff occasionally"

plush wraith
#

Ya the idea is it's passively being smoked outside of a timed action but you can also actively smoke it for immersion

silent zealot
#

Makes sense, plenty of smokers fidget with cigarettes in between smoking them or take their time.

#

Also, you could use the same logic for pipes.

plush wraith
#

Ya the way I wrote it is it hooks over the eat function so it just wraps anything I specify

#

most annoying part is handling stat changes

#

Nice part too is anything it doesn't hook just runs as normal