#mod_development

1 messages · Page 350 of 1

frank elbow
#

But it would be a neat feature, being able to be like “nowhere else to go”

sour island
#

But I also thought/think about zombie movies and in a lot there's some scene of someone being desperate and jungle gyming a balcony or two

thin swan
#

That shouldn't be too hard to make with the current access tbh, you could just use the available movement state and make a new animation. The tricky part would be to keep the player from falling if the window/balcony is on Z+1 and there's technically no floor tile to "stand" on (but could be done for example by spawning invisible floor tiles that gets removed as you go)

bright fog
#

Stops player from moving + you can fix player direction view

#

There was a commission request for that recently

#

I'm fairly certain that's completely doable

sour island
#

Yes, it's probably doable - but I still think the base game would benefit from having it 😅

#

Same with the jumping, crawling, etc

#

Step/stage based climbing would be awesome too -- basically you can climb to the top of a fence and pause there rather than be forced to finish the climb

thin swan
sinful cairn
#

Indeed, this does sound like the goal. Any new ItemTag's a mod wants to introduce will register itself with a namespace and ItemTag identifier to the ItemTag system. I believe the Perks system does use this, though I think we will be going through a naming standardization phase so everything matches the java implementations..

    public static final ItemTag AEROSOL = register("Aerosol");
    public static final ItemTag ALCOHOLIC_BEVERAGE = register("AlcoholicBeverage");
    public static final ItemTag ALREADY_BROKEN = register("AlreadyBroken");
    public static final ItemTag ALREADY_COOKED = register("AlreadyCooked");

I believe in Lua it will look something like this.

local tags = {
 FLAMMABLE = ItemTag.register("modnamespace:flammable");
}
if item:hasTag(tags.FLAMMABLE) then
    item:ignite()
end
sour island
thin swan
#

That is very awesome

sinful cairn
dusk mortar
#

no progress idk what i should do for text in center of labels

dusk mortar
#

help

sinful cairn
# sour island Very nice! I have a few follow-up questions but only if you're up for them. 😅

To answer the second part of your initial question, there is no current plan that I’m aware of to add handling or preprocessing for these scripts. Any validation or parsing would still need to be done externally. It makes more sense to me having an external tool do verification rather then tightly coupling it with the game engine. PZ already has a massive boot loading issue that needs to be dealt with.

bright fog
dusk mortar
dusk mortar
bright fog
bright fog
#

Where do you think these are handled ?

dusk mortar
bright fog
dusk mortar
bright fog
dusk mortar
bright fog
#

Renders in the Lua are pretty easy to understand

#

And very flexible

#

So idk what you did to edit those labels without knowing anything about Lua UIs, but yea idk man, you can most definitely modify the whole main menu UI I am sure of it

#

Check this

#

That's currently the only guide for UIs

sinful cairn
# sinful cairn To answer the second part of your initial question, there is no current plan tha...

Once everything is turned into typesafe objects requiring registration with the various systems, it will greatly reduce runtime errors and make validation more straightforward, because the engine can rely on the type system to catch mismatches. Mod should get clearer feedback during development, since any missing or misregistered objects will be flagged immediately, rather than causing subtle bugs or crashes in the game.

Once we get to that point, we will be in a better place to decide if an external validator or game engine validation would be more appropriate. At that stage, with everything converted into typesafe, registered objects, we will have a clear picture of which errors can be caught automatically by the engine and which would benefit from external tooling. This will allow us to strike the right balance between runtime safety, mod flexibility, and tooling efficiency, rather than making assumptions prematurely.

frank elbow
bright fog
#

Yea we're very curious about that and this is something discussed constantly

#

It's a topic that keeps being brought up in technical modding conversations

next plover
#

is it impossible to reskin/ re texture vanilla game items like a jacket for example that is already in the game without overriding it and making a mod for it. keep getting errors and invisble jacket.

sinful cairn
frank elbow
#

Gotcha, thanks for the response

robust briar
#

I have been working to get zombies to be "disinterested" in a player. I have a mod in mind with special infected, and one of those types of special infected should basically stand still, with no interest in attacking players until a player touches it (attacks it). I have all code to track them, sync that in MP, detect the hit and track that, etc.

The problem I have is I can't figure out how to actually make them completely disinterested in tracking/attacking players.

From a technical perspective, I have tried a bunch of things, and no matter what I do they seem very hard coded to ALWAYS pursue a nearby player in view.

My current iteration/attempt is:


-- Assume zombie: IsoZombie
--        zombieData: table properties of zombie
--       
if zombieData.isRooted then
    zombie:setX(zombieData.x)
    zombie:setY(zombieData.y)
    zombie:setZ(zombieData.z)
    zombie:setDirectionAngle(zombieData.direction)
    zombie:setMoveDelta(0)
    zombie:setSpeedMod(0)
    zombie:makeInactive(true)
    zombie:setTarget(nil)
    zombie:setVariable("bPathfind", false)
    zombie:setVariable("bMoving", false)
    zombie:setVariable("turnalertedvalue", "0")
end

I call the above EVERY SINGLE TICK on both every client which has it loaded and the server.. yet still it tries to attack. The update to make it try to move and attack seems to occur outside the lua tick just enough that they jiggle and wiggle and try to hit the player and they look stupid.

So my question is, does anyone know a way to stop a specific IsoZombie from trying to attack players? Essentially make them "brainless" until I decide via code they should now actually aggro?

sour island
#

I wouldn't have ever expected the transition away from scripts but honestly good riddance 😅

#

I've always preferred Lua generation when possible

bright fog
#

If I remember right

#

Also what special infected are you making exactly ? 👀

robust briar
#

Ohhh.. interesting. that might just work

#

when you stare at an API so long you miss the obvious right in front on you

robust briar
# bright fog Also what special infected are you making exactly ? 👀

Well, these are plant based zombies with roots and flora growing out of them.

Late stage they get roots coming out of their legs and get "planted" into the ground. They generally become docile at that point and just emit pollen which posions the area around them for players.

If you walk up and smack it though, it "wakes up" and "fights to break its roots" to come get you.

Problem you have now is this thing is covered in bark.. so good fucking luck breaking through (10x+health)

next plover
#

is it impossible to reskin/ re texture vanilla game items like a jacket for example that is already in the game without overriding it and making a mod for it. keep getting errors and invisble jacket?

boreal basin
#

Wanna say a huge thanks to whoever it was if they are in here that posted the tutorial on the wiki for doing voice mods, was super helpful and allowed me to create my own with relative ease so huge thanks ❤️ spiffo

bright fog
#

That was @winter bolt

next plover
bright fog
#

I did notice your message yea but I really don't know

#

I'm really not sure

next plover
#

can u do it with other vanilla items?

bright fog
#

I can only redirect you towards the modding Discord, and ask specifically in channels that involve your modding type, you may find specific help more easily there

bright fog
#

Clothing are different in how they are handled regarding their models and textures

#

Since a large bit of those is defined in XML files

next plover
#

ok thanks

bright fog
boreal basin
bright fog
#

Just to improve it to be more Wiki fitting, reword some sentences to improve clarity and to fit the rest of the wiki (modding wiki at the very least)

boreal basin
#

ah yeah that makes sense, always worth keeping things inkeeping and up to date with latest resources etc

bright fog
boreal basin
bright fog
#

Alright nice, so I can bump the guide version to the last game version

small topaz
#

Hi! When I use room:getZ() where room is a RoomDef object, it always returns -1 for me. I call this OnNewGame event. Here is minimal example showing somehow what I am doing:

local function myFunction()
    local x = 10627
    local y = 9693
    local building = getWorld():getMetaGrid():getBuildingAt(x, y) -- get BuildingDef object
    local rooms = building:getRooms() -- all rooms as RoomDef objects
    for i=1,rooms:size() do
        local room = rooms:get(i-1) -- a RoomDef object
        print(room:getZ()) -- is always -1 for me
    end
end

Events.OnNewGame.Add(myFunction)```
The `print()` command always gives `-1` for me although I thought `getZ()` would be the actual z position of the room (so `-1` for basement rooms, `0` for ground floor rooms, `1` for 1st floor and so on). Anyone an idea what is going on here? Also, when I have a RoomDef object, how do I get the correct z position?
proud fox
#

Hello, if anyone has used the InventoryReinvented mod before, I’ve updated it to be compatible with Build 42.12.3. I’d appreciate it if anyone could test it and share positive or negative feedback.

sharp plinth
next plover
#

NEED HELP PLEASE . Caused by: java.lang.NullPointerException: Cannot invoke "zombie.core.skinnedmodel.visual.ItemVisual.getHole(zombie.characterTextures.BloodBodyPartType)" because "<local14>" is null at zombie.inventory.types.Clothing.DoTooltip(Clothing.java:215) at zombie.inventory.InventoryItem.DoTooltip(InventoryItem.java:619) ... 45 more Everything works just when i try to equip it is invisible.

queen oasis
# small topaz Hi! When I use `room:getZ()` where `room` is a RoomDef object, it always returns...

I had trouble with this a while back. I ended up with this very ineloquent code

local rooms = playerObj:getCurrentBuildingDef():getRooms()
for i = 0, rooms:size() - 1 do
    local room = rooms:get(i)
    if room then
        local roomSquares = room:getIsoRoom():getSquares()
        for h = 0, roomSquares:size() - 1 do
            table.insert(buildingSquares, roomSquares:get(h))
        end
    end
end
if playerObj:getSquare():getChunk():getMinLevel() < 0 then
    for _, sq in ipairs(buildingSquares) do
        local undergroundSquare = getSquare(sq:getX(), sq:getY(), sq:getZ() - 1)
        if undergroundSquare and undergroundSquare:getRoom() then
            table.insert(buildingSquares, undergroundSquare)
        end
    end
end```
It might help you get where you're going
bronze yoke
#

<@&671452400221159444>

next plover
#

can someone please check if my files are setup correct cant figure this error out

#

WARN : General , 1761267855846> AnimatedModel$AnimatedModelInstanceRenderData.init> skinningData is null, matrixPalette may be invalid

rustic mango
#

I would like to make a casino mod, with slotmachines and a blackjack table. Anyone help? I just cant make the submenu "play slotmachine" to appear

silent zealot
#

The getHole makes me suspect you have a typo in the BloodLocations for a piece of clothing

#

But that's a lot of guesswork without context.

round kiln
#

is there a code/function to remove a parameter in an items code (like eg remove CantEat variable

#

i already know about doparam so i may need one where i have to remove some parameters

#

maybe a bad example cause canteat is bool so that means i can just set it to false but is it possible?

silent zealot
#

What type of item, and which parameter?

#

You may be able to call ScriptManager.instance:getItem("DoubleBarrelShotgun") to get the script Item and then modify that.

#

With the bonus complication of existing items in a saved game will have their own values stored for some things, while other things will fallback to the script object.

shell holly
#

Hi. I can't format my text with this code. I should point out that this is for b41.

local function OOS_ShowNote_Parchemin(item, playerObj)
   ...

    local sw, sh = core:getScreenWidth(), core:getScreenHeight()
    local W, H   = 760, 480  

    local win = ISCollapsableWindow:new(math.floor((sw - W)/2), math.floor((sh - H)/2), W, H)
    win:initialise()
    win:setResizable(false)
    win:setTitle("********** Note scellée **********")
    if win.setAlwaysOnTop then win:setAlwaysOnTop(true) end
    win:addToUIManager()

    local padX, padTop, padBottom = 14, 28, 56
    local rich = ISRichTextPanel:new(padX, padTop, W - padX*2, H - padTop - padBottom)
    rich:initialise()
    rich.background      = true
    rich.backgroundColor = { r = 0.93, g = 0.86, b = 0.72, a = 0.95 } 
    rich.borderColor     = { r = 0.85, g = 0.70, b = 0.25, a = 0.9 }  
    rich.clip            = true                                       
    if rich.addScrollBars then rich:addScrollBars() end

    win:addChild(rich)

    local txt =
        "[center][b][colour=0.83,0.69,0.22]— Parchemin —[/colour][/b][/center]\n\n" ..
        "[font=Large][colour=0.23,0.18,0.18]" .. body .. "[/colour][/font]\n\n" ..
        "[i][colour=0.43,0.31,0.18]Cachet brisé récemment…[/colour][/i]"

    rich:setText(txt)
    rich:paginate() 

    local btnH, btnW = 26, 120 
    local btnX = (W - btnW)/2
    local btnY = H - btnH - 12
    local closeBtn = ISButton:new(btnX, btnY, btnW, btnH, "Fermer", win,
        function()
            if win and win.removeFromUIManager then win:removeFromUIManager() end
        end)
    closeBtn:initialise()
    closeBtn.borderColor     = { r = 0.85, g = 0.70, b = 0.25, a = 1 }
    closeBtn.backgroundColor = { r = 0.20, g = 0.12, b = 0.05, a = 0.8 }
    closeBtn.background      = true

    win:addChild(closeBtn)
end
willow tulip
frank elbow
willow tulip
#

Neat.

frank elbow
willow tulip
#

reminds me of the time I figured out that in foundry, since... the entire thing is a web app, you can say [img] tags and put meme gifs into your speech bubbles.

#

Icons? nifty.

bronze yoke
#

oh wow, i never knew about that page

willow tulip
#

I may very well use this information just to make my 'Please reinstall realistic car physics' error message realllyy fancyyy.

frank elbow
#

I've used it as a reference for a while now, idr when it was introduced

willow tulip
#

with icons, and blackjack. Infact forget the error message.

frank elbow
#

Should probably note that not everything is available everywhere; the settings on the TextDrawObject it's being drawn to dictatates what can be used (if you can get a reference to it then you can just change the settings, if you really wanted)

#

See TextDrawObject.readTag for details on the tags

willow tulip
#

getPlayer():Say("*battery* *meatpatty* *red* staple")

frank elbow
#

Also for completeness, the code that goes from those chat icons & colors to the BBCode-esque format is in ChatUtility.parseStringForChatBubble

willow tulip
#

Neat.

frank elbow
#

Where is the correct horse

willow tulip
#

shrugs

#

me being silly.

#

So of course now the problem is PZ doesn't have a list of emoji icons

frank elbow
#

You'll also notice that using an icon after a color ends the color, since they all unfortunately share a closing tag

#

You can generate a list—I use it for populating icon suggestions

#

I'll grab the relevant code, one sec

#
local loadedIcons = false
local iconToTextureNameMap = {} ---@type table<string, string>

---Collects valid icons and builds a map of icon names to texture names.
---@private
function utils._loadIcons()
    local dest = HashMap.new()
    Texture.collectAllIcons(HashMap.new(), dest)
    iconToTextureNameMap = transformIntoKahluaTable(dest)
    iconToTextureNameMap.music = 'Icon_music_notes' -- special case for 'music'
    loadedIcons = true
end

Probably goes without saying, but the results of this should be cached

willow tulip
#

Hmm, doesn't exactly look like I can add my own textures to that?

frank elbow
#

No, unfortunately the allowlist for the chat is a private field

willow tulip
#

public static Texture getSteamAvatar(long steamID)

#

Hmmm.

frank elbow
#

Used for the player list on steam servers, probably

willow tulip
#

PZ Multiplayer mod: adds the avatar of all your friends overtop the zombies heads. /s

#

"Ok but how do my friends play" "they get to watch on discord, as a zombie they have no control anyway"

bronze yoke
frank elbow
#

This is the second time you've reminded me of this

willow tulip
frank elbow
#

Actually I'm unsure it matters in this case because I don't think ChatUtility is exposed, either

#

But if I'm wrong about that, what you want is the allowedChatIcons & allowedChatIconsFull fields there

bronze yoke
#

ah yeah, unexposed and uninstantiated, you're screwed

willow tulip
bronze yoke
#

sometimes you can get really silly and chain field reflection into an unexposed class and then get its fields, but this class isn't meant to be instantiated and you do need an instance for that

frank elbow
#

I think technically you can get a reference to the player chat bubble's TextDrawObject (via the ChatElement) to just draw icons directly but iirc it cycles through different instances of them so you'd have to do it in a bit of a cursed way

willow tulip
#

See collectAllIcons

#

it gathers everything from s_sharedTextureTable

#

that has Item_/Container in its name

frank elbow
#

You'd have to do it before the ChatUtility initializes its maps

willow tulip
#

Im wondering if you can just getSharedTexture early enough to get on the list?

willow tulip
frank elbow
#

Actually I think you may be in luck

willow tulip
#

I have extra fun in my realistic car physics mod: I can't be sure my java class has loaded until at least 1 car has spawned.

#

(or not loaded, as the test may be)

#

(my LUA part of the mod tries to detect if you properly installed the java part of the mod)

frank elbow
#

Gotta love problems like that

willow tulip
#

I used to detect when you get into the car...

#

But fun fact, if I screw up badly enough at my job, the game crashes when you get into the car...

#

And then I kinda need the mod to be able to tell you to update the java part.. before it crashes.

knotty stone
#

always fun when you animate car parts and the last one doesnt work for no reason 😄

icy night
willow tulip
#

My M.2 SSD only reads/writes zomboid saves at 1.2Mbyte/second due to the 100,000 3kbyte files instead of it being 3000 100kbyte files.

#

(Benchmarked speed: 3600mbyte/second for large files)

twin gull
#

Hello everyone! I’m just starting with modding and would really appreciate some guidance. I’m trying to create a “berserk” mode:

It triggers when a zombie hits me.

Strength increases by +3 for 60 seconds.

Afterwards, strength returns to normal and the “agitated” status is applied at maximum.

Berserk can’t be activated again for 24 hours.

If anyone could give me tips on how to implement or test this, I would be very grateful.

#

i have this but have some problem

#

require "ISBaseObject"

local BERSERK_DURATION = 60
local BERSERK_COOLDOWN = 24 * 60 * 60
local STRENGTH_BOOST = 3

local berserkData = {}

local function activateBerserk(player)
local playerId = player:getOnlineID()
local data = berserkData[playerId] or {lastUsed = 0, active = false}
local currentTime = os.time()
if data.active then return end
if currentTime - data.lastUsed < BERSERK_COOLDOWN then return end

data.active = true
data.lastUsed = currentTime
berserkData[playerId] = data

local originalStrength = player:getStats():getStrength()
player:getStats():setStrength(originalStrength + STRENGTH_BOOST)

local function endBerserk()
    player:getStats():setStrength(originalStrength)
    player:getBodyDamage():setStress(100)
    data.active = false
    berserkData[playerId] = data
end

getGameTime():AddEvent(endBerserk, BERSERK_DURATION * 60)

end

local function onPlayerHit(attacker, player, damage)
if player:isZombie() then return end
activateBerserk(player)
end

Events.OnPlayerHit.Add(onPlayerHit)

bright fog
#

Did you AI generate this ?

twin gull
#

Yes, I only know how to program in Python and out of curiosity I'm getting interested in this modding thing but I don't understand much. I'm with AI but I think it's not helping me with the events thing from what I understand and I can't find a site with examples to be able to understand a little.

twin gull
# bright fog AddEvent for game time isn't a thing

Do you know of any page where I can find scripts to see as a reference and perhaps a page to see what events there are so I can study them? Perhaps it would be very helpful and I would appreciate it a lot.

frank elbow
bright fog
#

And like Omar mentioned

#

See the VSCode page, as well as Umbrella (modding) page

#

Check out the pinned messages in the channel too

#

They can link to more general stuff too

small topaz
round kiln
#

who should i contact about this, if im not gonna do the email first

sour island
round kiln
#

been 3 years since it got updated

#

i did try asking but its been a few days, and will probably never respond, as ive seen plenty of comments in his mods and his profile asking for updates

sour island
round kiln
#

this was mod that was made by someone that is then continued by a different modder, and then continued by another different modder

sour island
#

Considering this mod isn't even original, you're probably safe to update it - I'd just suggest crediting the prior authors.

round kiln
#

im rewriting the code myself so i learn the basics but

sour island
#

Did the very original mod get removed, I don't see it

round kiln
#

the old mods are either removed, private or unlisted

#

i think it dates back to b40

#

which is so long ago

#

the main thing is that im gonna use the 3d assets he made, and the rest i'll do myself

sour island
round kiln
#

of course

#

i will credit him for the 3d assets

#

and also making hte mod

sour island
#

Just covering the basics - as there was a case of someone not doing that recently. 😅

round kiln
#

oh and this is the 2.0

#

seems to be unlisted

#

still have it in my workshop files lol

sour island
#

The 3.0 is written by @zealous wing

#

I recognized his other mod and had to do a double take / checked his old steam names

#

But yeah, in general if the person is no longer active - and hasn't explicitly said no somewhere- then offering credit is the safest approach.

round kiln
#

is it possible to have multiple itemmapper in recipes?

#

oh u can have multiple, im checkign the recipes rn cause i need to make use of it as well

bright fog
#

I think it was @vast pier that tested it ?

round kiln
#

saw a vanilla recipe called Make4Bowls that has two itemmappers in recipes cooking

bright fog
#

I don't remember exactly how it worked but it made it not work in some cases if I rememer right

livid haven
#

so if i bump this to say 400 will this change all trunks to 400?

bright fog
livid haven
#

so i swapped to this one

#

but its not doing what i want it to do

#

it is now. messing with it some more tells me that only the second value should be changed haha

small osprey
#

Haha love your post. Thanks for either being so creative writing yourself or cohesive humor department having your back. We'll not gnaw too hard on you. Speaking for myself at least.

willow tulip
#

(once you actually fill the trunk up, that is)

willow tulip
willow tulip
#

Do warn, it might result in vehicles ET'ing off into the sunset...

#

Prob will just add a toggle for this 'feature'.. and considered 2 ways of making it 'work'

#

car goes "my people need me" on the very next test

willow tulip
# livid haven yayyyy

feel free to join vc if you want to give support and see cars fly off into the sunset.

#

Ohh that time it only sorta floated off into the sunset.

dreamy tusk
#

Hi, I want to make a mod that adds a couple of books for b41, how do I start?

bright fog
#

Readable, like actual text the player can read or just a book the player character can read to reduce stress, boredom etc ?

dreamy tusk
#

Basically port the new skill books (aiming, maintenance, reloading) from b42 to b41

bright fog
#

You can check these out

dreamy tusk
#

So I'd like to make my own

#

I actually want to make a lot of mods, this one seems like an easy way to learn

#

I think what I'll do first tho is to download those other mods that already add books and study their code

livid haven
finite scroll
#

is it considered bad practice to use object mod data?

#

my concern would be other mods trying to write mod data to the same object and things getting horribly messed up for both mods

bronze yoke
#

don't put anything in there you don't need to, but no

#

keep your keys reasonably unique and there shouldn't be any conflicts

finite scroll
knotty stone
#

anyone got an idea why the 1st one wont work?

willow tulip
willow tulip
knotty stone
# willow tulip Check your console.txt for stack trace errors?

sadly there is nothing i added a print and it show and thats all

LOG  : General      f:0, t:1761414027052> IsoMetaGrid.Create: finished scanning directories in 0.053 seconds
LOG  : General      f:0, t:1761414027098> IsoMetaGrid.Create: begin loading
LOG  : General      f:0, t:1761414027099> VehiclesDB2.init() start
LOG  : General      f:0, t:1761414027103> VehiclesDB2.init() end
LOG  : General      f:0, t:1761414027103> triggerEvent OnInitWorld
LOG  : Lua          f:0, t:1761414027108> using spawn region Echo Creek, KY
LOG  : Lua          f:0, t:1761414027110> 5 possible spawn points
LOG  : Lua          f:0, t:1761414027118> [\Saleen281]     we did some things
LOG  : General      f:0, t:1761414027119> SandboxOptions.load() start
LOG  : General      f:0, t:1761414027123> SandboxOptions.load() end
LOG  : General      f:0, t:1761414027123> ItemPickerJava.Parse() start```

The mouser over tooltip work its just the pictures arent working somehow
#

oh fk me

#

i really should take a brake

willow tulip
knotty stone
willow tulip
#

hahah.

#

Yea I didn't see it either!

#

Goddamn minor dyslexia strikes again. -_-;

#

I even looked right at that..

knotty stone
#

yea working, time for a break, lol

willow tulip
#

Nice ❤️

#

Also, yay at seeing my mod in the wild.

knotty stone
#

Only issue with ur mod is that I am not able to do horsepower upgrades cause it's resetting it.^^ But with your better engine parts the horsepower gain is enough.

finite scroll
#

does anyone know how to find the index of a hotbar slot by its type name?

finite scroll
#

alternatively any way to get an indexed list of the player's current hotbar slots is close enough for me to get there

edit: found a solution to do this, it's a little bit below this message

#

a way to set an item's attached slot by the type instead of in index would also work

bronze yoke
#

<@&671452400221159444>

pearl prism
#

Is there a tutorial on how to make mods to use with Forge?

#

I'm struggling all day to make it work.

bronze yoke
#

forge?

sleek canopy
sleek canopy
knotty stone
#

Project Summer Car

sleek canopy
knotty stone
sleek canopy
bright fog
#

I mean the only framework mod I know of that has "Forge" in its name is my Zomboid Forge framework

finite scroll
#

for anyone in the future with this problem:
local hotbar = player:getModData()["hotbar"]
for i,v in ipairs(hotbar) do
print(i," - ",v)
end
should print an indexed list of the current slots

finite scroll
#

i'm setting the notAvaliable parameter of a context menu option like this:
local option = context:insertOptionAfter(getText("ContextMenu_Attach"), getText("ContextMenu_SlingAttach"), specificPlayer)
option.notAvaliable = true
but it doesn't seem to actually make the option unavaliable

#

does anyone know why? (b42, if it's relevant)

mellow frigate
finite scroll
#

that makes sense

proud fox
#

can you check it out?

#

I’ve been busy fixing errors for the past few days.

willow tulip
willow tulip
#

Mod idea: adds a new option to recite a haiku about how you will not stab yourself with glass due to a misclick between 'remove glass' and 'jump through window'

#

(on the right click context menu for windows)

knotty stone
#

you got bad experience? ^^

small osprey
#

Coming back to this I decided to keep rolling my own and its now "ready".

🧰 SceneBuilder, a small Lua framework for spawning little in-world scenes (b42).
corpses, containers, clutter, whatever — providing a simple DSL.
Go ahead If you want to us it or colab with me 👋 .


Scene:begin(roomDef, { tag = "demo_lab" })
  :deterministic(true)
  :anchors(function(a)
    a:name("AnywhereInRoom")
     :where("any")
    a:name("deskLike")
     :where("tables_and_counters")
  end)
  :corpse(function(c)
    c:outfit("Agent")
     :onBody("Bag_ToolBag", "Screwdriver")
     :dropNear("RemoteCraftedV1", "Speaker")
     :blood({ bruising = 4, floor_splats = 20 })
     :where("any", { anchor = "deskLike", anchor_proximity = 2 })
  end)
  :container("Bag_Schoolbag_Travel", function(b)
    b:addTo("MoneyBundle", "Whiskey")
     :where("tables_and_counters", { anchor = "AnywhereInRoom" })
  end)
  :scatter(function(s)
    s:items("Notepad", "Pencil")
     :maxPlacementSquares(3)
     :where("any")
  end)
  :spawn()```

It borrows surface definition ideas from [ItemStories B42](https://steamcommunity.com/sharedfiles/filedetails/?id=3569303590) and includes a minimal SpriteDimensions polyfill, so the two play nicely together. CC @jovial harness .

Mostly meant as a helper lib for other mods, not really a mod on its own (still thinking about that though).

Any thoughts from folks who’ve built library-style mods - would you also publish it as a regular mod, or just keep it as-is for people to include if they want? It's MIT.
bright fog
#

People shouldn't include your mod inside their own, that's going to pose problems in the future, with file clashes

#

That's what Item Tweaker did and this is a terrible idea

small osprey
bright fog
#

That's problematic

small osprey
#

Understood. So I'll get into the publishing rabbit-hole. Never did that. Cool thanks man 🙂

bright fog
#

I'm gonna be honest like this shit is horrible 😭

small osprey
#

elaborate? 🙃 Or you mean the "include"?

bright fog
#

Or at least the way you write it down

bright fog
# small osprey elaborate? 🙃 Or you mean the "include"?

Not the include, tho idk what you're talking about exactly, if you mean the module that's normal
I'm talking about the way you type stuff, starting with :
Which I know is to pass self, but that's absolutely not a classic way of writing Lua and I can assure you the majority of modders that might be interested in your framework are not going to understanding shit about the way you typed that code

#

Scene A one-shot composition combining multiple placers; committed via :spawn().

#

For example

#

Telling people to use :spawn() will make absolutely zero sense to them 😅

#

Scene:begin(roomDef, { tag = "demo_lab" }) returns an object, which this object you call :deterministic(true) which is a true false condition, and seems to be a setter for a boolean, then you call :anchors(...) on it which uses the return of deterministic, but that makes zero sense to write things like that because it makes no sense for deterministic which is a bool setter to return something ? And it's even unclear what it actually returns

#

Let me retype that in a way clearer way that should help modders understand wtf they are doing here

#
local Scene = require("SceneBuilder/core")

local scene = Scene:begin(roomDef, { tag = "demo_lab" })
scene:deterministic(true)
scene:anchors(function(a)
  a:name("AnywhereInRoom")
  a:where("any")
  a:name("deskLike")
  a:where("tables_and_counters")
end)

scene:corpse(function(c)
  c:outfit("Agent")
  c:onBody("Bag_ToolBag", "Screwdriver")
  c:dropNear("RemoteCraftedV1", "Speaker")
  c:blood({ bruising = 4, floor_splats = 20 })
  c:where("any", { anchor = "deskLike", anchor_proximity = 2 })
end)

scene:container("Bag_Schoolbag_Travel", function(b)
  b:addTo("MoneyBundle", "Whiskey")
  b:where("tables_and_counters", { anchor = "AnywhereInRoom" })
end)

scene:scatter(function(s)
  s:items("Notepad", "Pencil")
  s:maxPlacementSquares(3)
  s:where("any", { anchor = "AnywhereInRoom" })
end)

scene:spawn()

#

Even then you can clearly see that it is unclear what function runs on what object, like in anchors I think I did a mistake and where isn't ran on a

small osprey
# bright fog Not the include, tho idk what you're talking about exactly, if you mean the modu...

Hehehe well that is the point of a DSL. Its not a simple API ;). Every call returns the SceneBuilder. It is a very opinionated style, thats for sure 😄 and I came here to learn, and ready for roasting as well. Its what happens when you push stuff out there. 😉 So overall I am ok if it keeps a user base of 1 lol.

But yeah that rewrite of the examples looks cleaner!
Doesn't help to expose the internal state though.

Like, when you "enter" a placement via scene:container you should not do some things that only belong to a corpse e.g. call :outfit

bright fog
#

I don't know where you picked up this typing from, but I highly advise that you just don't do that and follow classic Lua code writing 😅

bright fog
#

I don't know what DSL is either, but that's not a reason, Lua stays Lua, you can do weird stuff like that but at the end of the day you're writing Lua, and if you don't follow the classic way of how Lua is written, you're going to alienate modders from using your stuff. And imo writing a framework for it to not be used by anyone doesn't make much sense, even from experience on my end where I've made frameworks

#

What I'd do is keep your example in a classic writen way, that way you know any Lua modders will understand what you wrote down, do a proper documentation of what function is what and returns what
And then give a more advanced example to writing that code with the format you share in your repo currently

small osprey
#

Cool I get your feedback. I appreciate the thoughts a lot 🤗 . Especially the part about maybe breaking up blocks and writing out the Scene object explicitly. Not entirely unexpected too ;).

It looks foreign I know, but to me from a scene authors perspective (ignore the coder-needs for a second) I feel I can reason better about what happens in a scene.

And to push back a bit against "But other languages" we see the fluent API pattern there in many places. Whether that is overall a good pattern or not I understand may be polarizing :D. Unity has a "GameObjectBuilder" etc. Jquery does it all the time $("#panel").fadeIn(200).addClass("open").text("Hello");

So to me there are distinct points here:

  1. Are fluent APIs good and when
    1.1 In general
    1.2. In PZ modding specifically

  2. Did the fluent API I built do a good enough job and if not what could be improved save a rewrite of the API towards a more traditional approach 😅 . Very likely there are issues here, especially around state and placers. In any case I'd probably not want to support two different styles unless its just sugar that is easy to carry.

I think I'll flesh out more of the contents of the lib just for my own purpose and see who has overlapping need or would help simplify/vanilla-fy 😉 parts

p.s.: Returning a "corpse" or "container" object instead of passing another function in may be an obvious improvement!

bright fog
# small osprey Cool I get your feedback. I appreciate the thoughts a lot 🤗 . Especially the pa...

I think the way you do it is fine, the other way I'd do is instead of calling various functions for various elements, I'd have a table which holds the scene elements. For example

local scene = {
    tag = "demo_lab",

    anchors = {
        {id = "AnywhereInRoom", type = "any"},
        {id = "deskLike", type = "tables_and_counters"},
    },
    corpses = {
        { -- index 1
            outfit = "Agent",
            onBody = {"Bag_ToolBag", "Screwdriver",},
            dropNear = {"RemoteCraftedV1", "Speaker"},
            blood = { bruising = 4, floor_splats = 20 },
            where = {
                type = "any",
                anchor = "deskLike",
                anchor_proximity = 2,
            }
        },
    },
    containers = {
        {
            id = "Bag_Schoolbag_Travel",
            onCreate = function(b) -- this part could be changed to use a table of actions too, but an onCreate function would fit the vanilla scheme too
                b:addTo("MoneyBundle", "Whiskey")
                b:where("tables_and_counters", { anchor = "AnywhereInRoom" })
            end
        },
    },
    scatter = { -- unsure what this does exactly, so you see how you handle that as a table
        ...
    },
}

Scene:addScene(roomDef, scene)
drifting ore
#

Both ways make sense to my caveman brain, but ^ is definitely more what I would expect

#

Either way, how can I use the framework? Do I need to install a separate mod or what?

#

Never used anything like this before

bright fog
bright fog
#

He didn't knew if he had to make a mod for it or have modders distribute it in their own mod, which I told him other modders shouldn't include framework mods inside their own mod

drifting ore
#

I'd love to make some scenes for Reefer Madness and give you some feedback as a first time user

drifting ore
#

My mod

small osprey
#

So the argument with the table is then the "configure as JSON or as code" that debate shows up in every major platform that evolved toward declarative tree builders: JSX (React), Gradle, Terraform, SwiftUI, Jetpack Compose, etc.

Tables work when

  • The structure never changes at runtime,
  • No logic or conditions are needed,
  • Everything is known in advance,
  • You’re happy to reload the entire tree if something changes.
    This is why JSON is great for configuration, but terrible for composition or generation.

Executable "tree builders" (which the SceneBuilder tries to be) try to solve that

btw some background

And shared criticism which exists plenty also :

#

There is a more than fair point to be made about dillisions of grandeur 😅 . How expressive and powerful does this need to be even! I want to find out.

  • Place a body that dragged itself 3 tiles from a door, blood trail should be extra thick, Near that body place a loaded gun. A police zombie stands 5 tiles away.
small osprey
drifting ore
#

No rush, I will keep an eye out 👍

small osprey
#

Looking at your <B42>Reefer Madness if your idea is to populate the world with, well, reefer-rooms 😄 then itemstories might be a more straightforward thing for you. It is very config based and works with some mods too illustrated in the RideablesInGarages.lua

    name = "RideablesInGarages",
    storyWeightChance = 1,
    items = {
        -- filled in later
    },
    chanceOnFloor = 3,
    chanceOnFurniture = 0,
    furnitureMinOffsetZ = 60, 
    furnitureMaxOffsetZ = 90,
    itemCountPerTileMin = 1,
    itemCountPerTileMax = 1,
    maxStoryCountPerRoom = 1,
    rooms = {
        garagestorage = 0.6,
        garage = 0.5,
        shed = 0.1,
        storage = 0.2,
        basement = 0.2,
        sportstorage = 0.2,
        sportstore = 0.2,
        storageunit = 0.5

    },
    spritesMatch = false,
    sprites = false,
    spritesToIgnore = false,
}```

You may want to spawn weed supplies in some types of rooms?
But I wouldn't know if/how you could extend the mod
bright fog
small osprey
#

I appreciate our exchanges and hearing opinions. It's the way I grow. I hope I can lead nobody astray :).

drifting ore
#

I have item defs already if that's what you mean. I want the player to enter a house that was clearly previously inhabited by stoners, I haven't looked into item stories though

bright fog
#

Modding is not the same level of programmation that you'd expect for other projects, for the most part it's people that have a vision to bring to the game, and providing a framework for story events is great but it needs to be adjusted to allow those type of modders to use it

#

But that doesn't mean it can't get complex for more experienced programmers, it can still have a wide range of options for modders to play with

small osprey
#

100 agreed with all 🙂

bright fog
#

But it needs 2 level:

  • simple
  • more advanced
#

Also maybe you'll want to provide an event to hook to

#

Like currently this is a manual trigger for a story, and while that's great, there needs to be something for modders to add events basically in my opinion

#

So you could have house events, forest events etc

#

That modders can add their scene behavior to a list of events to possibly trigger

#

Could have a conditional function too

#

Also might want to make sure not multiple stories can be triggered in the same place

small osprey
#

Yeah it might help. Thats one "layer" above that I don't touch at the moment. Like, world-lifecycle (ItemStories does that).

bright fog
#

Could just be on first generation

#

New area gets loaded, possibly trigger an event

#

From a list of events other modders provided

#

At least it seems to be what other modders want when it comes to triggering custom events on the world, so they can add their own stuff like that camping event, car events etc

small osprey
#

Absolutely. And I understand the need. Lets say I build a scene, do I want that to play in every bathroom in knoxville? Which ones then? In kitchens too? Dependent on days that passed? Well no idea. you tell me. Currently for me that is out of scope. I cover "Tell the engine what to place and where in a room" - Others can decide "When and where in the world" haha.
Thats another builder/tree/event-system, if you want to go so far. But ideally I wouldn't mash that all together into one mod/lib. Have some choice in "What builder to use" and "What engine for world events and macro places".

Different mod/logic 😄

I simply want to build bespoke scenes with some limited variety for my story mod. Tired of vanilla calls and boilerplate.

drifting ore
drifting ore
small osprey
#

By all means Bjørn as long as you replace it later by the mod version so we avoid users getting weird crashes, clone the repo and play with it. send PRs 😅 . I'll dig through the publishing process.

#

Maybe just for testing, not including in your releases.

#

I think the chance you find something lacking is very high anyway.

drifting ore
#

I'll definitely do that, and yeah I ofc won't release an update with anything in it until I can have your mod as a dependency on my workshop page

small osprey
#

deal.

mellow frigate
bright fog
willow tulip
#

.. or declaring a global

#

lua is just like "oh, variable iv never heard of before? you must mean to declare a new global!"

#

local foo = "hello world"
print(bar) is perfectly valid LUA syntax.. where the 2nd statement declares the global bar and reads its value, nil

icy night
#

Hey all. I am trying to make a trait that adds recoil after shooting via making the player stagger or fall backwards. But I'm having a problem where the aiming reticle remains stuck until the player recovers from the fall. So the player contorts their body to look at what their aiming at still. Any ideas of how I can cancel the aiming effect after initiating the staggering effect?

shell holly
#

hi ! Is there a visual way to display suqare and chunk without coding?

icy night
#

heres a pic for reference lol

willow tulip
bright fog
willow tulip
#

you have to explicitly prefix a variable name with local, if you want to declare a non-global.

bright fog
bright fog
#

I think this is how if I remember right

#

Trigger it before the fall and it might work ?

bronze yoke
willow tulip
#

🙂

bright fog
bronze yoke
#

black moons start using a language server already 😭 this is a solved issue

bright fog
#

@willow tulip you're still not using Umbrella ? 💀

bronze yoke
#

most have the option to show globals as errors, and emmylua even colours globals differently

bright fog
#

Do you know when the switch to emmylua will be ?

#

Or can we already use it ?

bright fog
bronze yoke
bronze yoke
#

the main one that was bugging me was that it didn't support overloaded global functions

#

so for example, getText has like five overloads, one for each number of arguments -- it would only recognise one

#

my newer type annotations that take advantage of emmylua's new features are more or less ready for release but i want to do a little more polish before replacing what's already in umbrella: but if you want to try them i don't mind posting them

bronze yoke
#

the global namespace is a plain regular lua table, it just indexes it with "bar" and returns the result

#

i was reading a paper about lua the other day and they used the phrase 'lua does not have global variables, but it pretends very hard that it does'

#

anyway here is why you should be using a language server instead of shooting in the dark for literally no reason: globals are red and it considers defining them in most scopes an outright error

#

you can probably get it to consider all global definitions everywhere an error, luals which i'm not using has that option, but i haven't looked

mellow frigate
bronze yoke
#

maybe that's the perspective of someone who's already seen this kind of design and already knows how to read it though

small osprey
#

Tough luck typehinting though, sim (aka Doggy???) is very right in that. I tried hard but gave up so no mouse-over for most calls in the build scripts.

bright fog
#

Typings are easy to set up for your stuff tho

#

You need to define classes for your objects

#

And make sure to return your class which holds the functions

small osprey
#

Yeah I know the principle. And there is a wild and dirty 😅 definition file for that in use but I somehow didn't manage to make it work. I shall give another attempt when my stamina for that activity has recovered unhappy

bronze yoke
#

i noticed a file with a bunch of @field ... fun declarations, the language servers don't really handle this kind of definition well, the best convention is to just define them in a table even if that table isn't needed at runtime:```lua
-- i like to prefix the name with __ to indicate that it is intentionally unused
---@class MyClass
local __MyClass = {}

---function description
---@param bar number description
---@return number # description
function __MyClass:foo(bar) end

bright fog
#

Can you please add lua after the first 3 `

#

So it's easier to read for us

shell holly
#

oh yes sorry

bright fog
#

You shouldn't do those checks

if Events and Events.LoadGridsquare and type(Events.LoadGridsquare.Add) == "function" then
bronze yoke
#

are you using ai? ai adds these kinds of checks everywhere and they make it very difficult to read

bright fog
#

Just edit your previous messages, that'll be simpler man Depressed

shell holly
#

i learn with chatgpt I had no knowledge a week ago

bright fog
bronze yoke
#

all these kinds of checks do is mute errors, they don't make your code work -- they make it harder to debug because you don't have an error telling you what's wrong

shell holly
#

I read all your advice with pleasure.

bronze yoke
#

ai usually takes requests like 'fix this error' very literally and stops the error instead of fixing the code

bright fog
#

You sent the same two code snippets

#

Just delete these last two you sent, and edit your first code snippets with the lua thing

#

I meant your two last messages Depressed

#

You had sent two code snippets, now we only have one

#

Why do you bother checking if the player has moved ?

#

Where do you run this code ?

shell holly
#
local _OnGameStarted = false

-- Quand la grid se charge, on laisse le flag armé ou ou désarme
if Events and Events.LoadGridsquare and type(Events.LoadGridsquare.Add) == "function" then
    Events.LoadGridsquare.Add(function()
        --if isServer and isServer() then
           _OnGameStarted = true
            if SquareSystem and SquareSystem.OOS_TrackMovement then
                SquareSystem.OOS_TrackMovement()
            end
        --end
    end)
end

-- Abonnement posé au chargement, mais guardé par le flag
if Events and Events.EveryOneMinute and type(Events.EveryOneMinute.Add) == "function" then
    Events.EveryOneMinute.Add(function()
        --if not (isServer and isServer()) then return end
        if _OnGameStarted == false then
            return
        else
            if SquareSystem and SquareSystem.OOS_TrackMovement then
                SquareSystem.OOS_TrackMovement()
            end
        end
    end)
end```
#
-- Détection d’un vrai mouvement pour tous les players (on évite le “spawn initial”)
local function OOS_TrackMovement()
    -- if not (isServer and isServer()) then return end -- A décommenter en PROD

    local players = getOnlinePlayers()
    if not players then return end

    for i = 0, players:size() - 1 do
        local p   = players:get(i)
        local id  = p:getUsername() or tostring(p)  -- stable identifier
        local px, py, pz = p:getX(), p:getY(), p:getZ()

        local prev = OOS_LastPos[id]
        if prev then
            if prev.x ~= px or prev.y ~= py then
                OOS_PlayerHasMoved = true
            end
        end
        print(string.format("[SquareSystem] >> x: %d, y: %d, z: %d", tonumber(px), tonumber(py), tonumber(pz)))
        OOS_LastPos[id] = { x = px, y = py, z = pz }

        local cell = getCell()
        if not cell then
            -- do nothing
        else
            -- Get the coordinates of the secret message
            local secretX, secretY, secretZ = 13782, 13782, 0
            local sq = cell:getGridSquare(secretX, secretY, secretZ)
            if sq ~= nil then
                print("The square to drop the object is loaded")
                -- call client to spawn message
            else
                print("The square to drop the object is not loaded")
                -- return
            end
        end
    end
end```
bright fog
#

Remove those Events checks, that's completely useless like Albion stated

#

You're calling SquareSystem.OOS_TrackMovement() but OOS_TrackMovement() is a local, not inside SquareSystem

shell holly
#
local SquareSystem = require("SharedS_SquareSystem")
bright fog
#

Yes but you define

local function OOS_TrackMovement()
#

OOS_TrackMovement cannot be accessed outside this file scope

#

So require or not, you can't access that function at all

#

Which means that your LoadGridsquare hook doesn't trigger anything

#

Same for EveryOneMinute

#

And here you end up in a case where ChatGPT fucked you over because it checks if SquareSystem holds OOS_TrackMovement, but it cannot, and so it doesn't even trigger your code

#

I suggest you read two wiki pages in depth, so you understand what you're manipulating

#

Check the pinned messages of this channel too

#

Read those 3 pages, and come here when you have questions about something, be it during your reading or after

#

But I can assure you, do that and you'll understand better what you're actually doing here

shell holly
#

ok than you for this i understand 😉

small osprey
# shell holly i learn with chatgpt I had no knowledge a week ago

Tipp for learning with AI as a beginner: Ask the AI to give you code challenges in Lua, then solve them and present them to the AI and let it correct you. Tell it to stick to Lua 5.1. Tell it that you are an absolute beginner. Tell it to "think carefully" if the prompt returns after 1 second. If the code is not long or complex or quite zomboid-specific 😬 then it will advise you better.

And if it must be zomboid related, then tell it to consider https://pzwiki.net/ as a primary source. Also tell it explicit if you seek build 42 or build 41 instructions (same when you talk to folks here in chat, difference aren't small betweeen the builds). As soon as you don't understand what the AI gives you, stop. Ask it to explain. if you still don't get it ask it to break down the problem and give you links to primary sources.

Good luck.

sour island
#

The problem also comes from how LLMs and chatgpt function/work

#

The prompt you fed into it is all it has to go off of - it tries to "remember" other context but it doesn't do this well. So if you rely to heavily on chatGPT for too long you'll be building more skill towards getting an LLM to output more useful info than actually learning to just write Lua.

round kiln
#

i wonder if anyone has done a mod where its basically like "changes the item icons of certain mods to the artstyle of project zomboid" or something like that

bright fog
#

The hardest part would be to make the icons themselves tbf

round kiln
#

pretty much

#

"pz artstyle" is debatable

#

but i had seen older mods where the icon looks like a pixelated png of the thing lol

bright fog
#

yea answering that 10 years later

bronze yoke
#

cool, just extract this zip and then create .emmyrc.json at the root of your project with these contents, replacing PATH_TO_LIBRARY_FOLDER with where you extracted it to```json
{
"$schema": "https://raw.githubusercontent.com/EmmyLuaLs/emmylua-analyzer-rust/refs/heads/main/crates/emmylua_code_analysis/resources/schema.json",
"workspace": {
"enableReindex": false,
"encoding": "utf-8",
"ignoreDir": [],
"ignoreGlobs": [],
"library": ["PATH_TO_LIBRARY_FOLDER"],
"moduleMap": [],
"preloadFileSize": 0,
"reindexDuration": 5000,
"workspaceRoots": []
}
}

knotty stone
#

could be useful right? always wanted something like that

bright fog
#

Sounds cool yea

knotty stone
#

i went from a radius, to powering the entire building

drifting ore
#

So with your mod, generators will power the entire building they are placed by/in instead of a radius around it?

#

Or is this just a visual thing

knotty stone
#

right its powering the entire building

bright fog
#

Yea that's cool

small osprey
#

Sooner or later we'll get an advanced electrician mod that makes you lose your entire safe-house to an electricity fire because you over-amped one of your more shitty installations or thinner wires. Mark my words.

bright fog
#

lol for sure

#

It's technically already doable

bronze yoke
#

i've been working on something like that

bright fog
#

So that's your secret project 👀

bronze yoke
#

could be 🤫

midnight saffron
#

Hey dudes. Adding new crafting recipes in existing mod (for myself only ofc). Want to make new recipes disabled until learned. After adding needTobeLearn = true, to recipe and ResearchableRecipes to item. it still no context menu about reverse engineering item to unlock recipe. Could you help to understand, what i'm doing wrong?

both files has import from base

imports
    {
        Base,
    }
#

recipe:

craftRecipe ForgeMacheteBushBlade
    {
        time = 450,
        needTobeLearn = true,
        timedAction = MakingHammer_Surface,
        SkillRequired = Blacksmith:9,
        AutoLearnAll = Blacksmith:10;LongBlade:4,
        xpAward = Blacksmith:100,
        Tags = AdvancedForge,
        category = Blade,
        inputs
        {
            item 8 tags[Charcoal],
            item 1 [Base.SteelBar;Base.Katana;Base.Katana_Blade;Base.SwordBlade;Base.SwordBlade_NoTang;Base.MacheteBlade;Base.MacheteBlade_NoTang;RainsToolsandBlades.MacheteBushBlade;RainsToolsandBlades.MacheteBushBlade_NoTang;RainsToolsandBlades.MacheteBushBlade2;RainsToolsandBlades.MacheteBushBlade_NoTang2;RainsToolsandBlades.SawbackMacheteBlade;RainsToolsandBlades.SawbackMacheteBlade_NoTang;RainsToolsandBlades.CurvedMacheteBlade;RainsToolsandBlades.CurvedMacheteBlade_NoTang],
            item 1 tags[SmithingHammer] mode:keep flags[Prop1;MayDegradeLight],
            item 1 tags[MetalworkingPliers;Tongs] mode:keep flags[Prop2;MayDegradeLight],
        }
        outputs
        {
            item 1 RainsToolsandBlades.SawbackMacheteBlade flags[IsBlunt],
        }
    }
#

item:

item MacheteBushBlade
    {
        DisplayName = Bush Machete Blade,
        DisplayCategory = Material,
        Type = Normal,
        Weight = 2,
        Icon = MacheteBBlade,
        Tags = HasMetal;FullBlade;Sharpenable;ShowCondition;SmeltableSteelLarge,
        StaticModel = MacheteBladeForged,
        WorldStaticModel = MacheteBladeForged,
        ConditionMax = 20,

        Sharpness = 1.0,
        ResearchableRecipes = ForgeMacheteBushBlade;ForgeMacheteBushBlade2;ForgeSawbackMacheteBlade;ForgeCurvedMacheteBlade,
    }
willow tulip
narrow moth
#

hey guys. I had an idea to try and make a mod that makes a craftable/spawned handheld pushable log cart.
couldn't really find anything like it. is there such a mod like this?

#

kinda the same aspect as reduced wood logs weight but a lot more realistic and immerssive..

narrow moth
#

like a log cart that can easily load in 10-20 logs if not more

#

maybe a wooden one and a craftable metal one that can hold more

drowsy needle
#

I don't know how to make mods, but I remember seeing one I liked called "Littering" which would cause a bunch of consumable items to leave behind litter when used up. What would I have to do exactly to make a mod like that for B42? I don't know how to alter how vanilla items work

topaz tangle
drowsy needle
#

Oh?

finite scroll
#

was digging through 11 year old forum posts when i remembered i could just ask here:
how should I go about hooking a lua function to a function like ISDropWorldItemAction:perform()?

#

to be clear my goal is to run a function when the player drops an item but there doesn't seem to be an event for that, only one for when they're forced to drop one by tripping

bronze yoke
#
local old_perform = ISDropWorldItemAction.perform

function ISDropWorldItemAction:perform()
    -- do stuff before original
    old_perform(self) -- pass the implicit self parameter from : declaration, and any other parameters the function usually takes
    -- do stuff after original

    -- if the function normally returns something, you want to store and return that (or return immediately if you don't need to do anything after), but perform doesn't
end
small osprey
#

@finite scroll I looked into that a little ago and implemented a patch for ISInventoryTransferAction. b42 does a lot of stuff differently for transfering things than b41. The transfer lifecycle is not very transparent and I don't understand more than 20% of it. What I think however is that what function you want to hook into depends on what exactly you want to do. There isn't one good central place.

Example for preventing item dropping:

require("TimedActions/ISInventoryTransferAction")
local oldIsValid = ISInventoryTransferAction.isValid

function ISInventoryTransferAction:isValid()
    local data = self.item and self.item:getModData()
    if data and data.preventDrop then
        -- Only allow placing into main inventory
        -- optional allow in worn containers: instanceof(self.destContainer:getParent(), "IsoGameCharacter")
        if self.destContainer ~= self.character:getInventory() then
            print("[NC] Prevented transfer: this items modData says it can only be in main inventory.")
            return false
        end
    end

    return oldIsValid(self)
end
finite scroll
split dome
#

Any tried using chat gpt to make mods?

#

Anyone*

bronze yoke
#

many people, it's not very good at it

maiden anvil
#

Hey so I'm trying to follow a tutorial on how to make a map mod and I got to the part of getting the mod ingame and I can't seem to get the game to recognize it, did they change something about how that works in the past 3 years from when the tutorial came out?

bronze yoke
maiden anvil
#

ah that makes sense

#

complicates it al it for me tho as I struggle to learn without audiovisual tutorials

#

I'll try tho

split dome
#

Question does anyone know if it’s possible with b42 to create a mod that replicates the stalker anomaly’s?

maiden anvil
#

I have 4 tutorials opened and no clue what I'm doing
I regret even trying to do something

small osprey
# split dome Any tried using chat gpt to make mods?

I did. Takes much patience to get it to a level that it is (to me) net positive. If you have no background in coding it will be harder than it was for me for sure. The more zomboid-specific it gets the less will it work for you.

split dome
small osprey
small osprey
thin swan
#

AI for PZ modding works best if you already have a working prototype and then refactor/extend it with AI. But it will often try to overcomplicate things and make custom solutions for things that already exists and are available to use if you know where to look

stray arch
#

Okay I'm trying my best to eddit another mod by making it possible to use variables from the Sandbox settings... Is it possible in any way?

bright fog
#

Inside the scripts directly, no

stray arch
#

So there is no means to pass a parameter from the txt file?

stray arch
#

Simply said what's the approach here?

I'm trying to make a recipe where

  • I can dynamically change the value of the result using server values

Seeing another mod that adds recipes them coding into the game is just text files?

frank elbow
bronze yoke
#

despite the name, 'scripts' are not actually scripts, they don't execute, so there is no way to do anything dynamic with them such as using variables -- you need to use lua for anything like that

stray arch
#

So what am I missing? The recipe results in nothing now, the result item needs to be false even though im refrencing the funciton on create here?

#

The value in sandbox vars exists

bronze yoke
#

funciton

#

^ your file has this typo which is causing it to fail to parse

stray arch
#

Okay I should get some sleep maybe I'm getting too tired

small topaz
#

does anyone know what this stuff in your console means:
LOG : General f:9, t:1761606649307> [OreVein{startPoint=Vector2 (X: 2555.000000, Y: -1044.000000) (L: 2760.065430, D:-0.387907), amountArms=4, orientationArms=[201.37619, 293.34805, 380.85522, 471.36792], endPoints=[Vector2 (X: 2496.805176, Y: -895.322144) (L: 2652.477783, D:-0.344304), Vector2 (X: 2304.896729, Y: -1151.960205) (L: 2576.734619, D:-0.463478), Vector2 (X: 2670.535645, Y: -1347.268799) (L: 2991.135986, D:-0.467236), Vector2 (X: 2833.703857, Y: -934.957153) (L: 2983.960693, D:-0.318695)], distanceArms=[159.66135, 272.4098, 324.5312, 299.276], singleFeatures=[TileGroup[sx=1, sy=1, tiles=[crafting_ore_16]], TileGroup[sx=1, sy=1, tiles=[crafting_ore_17]], TileGroup[sx=1, sy=1, tiles=[crafting_ore_18]], TileGroup[sx=1, sy=1, tiles=[crafting_ore_19]], TileGroup[sx=1, sy=1, tiles=[crafting_ore_20]], TileGroup[sx=1, sy=1, tiles=[crafting_ore_21]], TileGroup[sx=1, sy=1, tiles=[crafting_ore_22]], TileGroup[sx=1, sy=1, tiles=[crafting_ore_23]], TileGroup[sx=1, sy=1, tiles=[crafting_ore_24]]]}]
is this normal output?

#

Other question: has a recent update to Zomboid re-introduced some memory leaking problems again? Happens for me on Linux Mint...

bright fog
#

Unsure

small topaz
#

seems to happen randomly for me

#

some games run ok with about 80% RAM usage but sometimes, I get >90% cases where the game crashes sometimes

bronze yoke
#

i haven't properly sat down and played 42.12, but i've noticed the memory usage climbs quite a bit over time when i'm testing mods

small topaz
#

happens for me when mod testing too. haven't yet checked it on vanilla but it is still suspicious

bronze yoke
#

in my mod testing though it only become noticeable after a couple hours -- but i don't usually have much need to be running around the world or anything, i'm usually just reloading a save over and over to test lua changes

small topaz
#

For me quite similar although I do not always reload an existing game. What I am repeatedly doing for testing is start new game -> quit game -> start new game -> quit and so. I have also the impression it gets worse the more often I do this but sometimes it can even happen if I just do it for 3 times or so. But have to test this more before I can really say smth about it.

#

--
currently have already 90% when just in main menu without any mods enabled so I guess there might me smth with the game (at least in debug mode)

#

other question: is
buildingDef_1:getIDString() == buildingDef_2:getIDString()
the right way to check whether two buildings are the same?

bronze yoke
#

buildingDef_1 == buildingDef_2 should work

manic viper
#

I'm trying to stop the game spawning burnt houses, but I can't seem to access the worlds RandomizedBuildingList. Using the get function just returns an empty array. Does anyone know what's going on? This is the code I've written (ignore the debug Print statements)

small topaz
# manic viper I'm trying to stop the game spawning burnt houses, but I can't seem to access th...

Interesting problem! I also tried doing this and I am currently using the command buildingDef:setAllExplored(true) OnNewGame event but not 100% if this does the trick since burnt houses a randomized. At least in my testing, I haven't had burnt buildings so far when using it. However, this command might also suppress other ranomized building things, so not sure if this could be appropriate for your situation.

Anyway, if you find a reliable way to stop houses from being burnt, I am eager to know!

bronze yoke
#

<@&671452400221159444>

hidden compass
#

Hey everyone!

I’ve run into a strange issue on multiplayer (Build 41). When a player obtains an item through a recipe, then drops it on the ground, the item becomes invisible to other players - only the crafter can see it. The recipe uses an OnCreate function where the item is added with player:getInventory():AddItem(). What’s odd is that this doesn’t happen with every recipe - some work fine, while others always trigger this desync issue, even though the implementation is basically identical.

Has anyone seen a similar case or found a reliable way to prevent this from happening?
Thanks in advance for any insight!

silent zealot
#

Otherwise, look at the code in RandomizedBuildingBase.getRandomStory() (called by RandomizedBuildingBase.ChunkLoaded() ) which is what pulls a random story from rbMap and then I guess you can learn about java map and iterators and stuff

silent zealot
#

Might also stops zombies spawning indoors.

karmic elk
#

Can anyone please point an utter newbie at PZ modding and modelling to a good modelling tutorial and how to do animations and get them working in a PZ mod?

I want to take someone's existing mod (with their permission) and edit their model to animate it (currently it has no animations) and make that animation trigger via the radial vehicle menu.

Eventually I want to create my own model (no idea how) and animations for that model and create my own PZ mod.

Any advice (other than get lost) would really be appreciated - esp of the 'hand-holding' kind.

Thanks.

#

Also, I'm struggling to understand how to find the type of tile a player is at so that when they swing the pickaxe I can change the ground tile from one kind to another - I can't find anything about this that makes any sense...

small topaz
silent zealot
#

Since they are "random" stories in game terms.

#

A lot of general categories like Office and Spiffo's are "Random" as well, but they have chance=0 and override the rules for activating

small topaz
#

disabling all this in a specific building is exactly what I need

silent zealot
#

If that case, you just need to set that one building to be explored.

#

Not sure if you can do that without the building being loaded in the active cell, or if you can sneak is some code that gets to it on load before the random building stuff triggers.

topaz tangle
bright fog
steady jay
#

Good morning everyone, I finally finished my wheel phone mod, and I also have the 3d model (thanks to a friend), but I can't get the host mode to start for a server with the mod.
It gives me a strange error, I don't want to delete all the mods (usually they recommend that) but I want to fix the mod I created to make the server start

bright fog
#

If I had to guess you have missmatch errors

#

Bcs your mod locally is different than the one on the workshop

steady jay
#

ok

steady jay
#

but in single player the mod work

#

here u can see the mod is actually loaded

#

and this is the error

steady jay
small topaz
small topaz
stray arch
#

I'm not getting it... Everything here seams fine, yet the recipe doesn't work. It does not recognize the necklace nor the atm

steady jay
#

right?

#

i need to pay 5$ to unlock my steam account... what scam...

bright fog
steady jay
#

yes, but on a key store

bright fog
#

It's not a scam, it's to make sure there's no bots or scammers

#

And it works very well

stray arch
#

Okay figured it out... chatgpt is sometimes smort... 50/50 his responses where valid... never coded in lua so that's a first....

steady jay
#

this is my mod, it work yeeeeh!!!

bright fog
steady jay
# bright fog Never said that, but Steam can't know that

The $5 thing is an excuse. I have 1,000 hours in PC. I don't think a bot would clock 1,000 hours, with achievements and even other games, on an account that's almost 4 years old.

Then there are people with verified accounts who get hacked, so scammers and bots can still scam.

It's a sneaky way to make money, but there are much worse ones, like the Playstore that wants you to pay for developer access.

frank elbow
#

Companies have plenty of sneaky ways to make money, but I'm not so sure this is an example of one

drifting ore
#

If you bought the game or any other one normally like 99% of other steam users then you wouldn’t have run into the issue. If you don’t have the money to do that, that’s fine, but to say Valve is doing to make money is absurd imo

#

Idk what country you come from but $5 has been almost nothing in the US for as long as I’ve been alive, at least

#

If you’ve used steam for 4 years and thousands of hours and haven’t run into any issues until now, then it seems their master plan for $5 is not going well

#

Sorry, $1.50 if 70% goes to the game developer

#

I thought I would have problems publishing my mod because I own the game on my alt account and play it through family sharing, but I can do everything fine except comment on any PZ content that isn’t mine and I also can’t download older versions of my own mods lol

compact imp
#

Hi everyone! I'm working on a mod that should unlock all crafting recipes for the player (only those that aren't tied to player skills), but I can't get it to work. Could anyone share tips or pointers on how to implement this?

small topaz
# compact imp Hi everyone! I'm working on a mod that should unlock all crafting recipes for th...

One way is to manually add all recipes to all professions. For example,

mechanics:getFreeRecipes():add("KnitBalaclavaFace")```
Problem is that it might not work for modded professions (depending on mod load order and on where exactly you put this code). Second problem could be that it is just a huge bunch of work (you can iterate through all professions but I am not sure whether you can also iterate through all recipes - if iterating through all recipes is possible, it shouldn't be much coding work).

EDIT: an alternative way could be
```player:setKnowAllRecipes(true)```
in lua code, see here: https://demiurgequantified.github.io/ProjectZomboidJavaDocs/zombie/characters/IsoGameCharacter.html#setKnowAllRecipes(boolean) . But possible that it also unlocks the skill-related recipes, so requires testing
compact imp
small topaz
#

Searching them manually together might also be problem. So best thing is trying to find out whether you can get a list of all them.

However, a lot of recipes should somewhere be listed within the recipe magazine's scrip.txt file, for example

    {
        DisplayCategory = SkillBook,
        Type = Literature,
        Weight = 0.5,
        Icon = Magazine_Survival1,
        BoredomChange = -20,
        StressChange = -15,
        Teachedrecipes = Herbalist;MakeStoneBlade;FireHardenSpear;MakeCrudeWhetstone;MakePlantainPoultice;MakeComfreyPoultice;MakeWildGarlicPoultice;BindSpear,
        StaticModel = Magazine,
        WorldStaticModel = SurvivalMag1,
        Tags = Magazine,
        OnCreate = SpecialLootSpawns.OnCreateRecipeMagazine,
    }```
#

Also, manually adding each recipe could really be unrealistic since there are pbbly 100s of them...

small topaz
compact imp
small topaz
compact imp
#

Just so you know, ChatGPT wrote this, not me… I have zero experience in modding 😅

small topaz
# compact imp

does this runs without any errors? (i.e. red boxes bottom right of your screen)

#

In general, chatGPT is prone to adding a lot of unnecessary stuff. For example, you call your function on two events but it should be sufficient to do it once. There is also this weird style of writing the whole function into the event call which is not wrong but typical chatgpt slop. Also not sure whether it is ok to not declare your functions local within the event calls...

compact imp
small topaz
#

You play with common sense mod enabled or are you specifically trying to change something within the common sense mod?

small topaz
#

So this error is caused by the common sense mod.

compact imp
bright fog
#

Dev your mod in a controlled setup

#

So you know only your mod can cause problems

small topaz
bright fog
small topaz
#

Also if player dies and then creates a new player in the same game world. But not when they just load a game...?

#

but let me test before I say smth wrong...

small topaz
compact imp
#

And of course checked the crafting menu to see if the recipes are there

small topaz
#

but I see, doesn't work for me either....

#

Just did some additional tests. player:setKnowAllRecipes(true) doesn't seem to do what the name of the command suggests for me. So you may have to try finding another solution...

frank elbow
frank elbow
#

Just noticed the new setStencilCircle in ISUIElement. Neat

willow tulip
frank elbow
bright fog
#

Like start the world

compact imp
small topaz
# bright fog I mean actually launch a save

I just tested it: for me it does not fire when you load a game with an already existing character. It only seems to fire when you create a new character and then enter a game with it for the first time.

bright fog
#

OnGameStart

small topaz
#

Ah sorry! I misunderstood! Thought you'd recommended to not run it every time the game starts (I misread your comment). My bad!

bronze yoke
#

don't use OnGameStart for that, use OnCreatePlayer

#

OnGameStart will only trigger for player one, and i don't think it will trigger again if they die and make a new character (not 100% on that part)

small topaz
#

Is it somehow possible to allow translating your mod's name and description in the in-game mod menu? Somehow via the lua/shared/translate files for example?

icy night
#

I've never seen that done before

icy night
frank elbow
icy night
#

Ah that's very cool

stray arch
#

Where could i find the sprite and texture of this item in PZ folders? I would need it for retexturing for a mod....

bright fog
#

Maybe it can use translation keys ?

frank elbow
#

I think any solution would require a mod to already be running on the main screen to apply the translations

bright fog
#

Ah yea it can't access translation keys if the mod isn't loaded in

#

That makes sense

regal umbra
#

Is it me or sandbox options booleans don't work

#

I.e by either on/off by default everything works correctly,

#

But then if the player tries to manually enable/disable the option the game doesn't register it

bronze yoke
#

you're probably reading the option too early

bright fog
#

Yea sandbox options work

bronze yoke
#

wait until OnInitGlobalModData to do things with them

regal umbra
bronze yoke
#

before

regal umbra
#

Yeah then it should be working

bronze yoke
#

are you caching the value anywhere or are you accessing the sandbox option directly when you use it?

#

e.g```lua
-- we're only actually accessing the sandbox option at file run, which is way before it's ready
local FOO_ENABLED = SandboxVars.MyMod.Foo

local function onCreatePlayer()
if FOO_ENABLED then
...
end
end

if so this should work better:
```lua
local function onCreatePlayer()
    if SandboxVars.MyMod.Foo then
        ...
    end
end
small topaz
regal umbra
#

well just setting is as a variable really then just checking if it's true or false

I.e my mod initializes when OnCreatePlayer is fired, which depending on the trait you have it initializes that trait's system, otherwise it won't, except for my addiction system which initializes without doing a trait check, however in the AddictionSystem.Init which is the function I call after OnCreatePlayer is fired it checks it by doing the former that you sent

I.e

local FOO_ENABLED = SandboxVars.MyMod.Foo

function AddictionSystem.Init()
if not FOO_ENABLED then return end
end
bronze yoke
#

yeah, that's why - you only actually access the sandbox option once, when the file first runs, which is way before sandbox options are loaded, so you just always get the default value

#

you can cache them during OnInitGlobalModData if you want to but it's not super necessary, they aren't expensive to access at all

regal umbra
#

Never had that happening tbf

bright fog
#

You can't have translation keys used from inside your mod if it's not loaded in

#

So that can't really work

bronze yoke
#

it could be added by TIS by creating a separate translation file for it or something but i don't think we can

#

not 100% but i don't think the mod file reader functions accept mod ids that aren't loaded

bronze yoke
#

it looks from the code it probably does actually -- would be way easier to just go in-game and check but i can't do that right now

willow tulip
small topaz
#

Since the mod menu reads the mod's title and description text from the mod.info file, it should be possible to arrange things so that your mod's info will simply contain different translations, like description_IT, description_FR for each language. Then it might even be irrelevant where exactly you put it. But is ofc smth which has (pbbly) has to be added from indie stone's side.

willow tulip
#

Leverage existing file readers and just expand upon it a little.

#

Might be doable in LUA, a lot of the UI stuff is LUA

#

but would be best for TIS to impliment so more then a few thousand people end up actually having the mod to use translated mod.info's -_-

bronze yoke
#

i'll look into it later and throw it into starlit if it works

#

now that i'm thinking about it i'm fairly sure mod manager used file readers so it probably does

small topaz
#

Has anyone figured out what the best resolution for your mod's screenshots is so that steam workshop on your mod's page can display them correctly (again...)?

willow tulip
small topaz
#

Really have no idea what the steam people did with the screenshot resolutions. It worked totally fine a few weeks ago and now everything is messed up.

#

For a screenshot size 1920x1080, it seems to be the case that the workshop crops it to around 1920x880 (and in the same ratios for other resolutions). But it simply crops the missing high of 200px out of the image (it is missing). When using a much smaller image like a typical workshop poster with 436x436, it enlarges it, crops and shows only a part of the image (according to rules unknown to me).

All this only when you click on a screenshot to enlarge it btw.

calm oxide
bright fog
#

It cuts them or doesn't properly fullscreen them

calm oxide
small topaz
# calm oxide In general workshop images 1920x1080 or 16:9 ratio looks the best so far from wh...

I think I mean the "workshop images" then ( = the preview images to showcase your mod).

Doing some offset works ok for me too in the current situation. I get good results by using 1920x1080 images and then making sure the actual image's content has height 880 while the rest of the image is black (or some other background). This looks ok in browser and also on my desktop steam client. Problem is that it looks not optimal on mobile phone since the images get too small then.

But as SimKDT said, it looks quite buggy to me too since a few weeks ago, everything worked fine. They just seem to have changed smth weird.

EDIT: typos...

calm oxide
# small topaz I think I mean the "workshop images" then ( = the preview images to showcase you...

Ok, just tried it — actually, you need to add solid black offsets to the left and right sides of the image. For a 1920x1080px original, it should be 2220x1080. In this case, on a 16:9 screen resolution, the full original height will be rendered. But the final rendering fully depends on the end-user setup (monitor resolution, OS control panel visibility, browser panel height, etc.). Probably Steam just updated the Workshop CSS recently, causing this weird rendering that uses full width instead of properly respecting the aspect ratio. Resolution probably doesn’t matter — only the image’s aspect ratio should be adjusted properly.

silent zealot
#

But if you do that you'll need to redo everything when steams fixes the image div to not crop the top/bottom.

#

People can live without the edges of my preview pics until then. 😛

calm oxide
silent zealot
#

Devs after the next "fix"

frank elbow
# bright fog What Omar said

What I meant up there was really that you'd need some mod running on the main screen to handle any new logic for displaying those translations

#

So if someone wanted to add it to their own mod without dependencies, it'd have to be enabled on the main screen for that to work (which seems like it defeats the purpose a bit, but not entirely)

willow tulip
#

@covert bough Just a heads up, an alt fix for chewing tobacco is add the StressChange = -10 it needs via DoParam

arctic depot
#

does the offical mod tool support basements and the new z height for buildings?

bronze yoke
#

no, the official mod tools are for b41

#

the community b42 tools are pinned in #mapping

silent zealot
#

When you say "basically identical" what happens if you use the same oncreate function from a working recipe (even if it makes the wrong item)? Then if that works use a copy of the function, then change it bit by bit into what you want and note exactly when it stops working.

#

Basically you have a working and non working example, so you can now make them as similar as possible until you know exactly which difference causes the issue.

karmic elk
#

Does anyone know the procedure to get a trailer 'hitch' or towbar working on a vehicle? There is a mod (Super Bulldozer) that the model has a visible towbar, but the meta data of the vehicle doesn't mention it and it's impossible to connect a trailer or other car to it to tow. So what's the process for adding this missing behaviour?

willow tulip
#

afaik its a pretty simple offset in the vehicle file, and description of what kinda hitch it is

karmic elk
karmic elk
willow tulip
karmic elk
#

And those numbers - do you need to use blender to measure the point where the towbar is on the model? Can you get those numbers some other way or are they just made up by eyeballing it and iterative trial and error?

willow tulip
#

shrugs theres a car editor thingy in debug mode.

karmic elk
#

Is there? I didn't know. Thank you so much @willow tulip

willow tulip
#

There is even a ragdoll editor.. i can't find it though, but iv seen the code!

karmic elk
#

@willow tulip Hi again.. Okay, so there is a mod called 'Super Bulldozer' for B42. I just looked in the vehicle files you mentioned and it already has that code block you shared. The model has a visible towbar... so by rights it should have everything it needs to tow another vehicle, HOWEVER when I use V to bring up the radial menu when I'm stood in the green box at the back of the bulldozer there is no '+' sign for me to select to attach it.

Do you have any idea what's wrong?

#

I wondered if it was like the semi trucks where you do the + from the in-car V radial menu, but alas, when you try that, it still doesn't show... so something else is required I'm guessing for PZ to allow a vehicle to tow another...

#

Also the 'Vehicle Mechanics pane for the SuperBulldozer doesn't mention a trailer hitch or tow bar... but other vehicles do...

#

In fact there is no 'Attachments' Category in that dialog for the bulldozer, so something must be missing in the scripts/lua I'm guessing...

bright fog
frank elbow
#

Ah, gotcha

willow tulip
willow tulip
#

@karmic elk One thing I'll note is PZ has very poor support for large vehicles, many of the largest vehicles iv seen are extremely difficult to get a vehicle to tow/hitch to as they have to be insanely close before the 'hitch' dialog will appear.

#

large vehicles like the BUS won't even let you open the mechanic menu if the bus is rotated a certain way IIRC

sour island
#

Wouldn't that depend on where you place the area for things?

#

I haven't messed with vehicle scripts in a long while, but I remember parts having area positions which determines where you can enter, view mechanics, access storage.

#

One of the military trucks has a hood that opens forward and you can only access it from the sides of the engine area

icy night
#

What's a good way to check if an item is a shotgun, whether vanilla or modded?

#

Perhaps tracking projectiles

sour island
#

I did something similar for Russian roulette to check for revolvers

icy night
sour island
#

I ended up going with checking if the gun isn't magazine fed, and has chambers I think - and maybe have a check for shooting type first(?)

icy night
#

Ok

#

The problem is that modders are getting very creative with their guns lol

sour island
#

Yeah, that's why I think you could have it check for a number of things as ORs

#

Put the most likely cases in the left so it returns sooner

#

If shooting type is shotgun OR ammo type is etc OR

#

Whatever is more likely to point to a shotgun

#

You could also add a tag check of your own - Incase someone wants to make their gun work.

At the end of the day you'll most likely miss something

frank elbow
silent zealot
# sour island Wouldn't that depend on where you place the area for things?

From dealing with headlights hovering in front of vehicles, you have problems on longer vehicles where the "headlights" can disappear underground when the vehicle tilts. I would not be surprised if there are similar problems with towbars.

There are also some things that are treated as "percentage of vehicle length" even though they look like absolute values.

silent zealot
#

All the vanilla shotguns use 9 projectiles (I.e. buckshot) Every modded shotgun I've seen has also been 9.

icy night
#

Is the SplatNumber the amount of blood?

silent zealot
#

Make it 100 times higher and find out!

icy night
#

Lmao, will do

stray arch
#

How would I be able to remove the prefix of Sandbox_ for each setting the same with the name of the mod setting page?

frank elbow
stray arch
#

Okay got it, simply said the same applies like in item/recipes for a translation

stray arch
#

Is there a function that checks if the player has x amount of items and then removes them?

I would like to dynamicly change the amount needed of a resource in settings rather then manually change it

#

or a pz mod page with all the funtions

#

As for context

bright fog
#

You can retrieve every items of a type from the player inventory

stray arch
#

is there a documentation about that at least so I'm not asking all the time...

frank elbow
#

Reading the source code of the game & other mods is a quick way to learn (unfortunately both have common anti-patterns which you're likely to pick up, so continuing to ask questions is a good idea). The wiki also has guides for some stuff & other guides are out there in different places

stray arch
#

Okay well then chatgpt and its ability to summerize and find info it is...

stray arch
#

Well read now how the recipy system (more so coding it into build 42 looks...) I will probably end up hard coding it and for now wait for build 42 to finish up this.

IE wanted to make an existing mod scalable so I don't need to send out a modified version each time we play on our server.... and probably later release the modified version...

frank elbow
#

I was going to suggest that but umbrella effectively covers it, and reading decompiled code is more helpful imo

#

So I will continue to recommend that people decompile it to see the actual behavior

bright fog
#

The Inventory class is massive

#

You need to check methods that are available

frank elbow
#

Difference of opinion 🤷 you can recommend that lol

bright fog
#

First JavaDocs, it's easier to see what's available

bright fog
frank elbow
#

No 😤 (perhaps)

bright fog
#

I'd rather teach people to read the JavaDocs than the source code, it's way easier

bronze yoke
#

as the host of the b42 javadocs i do actually agree that reading the source is better, the javadocs are just a little more accessible

#

also i don't have to open my ide to reference them, and for most people it also saves decompiling

bright fog
#

Regarding the inventory stuff, there's a huge amount of search and count functions

frank elbow
#

I do see the utility of it, it's just not something I personally use in my workflow

#

Fair point that it's good to inform people of its existence though, the "no 😤" was a joke if that wasn't clear

bronze yoke
#

i think level of experience factors into it, people who don't have much programming experience can't get much out of the source code and just navigating it will be difficult for them

surreal wave
frank elbow
#

I don't want to alarm you, but we can already mod the game

surreal wave
#

humble brag?

frank elbow
#

I also didn't notice that the question was specifically about the inventory, which I suppose would benefit from it due to its scale as SimKDT mentioned

stray arch
#

Either way just a collection of functionality would be neat, rather then as in PZ wiki "Ai will make shit up", more so I'm no game dev, I coded javascript for security a little and QA... documentation is king and that's it. Reading messy code will not help nor will a messy doc

bronze yoke
#

the main reason though that i'd want to point people to decompiled source code instead of the javadocs is the javadocs are only helpful if you can make the assumption that (because there is no documentation for almost anything) things are actually named correctly, and anyone who's been modding this game will tell you, you can't

surreal wave
#

^^

bronze yoke
#

if you can read the source code then you can verify for yourself what it actually does

frank elbow
#

I remember when I saw the name of a method that seemed like it'd be helpful then checked the decompiled code and it was a no-op

#

That was the day my sense of trust died

bronze yoke
#

you'd think they'd at least give it an @deprecated 😭

stray arch
#

Either way I'm halting my mod for 42's release of mp because how it just throws my efforts into the garbage (mainly just rewriting it) Logic should probably be the same (if they didn't change the functionality of their funciton calls)

#

besided reading the docs of 42's build about how crafting works, there is no way still for making it dynamic (still it needs ingredients) logic could/can remove them. Yet the input requirement just makes it impossible to do it through logic.

livid haven
#

@willow tulip going well.

#

even a propper key now

willow tulip
modest apex
#

Hi.
Just starting... looking for a "Hello World" example.
I've tried to follow the example from the Wiki, but in classic fashion, it references files that don't exist.

C:\Program Files (x86)\Steam\steamapps\common\ProjectZomboid\media\scripts <- contains no "items" folder.... since the entirety of the tutorial is based on that folder, I'm stuck.

Everything I've tried so far doesn't show up in the "mods" section in game.

Can't see what I'm missing here.
If I can get past this file structure stuff, then I think I'm away laughing. I'm a programmer, so I'm sure I'm just missing one "magic step".

Thanks

bronze yoke
#

most of the contents of media/scripts were moved into media/scripts/generated in the most recent update

#

they may not be organised the same way they were before even inside of that folder though

modest apex
#

Awesome.
Yeah, I figured it was something like that... hahahahah.

modest apex
bronze yoke
#

a mod not showing up in the mod manager would basically always mean the mod.info is in the wrong place -- also bear in mind if you decide to work from a version folder (usually 42) that the common folder has to exist for the mod to be detected, but can be completely empty

modest apex
#

This is all correct yeah?

bronze yoke
#

that all looks right to me, does Workshop/JimsMods have a workshop.txt? i'm also not sure it'll be happy with empty poster= and icon=, just remove those lines if you don't have anything yet, they aren't mandatory

bright fog
#

You're in the game files

#

I believe I added a note about this on the mod structure page

#

Wait I didn't ?

#

I did in my video I think but surprisingly not on the wiki page 😅

modest apex
#

Hahaha. Ok .. sorry .. which folder should I be in?
I'll be away for a 1/2 hour, but I'm super grateful for your help

bright fog
#

First line of the mod structure page

#

Cache folder

bronze yoke
#

%UserProfile%/Zomboid is the windows shortcut there

knotty stone
#

i think its working pretty good, that was hell of a ride, to power entrie buildings xD

#

And @karmic elk I fixed the trailer attachement on the dozer

karmic elk
#

Was it a bug or a typo? I really would like to understand why it didn't work and how you fixed it please?

knotty stone
#

I think I did that on purpose back then and moved the trailer attachment in the center of the dozer.

karmic elk
#

Ooooo... so even though the text file had numbers, they weren't really big enough to be at the back of the trailer? Is that why the 'hitch' wouldn't appear in the 'Attachments' section of the 'Vehicle Maintenance' dialog box that pops up when you select the spanner from the V radial menu? That's weird... even if you couldn't 'reach' the attachment point because it's in the middle of the model, I'd have thought that the game would still have seen you had set some 'Attachments' regardless... this game is frustratingly weird.

modest apex
#

Ok, I've moved everything to my %UserProfile% and still no joy.

#

Am I missing something here?
If I search for the example mod in the list, I'd expect to find it... but it doesn't show up either?

karmic elk
#

@knotty stone Just spawned a new bulldozer, entered the cab and got an error:

modest apex
frank elbow
# modest apex

Notice that this one has the mod directly in it, rather than within a Contents folder. Since you're using the Contents/mods/... format (the one for the Workshop), you should put it in the Workshop folder

modest apex
#

Success

#

Thanks... I was looking in the mods folder rather than the Workshop folder... cuz it had the "example mod" in it... when I couldn't find that, I knew I was in the wrong place...

Trouble with the mod structure wiki is that there is a TON of "bottom up" info at the top.... the full structure should be at the top of the page.

#

Anyway... thank you so much for getting me pointed in the right direction 🙂

exotic hare
#

Hey guys this isn’t a modding question but do you guys know how the culling works for walls/higher levels? I’m making a remake of PZ and I’m kinda stumped on this one

nova ridge
#

Look through the decompilation

exotic hare
exotic hare
nova ridge
#

Never touched the modding part of this game yet

#

Im going to make a Lamb Mod whenever i do

exotic hare
#

I just need to look into the code to see how it works so I won’t try and modify it

topaz tangle
livid haven
bright fog
#

ACTUALLY read the page

modest apex
#

Mate, I'm a computer programmer with over 40 years of experience. I can read, and critique manuals and instructions... those instructions are "bottom up".... aka, get started in the weeds and THEN (finally) get to the overview at the end.

That's backwards.

#

Aka, if I have to slog through that much info to get to the basics, then it doesn't matter that it's technically there, it's written wrong.

drifting ore
#

^That's the heading of the structure above it. It's 3 sentences long. Unless you didn't see the table of contents on the right side of the page, I'm not sure where all the information to slog through is.

#

imho

modest apex
#

I always love hearing people defending bad docs.
I'm an (experienced) outsider looking in and going "mate... this is a mess".

You can take that for whatever it's worth, but this falls under the "it's easy... once you know" category. You can't see it [the problem] cuz you already know where to look.

#

So... straight off the bat... exactly what you're trying to "point out" would be my first critique... the "table of contents" is hidden over on the right??? (and down the page).

#

But seriously, I'm not here to argue about all this...
Like I said, take it or leave it...
I'm super happy that the Discord is here and that everyone got me going, cuz now it is easy for me.

livid haven
# modest apex I always love hearing people defending bad docs. I'm an (experienced) outsider l...

im a hardware engineer (masters UNE 2013) with 11 years experience. im very much a C++/C# programmer, with a heavy professional focus on driver & hardware interfacing. other then zomboid ive only modded stationeers (C#/C++) and space engineers (C#). and i have very limited experience with LUA

gotta say the game has EXTENSTIVE well made documentation, and the ingame workshop prompts are esentually flawless. if you mess it up it tells you what you did.

and creating things like https://steamcommunity.com/sharedfiles/filedetails/?id=3596110952 is drastically simplfied by the detailed reference docs. https://theindiestone.com/zomboidjavadocs/zombie/iso/IsoGridSquare.html

modest apex
#

I never said otherwise 😆
I said the wiki's a mess... which it is.

Take my first foray into all this... Ok... dug my way down to a "Get started here" video... GREAT. (not great that I had to dig for it, but whatver)... Follow the video... step by step... exactly... only to find out ... oh no... the folder structure that's referenced ... does not exist.

Um... sorry... outsider perspective here... no... it's not as good as you think it is.

drifting ore
#

What video?

modest apex
#

The one that the Wiki Points you to!

#

Gimme a sec, I'll dig it up.

#

The guy that made it said "woops... got that wrong"

#

Listen, I'm not trying to bash on things or people here.
But man... take some criticism for what it's worth.
I'm only here cuz I went to the wiki and went WTF? They want me to dig through all this???

#

And as usual, two seconds with someone who already knows where to look solved things.

livid haven
modest apex
#

So thanks for helping me get there... but I shouldn't need that help.
This is what I call a "magic step".

Like when you're talking to Steam people... they ALL know where the "common" folder is.

livid haven
#

but i dont see an issue with the wiki page personally.

modest apex
#

My point exactly.

#

Again... right off the bat... the TOC is on the right.
That's not normal.

#

At all

livid haven
drifting ore
#

It takes up 30% of the screen

modest apex
#

And it's not at the top either.

#

Wow... not listening mate.

drifting ore
#

Isn't google docs formated similarly?

#

Yes, because if anybody pushes back against your opinion we aren't listening

#

Have a good night sir

bright fog
modest apex
#

It's not the reading of text that I'm talking about... it's the "bottom up" nature of that text.

It starts "in the weeds"... with details that don't matter what so ever until you get to the top level stuff (structure for example)

#

It should be "top down"

#

Overview first, then details.

bright fog
bright fog
#

Tho I can agree might video could be unclear on things, that's my first video guide so I wouldn't be surprised if some things were unclear

bright fog
#

Some have no idea where it is

bright fog
modest apex
#

The "generated" folder is where I think the "items" folder got put under...

bright fog
#

You are bound to such problems

modest apex
#

media, sorry...

#

Those are all screenshots from today.
It's why I'm here

bright fog
#

Videos WILL become outdated but the video tells you where scripts are put: media/scripts
Subfolders do nothing in there but organization so you need to learn how to search inside the game files

modest apex
#

sigh
Tone deaf.

bright fog
#

I've answered all your messages, I'm open and waiting for you to tell me your thoughts and not just say "it's bad !" without giving more details

#

I'm the man to tell about the problems with the docs, I'm the one writing those pages

modest apex
#

Right on... and thanks for being open.
Like I said, I'm not here to argue and I'm super appreciative of the help that I've gotten here.

bright fog
modest apex
#

After I figured out to go here...
https://pzwiki.net/wiki/Getting_started_with_modding

You're met with a rant about AI.
I get it... but I was just some dud looking for "where the hell do I start"... and I've waded through a bunch of text just to get to here and I'm listening to a rant about AI?

Mate, I was already rolling my eyes.
I was just looking for an example to get something to show up in the game.

Once I had that, I was away laughing.
But it took all day to get there. It shouldn't.

bright fog
modest apex
#

The I got to this...

~/
└── Zomboid/

That's UNIX file structure.
Now, you know that it translates into %user% on PC... but you only know that because you know.

bright fog
modest apex
#

Yes... I'm sure you are... but again, from someone coming in from the outside... it's "Steam/steamapps/common".
I was just looking for a "where's the start?"

bright fog
#

You have no choice but to access the pages linked in the various paragraphs of other pages: you see cache folder, if you don't know what it is, go read about it, learn and understand what it is then come back

#

That's my thought process for the wiki and solution to not repeat informations and simplify pages

modest apex
#

Yes, but it's also your choice to lead off with information that's not what people are looking for... cuz you feel (a justified) need to make a point

#

But please don't be surprised when someone comes in (me) and says "That wasn't helpful"

bright fog
#

I agree the getting started page could get some love, but it's not easy sadly
Currently you have this first section and the paragraph telld you to read mod structure

bright fog
bright fog
modest apex
#

Once you know where to start.

#

Yes

silent zealot
bright fog
#

Sorry if it isn't for you but the majority of modders pass through this page

#

It's the first page we link them

modest apex
#

I disagree... the "where to start" page is exactly for me.

#

I was looking for "where to start"... and did not find it 😆

#

Gimme a sec... I'll get you the exact thing I'm talking about.

silent zealot
#

What does "where to start" even mean to you?

#

And does the rest of the world think the same way?

modest apex
#

Good question...
And yes, I do think so...

#

Where to start would be "Hello World".
Which is exactly what I was trying to do.

modest apex
#

I didn't need to know the ins and outs of every little detail of a type of thing in the game... I just needed to know how to make a "Hello World" mod.

silent zealot
#

what do you need to do to make a hello world mod?

modest apex
#

Oh, I made one.

silent zealot
#

Would it not start with some useful advice and a description of the folder structure?

modest apex
#

Ok... like I said... gimme a sec...

silent zealot
#

The information about AI on that pages is after the other information, so complaining about having to wade through it imakes me feel like you just want to complain

modest apex
#

This is not in the wiki.... ~/Zomboid is.
They're not the same thing.
One is UNIX, one is windows.

modest apex
silent zealot
#

Once again, What does "where to start" even mean to you? And do you think everyone feels the same way?

modest apex
#

I honestly don't care, but I also detest people just brushing me off as "RTFM!!!!!" without listening to anything I'm saying.

silent zealot
#

And I hate trying to help out by asking questions to clarify and having the person just ignore that and refuse to provide the information that could lead to everyone understaidng what is going on, yet here we are.

modest apex
modest apex
silent zealot
#

So, your real complaint is "the wiki uses ~/Zomboid without explicitly giving the Windows version?

modest apex
#

No, that is my example of "once you know you know" thinking.

bright fog
#

It is linked

#

Idk what to tell you man

silent zealot
#

That's useful feedback - some peopel will not understanding the usage of ~.

modest apex
#

UHG.
Listen, it's been fun guys... but we're not getting anywhere here.
Have a good night.

silent zealot
#

But... the line has to be drawn somewhere when making a wiki

bright fog
#

Where is the ./Zomboid or ~/Zomboid

silent zealot
#

It's not like we're going to explain from scratch what a filesystem is.

#

I'm guessing this example:

#

It would be somewhat cumbersome to explicitly list default Windows and Linux paths along with a "but you might have installed things somewhere else" disclaimer

bright fog
silent zealot
#

Fancy.

#

But since everyting is given relative to the Zomboid or game root path, I'm not sure that is needed

bright fog
silent zealot
#

I have to be honest, after that earlier discussion what I really want to change on the wiki is to move the AI warning to the top, make it bigger, and add flashing red warning light gifs. 😛

frank elbow
# modest apex UHG. Listen, it's been fun guys... but we're not getting anywhere here. Have a g...

I think if you had trouble with the wiki then it's fair criticism. I don't meant to belabor this by responding to a message indicating that you're done with the conversation, so I'm not expecting a response. Just figured it's worth adding that you can contribute to the wiki. It's a community effort and it's done by volunteers. If something is unclear, anyone can be empowered to improve it

sour island
#

Man this was a read

#

Suggestion: Just include a little blurb about cache folder and hyperlink back to the blurb on the same page (I don't think the cache folder needs it's own page entirely)

#

Oh there is one already lol

#

At a glance I can say the terminology is a bit confusing

#

"game files" should specify installation, cache/user/app data, or downloaded content

#

And this section should specify the mods are the ones downloaded from steam / subscribed to

#

Also, that first sentence is a doozy 😅

#

It's continuing the subject from the earlier subsection

#

Would be simpler to type out the whole path as if the other sections of the article weren't there

#

All in all it's not bad information - and the guy isn't wrong to say it's a bit confusing - but there is such a thing as being correct and still wrong due to delivery.

drifting ore
#

I think maybe a link or something on the getting started page for the video as well, it does fit in mod structure but it is a getting started video so

sour island
#

Yeah "getting started" is a rough topic to tackle

drifting ore
#

I know, and it does feel like it’s spread out a bit but how could it not be

sour island
#

This article is about the "game files" which the game installs in various places though

#

The game files article should probably be listed in the getting started article somewhere at the top for terminology purposes

#

If that's what you meant?

#

And the terms need to be exact lol - it's already bad enough everything is just called "mod"

drifting ore
#

Maybe the top of the getting started page needs to be terminology

#

Like a rough outline I guess, game files include this and this, mod structure goes over this, etc

sour island
#

To get started you have to setup a mod folder in a mods folder of your WIP mod folder in your mods folder, but don't forget the contents folder not to be confused with your steam/contents folder which also has a mods folder but that's not used unless you're non steam and really you should be using your mods folder in your zomboid(cache) folder not your zomboid(install) folder. 👍

#

And your WIP mods should go in your workshop folder(cache) not your workshop folder of downloaded contents.

#

And don't forget to unsubscribe from your mods because the game will prefer downloaded workshop content over local workshop (cache).

#

I'd honestly rename the cache workshop folder to workshopUpload

#

Or workshopStaging if you wanna get fancy with it - but I don't know if such a change is even feasible

drifting ore
#

B44 maybe

sour island
#

I did enjoy the modpocalypse(s)

#

Most of my stuff was fine 😅

bright fog
#

My idea is to repeat information as little as possible to not multiple the maintenance on the Wiki

#

As I'm alone currently, and I'm probably the only one aware of every modding stuff on the wiki rn, it's hard for a new contributor to realize that an info they changed needs to be changed elsewhere too

#

So that's why I constantly link to existing pages, bcs that's how it should be done for proper maintenance of the wiki later down the line

#

But I agree the section could appreciate a bit of clarification

bright fog
# drifting ore I think maybe a link or something on the getting started page for the video as w...

My idea is to make videos for the various topics
Here we get in a challenge again of not repeating information around the wiki so I shouldn't link the video in different places
What I will do however is create modding project pages for the modding guides I know about to more easily link them around multiple times and I need to make a dedicated page to "Modding guides" where I link video tutorials
I kind of already have something like this setup but I link individual guides related to subjects in their specific Modding field pages

#

Ie: mapping guides in "Mapping"

bronze yoke
#

the ProjectZomboid mods and Workshop folders are basically templates that the game copies into the cache directory to initialise it

#

i'd prefer if they hid it in an archive or something because this comes up repeatedly and all you can really say is 'yep, that is confusing as hell'

modest apex
#

Hey, thanks for considering my thoughts. IDK what the answers are or if there even are any.

I mean a lot of it is "you're dealing with what you've got" you're stuff and part of that is that your dealing with a wide variety of background and needs. There's nothing easy about that.

Let me flip it all around and point to something that I thought was excellent... That video actually.

Man, when I found that I was almost first bumping... Right up till that missing directory. I knew what had happened ("something must have updated"), but damn it was spot on.

#

It's funny too, cuz I also considered that need to pull the directory unnecessary. I'll grab my file that I came up with later as an example of what I'm talking about... I really get the practicality of what you were doing, but there's another simpler step... It could just be (and probably is) my desire for a "hello world" example... But I'll dig it up.

Anyway.
What I really really think is positive... And suspect is "the answer", cuz it even got my dumb butt in the right direction is this forum.

You can't cover everything, especially when dorks like me stumble in and miss something silly, so having someone go "hey dude, ya missed this..." Is pretty invaluable.

Sure was for me.
Thanks again.

sour island