#mod_development

1 messages · Page 363 of 1

knotty stone
#

@bright fog tried your script extension, but with vehicles i get false positives there.

brave bone
#

Thank you for the tip will check this out. 🙂

fresh patio
#

i am currently making mod downloader for nosteam players

hasty wharf
#

@small ospreyyup no problem 🙂

bright fog
civic galleon
#

Is it possible to have separate sandbox options for singleplayer vs multiplayer? As in, is it possible to not include all options or have different default values?

bright fog
#

You'll have to make 2 different options

#

Can be in 2 different pannels

#

Could do the trick

#

So panel 1: My Mod [MP]
Panel 2: My mod [SP]

civic galleon
#

Thank you @bright fog! ||Would it be possible to get the custom sandbox page https://pzwiki.net/wiki/Sandbox_options#Sandbox_options_in_the_Lua to state one can enter a custom page name and/or a list of the vanilla pages? I am not sure how I was able to figure out the vanilla page Time is called TimeOptions, it was likely just told to me some time ago. Knowing this now, I can see how it could be inferred from this companion page https://github.com/demiurgeQuantified/PZModdingGuides/blob/main/guides/SandboxOptions.md, but I think it is also easily missed as a fact||

I made an account and am working on it myself, sorry to bother!

solemn flower
#

Hello devs,
Im making a mod to control reanimated IsoZombie with "Companion" role to follow the player and attack zombies around the player.

At the moment Im fighting against the zombie tendency to lunge and aggro the player in every OnZombieUpdate before perceiving and action according to the Companion role.

Refering to Bandits code, it seems to juggle the zombie's target and pathfindbehavior around to de-aggro and move (which Ive made good progress on)
But some action state and therefore animations get stuck. Bandits code says a bandit that goes to Lunge state becomes useless and has their pathfindbehavior reset.

https://gitlab.com/shinkenuu/bandits/-/blob/main/42.13/media/lua/client/BanditUpdate.lua?ref_type=heads#L317

Can anybody point me the way to deeply understand how to hijack the action state and what are the implications of zombie:setUseless(true) ?

bright fog
civic galleon
#

What i got just manually testing so far. I haven't figured out the last two or how if it is possible to have your options appear anywhere but the bottom of the page

Sandbox Option Page Names

Time = TimeOptions
Zombie = Zombie
Loot = Loot
World = World
Nature = NatureOptions
Meta = Meta
Character = Character
Vehicles =
Livestock =

ZOMBIE OPTIONS = ZombieOptions

bright fog
#

You have to hack in the UI for that

#

Also I suggest not adding your mod options to vanilla menus

#

Bcs then players don't make the difference between modded and vanilla features

#

You can find the other vanilla page IDs from the translation entries most likely

civic galleon
bright fog
#

You should add translation to the page name

#

That's how it's meant to be used

#

I think that wiki page needs a shit ton of love lol

civic galleon
#

Ahh I did find it on that page under translations

frail violet
#

I have some open faced helmets in my mod. When the character drinks the character automatically un-equips/equips the helmet. Is there a way to prevent this?

civic galleon
#

This is what I get for assuming translations are only for alternative languages x_x
Thank you yet again!

raven epoch
#

so turns out b42 disabled rendering for isoplayers

mod is cooked 👍

#

at least it works in b41

bright fog
#

table blocks can have custom IDs ?

knotty stone
#

yea, thats from the rotatorlib armor

bright fog
#

And about the needs block

#

Is it normal it has a equal sign ?

knotty stone
#

seems so, its pretty special, but tsarlib has something similar too

bright fog
#

This sounds deprecated

#

Because script blocks don't have equal signs normally

#

@grizzled fulcrum uh oh

#

Omg I see what's going on ? That script block literally defines a Lua table no ?

#

Oh man that's cursed as shit

#

@bronze yoke do you know anything about those table scripts ?

#

I need to find the vehicle parser I think

grizzled fulcrum
bright fog
#

Check screenshot above

#

table blocks can have nested blocks with equal signs

grizzled fulcrum
#

the needs = {?

bright fog
#

Yea

grizzled fulcrum
#

what is that for

#

but regardless that is so insanely cursed

bright fog
#

Literally a table definition

grizzled fulcrum
#

but its easy fix

bright fog
#

I mean it should be a parameter and not a block I think

grizzled fulcrum
#

oh

bright fog
grizzled fulcrum
#

yeah it should definitely be classed as a param

#

in any case, since there will always be a { after the equals that is how you can differentiate it from a normal parameter value

#

if you still have issue after (which i doubt you will since you use regex pretty well) then lmk but im sleeping now

knotty stone
#
        if armor.needs.part then
            local guard = vehicle:getPartById(armor.needs.part)

            if not guard or not guard:getInventoryItem() then
                return false
            end

            if armor.needs.condition then
                local condition = tonumber(armor.needs.condition)
                if not condition or guard:getCondition() < condition then
                    return false
                end
            end
        end
    end```
raven epoch
#

mb just spawned would prob result same

bright fog
knotty stone
#

will that still work?

solemn flower
#

hi
any materials or java code sources to understand the AI action state engine further than what the wiki says?

raven epoch
#

are u making npcs?

solemn flower
#

Yes, friendly using IsoZombies

raven epoch
#

ooo

#

idk about the vanilla but i can show u me state machine

#

it uses isoplayers tho

solemn flower
#

Yeah, my pain comes from the aggroing I need to overwrite ):

raven epoch
#

oh hmm

#

u already checked

#

bandits im assuming

bright fog
raven epoch
#

are u confused about the

#

lua part

#

or the vanilla ai part

#

i can help with lua but no experience on vanilla sadly

solemn flower
#

Im reading a lot dor bandits code. Either I dont know enough about how to manipulate the zombies like they do. Im doing every operation they are doing and I still get diff states

raven epoch
#

let me show u how i did it for

#

isoplayers

solemn flower
#

ok

raven epoch
#

cant send files

#

💀

#

hold on

#

bruh

#
local NPCStateMachine = {}

local TypeToStateModule = {
    Officer = require("Type_OfficerStates")
}

function NPCStateMachine.ChangeState(NPC, NextState, Tick)
    local StateModule = TypeToStateModule[NPC.Type]
    
    StateModule[NPC.State].Leave(NPC,Tick)
    
    NPC.State = NextState
    
    StateModule[NPC.State].Enter(NPC, Tick)
    
    NPC.NextState = nil
end

function NPCStateMachine.UpdateState(NPC, Tick)
    local StateModule = TypeToStateModule[NPC.Type]
    
    StateModule[NPC.State].Update(NPC, Tick)
    NPC.Object:addLineChatElement(NPC.State)
    if NPC.NextState then
        NPCStateMachine.ChangeState(NPC,NPC.NextState, Tick)
    end
end

return NPCStateMachine

there we go

solemn flower
raven epoch
#

i called this every 500 ms or so

solemn flower
#

Wow, those are some new interfaces

raven epoch
#
OfficerStates.NoAiAlert = {
    Enter = function(NPC, Tick)
        
    end,
    Update = function(NPC, Tick)
        local ConditionTable = Conditions.CheckCondition(NPC, "ClosestVisibleTarget", {Range = FIND_TARGET_RANGE}, Tick)
        local NearestTarget,DistanceToTarget = ConditionTable.Target, ConditionTable.Distance

        if NearestTarget then
            NPC.NextState = "Idle"
        end
    end,
    Leave = function(NPC, Tick)
        ISTimedActionQueue.clear(NPC.Object)
    end
}

and this is what it would call for an example (depends on state)

raven epoch
solemn flower
#

yes but

#

what is a NPC? is it a IsoPlayer?

#

a IsoGameCharacter

raven epoch
#

its a table

#

NPC.Object is isoplayer

#

NPC just holds

#

name weapons range state that kinda stuff

solemn flower
#

Ohh

#

I see it now

#

the states pattern

raven epoch
#

ye i switch around using NextState

solemn flower
#

I never saw this b4
ISTimedActionQueue.clear(NPC.Object)

raven epoch
#

it is for IsoPlayers

#

it clears timed actions

#

since ur going to use zombies tho

#

u can also use condition type thing i made

knotty stone
solemn flower
#

yeah but maybe it works with IsoGameCharacter

raven epoch
#

u see this right Conditions.CheckCondition(NPC, "ClosestVisibleTarget", {Range = FIND_TARGET_RANGE}, Tick)

#

it calls


function Conditions.CheckCondition(NPC, ConditionName, ConditionArgs, Tick)
    if not (NPC.ConditionData[ConditionName]) or (NPC.ConditionData[ConditionName] and (Tick - NPC.ConditionData[ConditionName].Tick >= ConditionData[ConditionName].CheckRate*60) or (ConditionData[ConditionName].ValidityFunction(NPC, ConditionArgs, Tick) == false ))   then
        NPC.ConditionData[ConditionName] = ConditionData[ConditionName].ConditionFunction(NPC, ConditionArgs, Tick)        
        NPC.ConditionData[ConditionName].Tick = Tick
    end
    return NPC.ConditionData[ConditionName] or {}
end

#

so basically

raven epoch
#

when the NPC wants to get the closest target

#

it calls checkcondition

bright fog
#

Well idk what to do with this info because needs is also valid 😅

bright fog
raven epoch
#

check condition checks if:

the npc already checked for a target not too long ago
if so VALIDATE the target, do not loop and find a new one (faster)

if the npc did not check too long ago, or it has been too long
loop and find a new target

#

for loops checking and validating every target generally kills performance in npcs

#

so u want to keep that low

solemn flower
#

I have a throttle function keep CPU cool

raven epoch
#

ye good idea

solemn flower
#

what your call conditions

#

I call perception

raven epoch
#

a better naming ngl

#

u might also want to check out behaviour trees if ur companion ai is going to be very complicated

#

they are annoying to set up but are easier to manage

solemn flower
#

Way easier

#

I just wanted to make it very straight foward to code

#

and testing wether I can keep the zombie under control

#

before diving on state pattern

raven epoch
#

i can send u me mod file if u want

#

im going to most likely leave it since isoplayers dont work in b42 😭

#

mod works fine on b41 tho last i checked

solemn flower
raven epoch
#

okey

#

good luck 👍

#

(link doesnt open btw)

solemn flower
#
local actionStateControls = {
        ["onground"] = function()
            if zombie:getVehicle() then return true end
            if zombie:isUnderVehicle() then
                zombie:setX(zombie:getX() + 0.5)
                zombie:setY(zombie:getY() + 0.5)
            end
            return false
        end,

        ["turnalerted"] = function()
            -- if MohgulPerception.IsHostile(zombie:getTarget()) then return false end
            zombie:changeState(ZombieIdleState.instance())
            MohgulCombat.Passify(zombie)
            zombie:changeState(ZombieIdleState.instance())
            return true
        end,

        ["pathfind"] = nop,

        ["lunge"] = function()
            if MohgulPerception.IsHostile(zombie:getTarget()) then
                MohgulCombat.Passify(zombie)
                zombie:changeState(ZombieIdleState.instance())
            end
            return true
        end,

        ["getup"] = nop,
        ["getup-fromonback"] = nop,
        ["getup-fromonfront"] = nop,
        ["getup-fromsitting"] = nop,
        ["staggerback"] = nop,
        ["staggerback-knockeddown"] = nop,

        ["idle"] = function()
            MohgulCombat.Reutilize(zombie)
            return true
        end,
    }
end
#
--- Clear aggro list and target seen time
--- @param zombie IsoZombie
function DeAggro(zombie)
    print("DeAggro(zombie=" .. tostring(zombie) .. ")")
    zombie:clearAggroList()
    zombie:setTargetSeenTime(0)
end

--- Resets target, aggro list, target seen time
--- @param zombie IsoZombie
function Passify(zombie)
    print("Passify(zombie=" .. tostring(zombie) .. ")")
    -- zombie:setUseless(true)
    zombie:setTarget(nil)
    DeAggro(zombie)
end

--- Set as useless and passify
--- @param zombie IsoZombie
function Inutilize(zombie)
    print("Inutilize(zombie=" .. tostring(zombie) .. ")")
    zombie:setUseless(true)
    Passify(zombie)
end

--- Set as not useless safely
--- @param zombie IsoZombie
function Reutilize(zombie)
    print("Reutilize(zombie=" .. tostring(zombie) .. ")")
    if zombie:isUseless() then zombie:setUseless(false) end
end
#

I use IsoZombie:pathToLocation(nearPlayerX, nearPlayerY) to keep social distance when near player and IsoZombie:pathToCharacter(player) when its far away (like 8 steps away)

bright fog
civic galleon
# bright fog Also for the future, do know you can contribute to the modding wiki in case you ...

That's what I did 🙂 I have only added the small note about setting page name.

I agree though about making your own tabs for mod settings, so I don't plan to list the names to add options to vanilla settings tabs on the wiki. I am unsure why I had mine originally under Time instead of its own. Perhaps B41 did not allow for it on MP launch? Regardless, I have moved to a new tab hahaha.

Thank you as always!

strong gull
#

Can someone help me with how I can implement an infinite weapons mod on my multiplayer server? The mods that exist here are local, single-player only, and I can’t figure out how to make this work. Can anyone help me?

graceful ember
#

Hey guys. Right now, the area behind the character is only slightly dark, so you can still see floors and walls, and sometimes you can barely even tell where the vision cone actually is. I’d really like to make a mod that fully or almost fully darkens everything outside of the character’s vision cone, something closer to how it worked back in B41.
My programming skills kinda suck, I mostly rely on Cursor to write code, so I don’t really know which values or functions control the vision cone darkening. If anyone knows where this is handled in Build 42, or whether it’s even possible to change, I’d really appreciate any help.

bronze yoke
#

type: needs id: =

cold skiff
#

Does anyone know how to remove these errors that always appear in console.txt? because they bother me to debug
LOG : General f:0, t:1767207586826> ERROR: mods isn't a valid workshop item ID
LOG : General f:0, t:1767207586832> ERROR: mods isn't a valid workshop item ID
LOG : General f:0, t:1767207586838> ERROR: mods isn't a valid workshop item ID
...

bronze yoke
#

you can't

cold skiff
#

it can't be done?

bronze yoke
#

it can't be fixed

willow tulip
#

all the code is raw opengl calls with all literals replaced with numbers.

gloomy hornet
#

Has anyone thought about an indepth temperature system for vehicles

#

Like Windows frosting up to a point you can't see out of them

gloomy hornet
#

I'd just like more scene setting for winter temperatures

#

Maybe snow dosent set under areas occupied by vehicles and snow develops ontop of cars the longer its not removed

#

Or a cold start may damage the engine or cause the engine to turn over slower but once it begins to heat up, the engine will work good intill it goes cold again

#

Or just add a scrapper tool or use a credit card to scrape frost off windows

#

Which will prevent you from seeing outside of the car

small osprey
#

Go for it tiger 🙂

rich reef
#

Hello, I have a question I hope someone can answer:

I have been trying to spawn items within a backpack/bag through Lua code, but cannot figure out the correct method to do so for a multiplayer server.

The player would already have the bag/pack and the right click context menu > add items, and it should add the items, but it is not doing so.

I've tried a few different methods, such as sendItemsInContainer, as well as getInventory():AddItem("Apple"), as well as getItemContainer():AddItem(), and none of these seem to work correctly.

I can check the bag first, to see if an item already exists with getItemContainer():getItems(), and loop through that array, and it finds items already within, so I know I can access the bag. But when I try to spawn an item, it does not seem to work.

Does anyone have any insight into this? I'm trying to remember a mod that spawns items like this, but I just can't remember off the top of my head to look for reference.

Thanks for your time! And Happy New Years everyone!

bright fog
silent zealot
#

I'm not certain it will answer your question, but it's a starting point.

#

Did you use AddItem and sendItemToContainer at the same time?

rich reef
finite scroll
#

did the B42MP update change the process for adding custom items?

#

i suppose it must have since my old code doesn’t work anymore

#

oh goddamnit ammo types are different now too

#

this is a problem for tomorrow me

silent zealot
#

It changed a lot of things.

#

Including items.

#

The changes are not difficult; have a look at vanilla items to see the new syntax... but the changes affect lots of things

silent zealot
wraith flame
karmic elk
#

Hi. I want to make my first PZ mod, but I'm unsure if what I want to make is even possible.

I want to create a new action that requires a pickaxe and will remove any type of 'street' tile and replace it with any type of 'brush' tile. e.g. I can dig up a driveway and then plant crops in the new 'turf'. In DEBUG mode I have to use the Brush Tool to delete the 'street' tile, which leaves a black hole in the map, and then I have to use the Copy Tile option to copy a 'brush' tile and paste it into the black hole gap.

I want to do this but require a pickaxe and do it not in DEBUG mode, but instead have it as an action that can be done whenever the player has a pickaxe. I also want to have SANDBOX options to increase/decrease the time it takes in-game to dig up the tile.

Is this even possible?

Any suggestions on what I need to look into to do this - btw, I want to do this for B42.13+

wraith flame
karmic elk
wraith flame
#

Yes, it can be done only in Lua.

Timed actions, checking for a pickaxe, reading the floor sprite, replacing it with setFloor(), and adding sandbox options are all exposed to Lua

karmic elk
#

Thanks! You've been a great help.

wraith flame
#

basic example

    if not square then return end

    local floor = square:getFloor()
    if not floor then return end

    local sprite = floor:getSprite()
    if not sprite then return end

    local name = sprite:getName()
    if not name then return end

    -- simple check, you’d expand this for more tiles
    if not string.find(name, "street") and not string.find(name, "road") then
        return
    end

    -- replace the street with grass/dirt
    square:setFloor("blends_grass_01_0")
    square:transmitUpdatedSprite()
end````
empty gate
#

Hi everyone! 🙏

I’m trying to implement a boundary mechanic in 42.13. The idea is:

When the player spawns, they are enclosed by invisible, indestructible walls.

Each subsequent day, the boundary expands outward, giving the player more space.

Is it possible to achieve this in 42.13? If so, what’s the best approach to implement it?

empty gate
karmic elk
wraith flame
# empty gate Hi everyone! 🙏 I’m trying to implement a boundary mechanic in 42.13. The idea ...

Yeah, this is doable.

You don’t mess with the map or editor walls. The clean way is to spawn invisible blocking objects at runtime.

On player spawn:
• Grab the player’s starting square
• Calculate a box or radius around them
• Spawn a ring of invisible, indestructible blockers along that boundary

These aren’t real map walls, just world objects that block movement. You can do this in Lua with something like an IsoThumpable (or similar) set to:
• invisible sprite
• not thumpable
• effectively indestructible
• collision enabled

For the expansion:
• Keep track of the current boundary size
• Once per in-game day, remove the old blockers
• Spawn a new ring farther out

Key points:
• Only update once per day (performance)
• Test which blocker setup works best for player/zombie collision
• Use transmit calls so it syncs properly in MP

You’re not editing tiles or the map itself, just adding/removing blocking objects, which Lua supports. The idea is solid — the only trial-and-error part is picking the exact invisible object settings that feel right.

karmic elk
#

Is there an example mod with comments or a good B42 tutorial about how to create a mod that adds an option to the context menu?

worthy wharf
#
-- Simple example: Add a context menu option to cigarette pack
local function onClickSmoke(playerObj, cigarettePack)
    cigarettePack:Use()
 
    print("You clicked smoke! Pack has " .. cigarettePack:getCurrentUses() .. " cigarettes left")
    
    -- You can do anything here:
    -- - Reduce stress
    -- - Play animation
    -- - Show a message
    playerObj:Say("*lights cigarette*")
end

local function addSmokeCigarettePackOption(player, context, items)
    local playerObj = getSpecificPlayer(player)
    
    -- Loop through items being right-clicked
    for i, item in ipairs(items) do
        -- items table contains wrapped objects, get actual item
        if not instanceof(item, "InventoryItem") then
            item = item.items[1]
        end
        
        -- Check if item exists and is a cigarette pack
        if item and instanceof(item, "InventoryItem") then
            if item:getFullType() == "Base.CigarettePack" then
                -- Check if it has cigarettes left
                if item:getCurrentUses() > 0 then
                    -- Add the menu option with icon
                    local option = context:addOption("Tapa na pantera", playerObj, onClickSmoke, item)
                    option.iconTexture = getTexture("Item_CigaretteRolled")
                end
                break
            end
        end
    end
end
-- Register the function to run when right-clicking inventory items
Events.OnFillInventoryObjectContextMenu.Add(addSmokeCigarettePackOption)


raven epoch
#

how do i damage objects?

#

i tried :Damage but it doesnt seem to do anything

raven epoch
#

v is a grid square

#

how come all of them are nil?

frank elbow
#

getThumpableWall and getThumpableWindow can both return null

raven epoch
#

even though i am next to a window?

bright fog
#

A window isn't a wall

raven epoch
bright fog
#

No ?

raven epoch
#

i mean true but

#

i expected one to return when i am in a corner with a window

bronze yoke
#

most walls aren't thumpable

raven epoch
#

oh

#

is it possible to damage isoobjects then?

#

there is a :Damage function but i have yet to see it do anything

bright fog
#

I doubt it

raven epoch
#

so i cannot destroy sandbags crates furniture?

#

😭

bright fog
#

If it's ones you placed, you can probably place them as thumpables

#

Instead of just IsoObjects

raven epoch
#

i need to destroy the ones game generates

frank elbow
#

There is an IsoObject.AttackObject but the logic looks fairly limited

#

Outdated, probably

raven epoch
#

hmm

bright fog
#

Like having an entity attack them ? Or just remove them ?

raven epoch
#

what im trying to do

#

is when soldiers fire on u and miss

#

i want them to damage the enviorment

frank elbow
#

That much is covered by AttackObject, assuming it works

bright fog
frank elbow
#

But again, limited logic with presumably not ideal side effects

raven epoch
#

supress behaviour

#

when they cant see u but are close enough

#

they keep firing to keep u in place while assaulters move in

#

i want to emphasise that

frank elbow
#

You probably want to just use mod data for damage & "destroy" it yourself

bright fog
#

Why don't you just make the NPCs suppress fire you while some are moving close to you to get you when you are pinned down ?

raven epoch
#

it just feels weird without them damaging anything yk

#

tho maybe players wont notice

bright fog
raven epoch
#

yea true

#

heres how it looks rn

gloomy hornet
#

You know what would be the most inconvient and annoying mod ever

#

Fuseboxes

#

Each house has a fuse for each room

raven epoch
#

you gotta do an among us fuse puzzle to get in

gloomy hornet
#

If a fuse goes, you gotta replace it in alittle menu

gloomy hornet
#

I'm a texture guy

bright fog
#

That's the fun part, you can learn

gloomy hornet
#

Fair fair

bright fog
#

Or pay someone to do it

gloomy hornet
#

Also fair

raven epoch
#

its annoying how often pathfinding fails

#

nvm it was my horrible coding

outer crypt
#

guessing this needs to move server side in MP? getPlayer():getStats():set(CharacterStat.UNHAPPINESS, 0)

bronze yoke
#

yes

bright dawn
#

can someone has the documentation on how to create custom animal? Also, is it possible to use it in multiplayer with them to be just in standing mode? I cant find docs or page that refers to it on google sadly.

#

I dont need it to walk, I just want them to stand or something as long as its humaniod

bronze yoke
#

there aren't really any resources for animals yet, we're planning to make some guides after we release the horse mod

bright dawn
#

oh i see, thanks btw

#

but is the custom obj stable in mp usage right?

bronze yoke
#

we honestly don't know, so much of our code in its current state won't work in multiplayer that we haven't even bothered to test it

#

i have no reason to think they won't work in multiplayer though

bright dawn
#

I see, thank you sir

bright fog
#

Standing with albion, there isn't much reason that the animal itself doesn't work in MP

#

The parts that for sure don't work for us in MP are custom behavior stuff

bright fog
civic galleon
#

I am unsure if this is an error with the game or an error in my code, but player:getBedType() always returns averageBed no matter if you sleep on a bed, bed with pillow, couch, or the floor. Is this not the correct way to find out the "Sleeping Quality" of the bed the player is sleeping on?

upbeat turtle
civic galleon
#

I am pretty sure this should be one of the things that affects sleep quality. This is from IsoPlayer.java

#

get and set in IsoGameCharacter.java

bronze yoke
#

i honestly don't think the animal api is nearly as complex as you always say it is, if we weren't working on an animal that had so much added complexity due to needing extra features to feel 'complete' at a basic level i think we could've had a release within a few weeks, less than that if we knew the weird trip ups ahead of time

bright fog
bronze yoke
#

the majority of the time we spent on vanilla animal features was just figuring out how they work and especially working out how they don't work properly for mods, future modders will benefit from that knowledge

solemn flower
bright fog
frank elbow
civic galleon
bronze yoke
#

can you check the value on the client as well? the server might just not know the correct value

civic galleon
#

client side did return correct results! Is there a solid way for to identify when a method should be used on the client vs the server and vice-versa?

bronze yoke
#

not at all

civic galleon
#

Well in any case thank you very much! Another day saved ❤️

solemn flower
small osprey
solemn flower
small osprey
#

I can PM you?

solemn flower
#

sure

bright fog
#

Tho I guess my message was sent quite far down now

#

Want to get started with modding or need information ? See the following !

#1456402674986520726 message

  • Useful links
  • Getting started guides
  • Latest information
  • Community links
  • Assets and how to get them
  • Character rigs
bright fog
#

Wait what ??? Images can be used relative to the root folder of your mod ???

#

@bronze yoke that's obscure as shit lol

knotty stone
#

Yea i used that for my mods with the new update to save space

bright fog
#

Oh the freaking .. !

#

Oh shit ok I didn't knew you could use relatives

#

That's actually way more important than expected of an information

#

Well thx for adding that in

civic galleon
#

I remember it being said that it is hacky to place custom sandbox options anywhere but the bottom of a page. Does this mean it is also not simple to add subsections to your custom sandbox option tabs?

frank elbow
civic galleon
#

For context: It would be cleaner if I was able to have the centered sub-section name Bed Quality Modifiers and remove all the multiplier suffixes

knotty stone
#

When your mod info is in 42 folder and your pics are in common they don't load without it

frank elbow
#

My mod.info is in 42

knotty stone
#

Well never worked for me

frank elbow
#

Maybe a recent fix, then—I only moved to developing on b42 after 42.13

knotty stone
#

That was my reaction as well when I wanted to use it

civic galleon
#

I feel like this is clear enough 🤞

knotty stone
#

Sure, but you should know how much ppl are willing to read these days lol

civic galleon
#

Oh I got so many "ur mod broke plz fix" I had to disable comments

#

pre-b42MP, 550k subs, last updated 4 years ago "Mod broken"

knotty stone
#

yea comments... like, "is that mod mp ready?" when 2 comments below i said its not🙄

silent zealot
# civic galleon Oh I got so many "ur mod broke plz fix" I had to disable comments

Things I no longer bother to respond to and just delete comments:

"I installed your mod but it does not show up on my modlist!" Because it's a B42 mod and you're on B41
"Mod does not works" refuses to elaborate
"Does this work on <latest version>/multiplayer/with <other mod>" Why don't you spend 5 minutes to find out instead of posting a question and waiting hours for a response?
"Your mod is broken!" gives error from something completely unrelated
"Can you make a mod to do <completely unrelated thing>" Why do you look at this mod and think of that?

#

...that turned out more rant-like than I planned.

winter bolt
#

doesnt work in mp

outer crypt
#

I used to have a work around to get higher value capacity in containers but this also appears to no longer work.

silent zealot
upbeat turtle
#

i’ve yet to play rimworld, but i can only imagine hehe 😆

bright fog
carmine gulch
#

hey folks, due to my love for a simple map mod i love, it be a bunker, (utilizing vanilla assets too) how do i take the reins and update it myself for me and my buddies indifferent broccolli server? i've been studying a bit with how to make a map with the tools and such, but i have a feeling that it really might take some sort of direct patch i have to manually apply into the code..

any thoughts, or assistance in general to help on my quest would be most loved.

for context the mod i referencing to is called "last minute prepper" authored by fred cooper: https://steamcommunity.com/sharedfiles/filedetails/?id=3428165477

bright fog
#

He goes by the same name if I remember right, and you should be able to find him in the mapping Discord

carmine gulch
bright fog
#

Don't come at him like "GIVE ME YOUR MAP NOW", and just ask "Can I continue your map if you don't plan to ?"

carmine gulch
#

lmao, never. genuinely i loved his design for the map so much. because of his 'art' i was able to find a great decree of entertainment with the game to find 250+ hours of fun

#

thank you so much sim, shall ask him from a direct inquire.

bright fog
#

np

outer crypt
silent zealot
#

Do map making tools work properly for below surface levels now? If so you coudl always build a multi-level bunker inspired by the stylings in that one (Which AFAIK were inspired by actual cold-war era "fake suburban houses" bunkers)

bright fog
#

The unofficial ones have been out for a while now

#

Not the official ones tho, those one will come only with stable from TIS's information

icy night
#

yo, the new trait and occupations creation method suuucks.

#

I mean, the scripts looks nice and are obviously much better organized but I hate learning new methods lol

bright fog
bright fog
raven epoch
#

do i need to enable something to be able to damage isoplayers?

#

i already enabled isoplayer.setcoopvp

rapid pond
#

me when summer allergies

#

why does it lowkey look bruised though

#

better(?)

raven epoch
#

their health keeps getting set to 100

frank elbow
rapid pond
#

tried to make foam, any tips to improve?

#

(basically, rabies.)

zealous maple
#

Hello, I just want to say that the issue with client–server–client communication is solved. I had to create a shared file that both the server and the client have access to. I’m not sure this was the best approach, but I’m happy that it works. Thanks for all that had some input.

raven epoch
#

but its singleplayer

#

so is there a difference?

#

setting damage on myself works but not on npcs

silent zealot
#

How exactly are you trying to do damage to the player that isn;t working, also B41 or B42?

#

Also, what object are you trying to damage - if it's not the player, is it something that extends the IsoGameCharacter class?

rapid pond
#

help why does it look so funny

silent zealot
#

Bald Chinese man with long wispy beard high on marijuana?

#

(it would look better wrapped around the actual model)

rapid pond
#

it was supposed to be rabies but he lowkey looks like sensei wu

#

or rather SHE

#

because fem zed

#

also I am using born of birch's human zeds as a base

#

so credits to him

#

also major inspirations from rabies patients AND 28 days later

bright fog
#

Why the white at the mouth ?

#

Is it supposed to be foam ?

tired glen
#

I was trying to make a custom wave defense accumulator challenge and after copying all the scripts and changing names where appropriate there seems to be some kind of hardcoded limitation or weird quirk that i can't figure out
any time i go to use my challenge instead of the normal one, it shows my characters for last stand accumulator and i can't find where to change the search directory

rapid pond
#

😔

#

basically,

#

rabies

bright fog
bright fog
rapid pond
#

make it more transparent

tired glen
bright fog
#

It's definitely possible but not in the way you think, you don't go defining a scenario file, you could just mod the UI to add a custom behavior that creates a new save where you are on the normal map, or custom one and have the player spawn at a specific place of the map and activate the logic for your scenario

bright fog
#

And no you can't add Java code, tho you can do a Java mod but it requires a manual installation

bronze yoke
#

i'm fairly sure you can just add more scenarios but some of the last stand stuff in particular is hard coded

tired glen
silent zealot
#

re: Damage: I just checked single player B42 and getPlayer():getBodyDamage():getHealth(), getPlayer():getBodyDamage():AddGeneralHealth(10), and getPlayer():getBodyDamage():ReduceGeneralHealth(10)all work as expected, getting/changing the general "hitt points" bar next to the injury portrait. I'd expect that to also work for any IsoGameCharacter derived class, which AFAIK is really only IsoZombie unless you're doing stuff with NPC ,pds which might use IsoSurvivor. @raven epoch

tired glen
silent zealot
#

More work than texturing, but might give better results. Also, it won't be hidden under beards.

rapid pond
#

why is this actually peak

#

and do I need blender?

silent zealot
#

You can use any 3D modeling tool that can export .fbx files (probably all of them) but Blender is 1) Free 2) has lots of general tutorials 3) is the default for any zomboid tutorials and 4) is less of an insane UI nightmare to learn than it was twenty years ago, but it's still along way from easy if you've not used it before.

rapid pond
tired glen
#

ok so i think i have figured it out, what i need to do to make this work
is lua able to read data from a file in a target location? almost like a config file?
if i can get around using the getLastStandPlayerFileNames() function i can save the data however i want

silent zealot
#

There are limited ways to read/write to files, but I'm not familiar with them... but if you have a config file, you can just make it a lua file.

#

Or you need some specific file you did not create for this last stand thing?

tired glen
#

i need a relative directory to the zomboid install to store user data in

silent zealot
#

So a way to save data for your mod that persistss between games?

tired glen
#

unless i can litearlly just do getLastStandPlayersDirectory() .. "/../WD/player" and go up a folder

silent zealot
silent zealot
#

Mods can save stuff to C:\Users<windows-username>\Zomboid\Lua

tired glen
#

but i need a relative path so it doesn't break when people have user folders installed on another drive

silent zealot
#

Oh I did filename,s not directory

#

So...... I have some good news: you don't need that function, you can just assume it will return "LastStand"

#

The bad news being that probably isn;t useful to you

#

(From decompiled B42.13.1 )

tired glen
#

lmao

#

amazing function

#

it looks like this may be the function i need

silent zealot
#

"Should we make it an option in a config file?" "No, just hard code it in Java in a way that we can turn into a config file with technical debt later"

tired glen
#

i guess i can't fault them for doing that considering this challenge is basically untouched for b42

silent zealot
#

old notes of mine:

This works for stuff in C:\Users\username\Zomboid\Lua

writeSettingsFile = function(tbl, filename)
    local file = getFileWriter(filename, true, false)
    if not file then
        return
    end
    for key, value in pairs(tbl) do
        file:write(key .. " = ".. tostring(value) .. "\r\n")
    end
    file:close()
end
readSettingsFile = function(tbl, filename)
    local file = getFileReader(filename, true)
    if not file then return end
    while true do repeat
        local line = file:readLine()
        if line == nil then
            file:close()
            return
        end
        line = string.gsub(line, "^ +(.+) +$", "%1", 1)
        if line == "" then break end
        for key, value in string.gmatch(line, "(%w+) *= *(.+)") do
            tbl[key] = value -- note that value will be a string, you may need to convert to number or w/e
        end
    until true end
    return tbl
end
#

But only files underthat Zomboid\lua folder

raven epoch
#

im on b41 btw

silent zealot
#

Those notes are probably from B41... something useful I copied into my Zomboid Modding OneNote in case I wanted it one day

raven epoch
#

testing rn

tired glen
#

i think i am getting somewhere finally ty for the chat

raven epoch
#

the User/Zomboid/lua as far as i am aware

#

@silent zealot sadly same result

#

wait

#

hold up

#

it worked never mind

#

thank you

silent zealot
#

hahah

raven epoch
#

i thought health was 100?

tired glen
#

fun fact this problem happened because i forgot to change a line of code

#

:3

silent zealot
#

you can do other injuries as well with BodyDamage

raven epoch
#

they got double or triple tapped when i did reduce damage 100

raven epoch
silent zealot
raven epoch
silent zealot
#

From memory to need to use BodyDamage and get a body part and create an injury.

raven epoch
silent zealot
#

NPC mod?

raven epoch
#

yeh for b41

#

military npcs rn

#

spawns checkpoints around the map

silent zealot
#

Bandits NPC?

raven epoch
#

no my own

#

isoplayer

silent zealot
#

Or are you making an NPC mod?

verbal badge
#

Hey guys, would appreciate some help stressed I get the following error in console, but can't pinpoint them. Is this vanilla or a mod, and how do I know what mod this is related to? Sorry for the noob question.

LOG : Lua f:312, t:1767369102419, st:376,635,180> : Grapple:corpseStorageCheck.doContextGrabCorpsesFromContainers Searching for suitable containers that contain a corpse. LOG : Lua f:312, t:1767369102419, st:376,635,180> : Grapple:corpseStorageCheck.doContextGrabCorpsesFromContainers No suitable containers found.

silent zealot
#

Good luck!

raven epoch
#

thank you

silent zealot
#

I know Bandits uses IsoZombie and does a lot of forcing to equip them and make them behave

#

And if the mod breaks all the NPCs areound your base turn back into zombies.

raven epoch
#

yea thats why i didnt bother with isozombies and b42

#

making their ai itself is hard enough

silent zealot
#

Why not use B42? B41 is a bit of a dead end, by the time you have the mod made peopel will have left it

raven epoch
#

shame isoplayer rendering is disabled in 42

silent zealot
#

Now that B42 MP is out.

raven epoch
#

ye problem is

#

in b42 for some reason

#

it doesnt render the isoplayers

#

only your own

#

they exist they can shoot they can chat

#

just not render

silent zealot
#

Well, by design isoplayers is for players and isosurvivor is for NPCs. except ISOSurvivor is not finished.

raven epoch
#

i thought isosurvivor was really old?

#

it works?

silent zealot
#

Nope.

raven epoch
#

shame

silent zealot
#

It exists. There was a mod a loooooooong time ago thatt tried to make it work.

raven epoch
#

do they spawn as a character or?

#

rn do they not work at all

silent zealot
#

It's likely a dead end unless you are willing to go as far as making a java mod.

raven epoch
#

na only know lua

#

annoying thing is

#

isoplayers cant run for some reason?

#

seems to do with pathfinding

silent zealot
#

You'd have to figure out a way to try, AFAIK IsoSurvivor is almostt unused but is left in because a few things do something with it.

raven epoch
#

i wonder if i can

#

make a campaign like map with npcs

silent zealot
#

You'd be fighting with the code a lot I expect, sincec IsoPlayer is supposed to be reacting to player input not an AI script

raven epoch
#

thats what im aiming for rn

raven epoch
#

they got functions like

#

setNPC

#

and NPCsetAiming

#

that do work

#

i even tried to get them to try to drive cars though that one doesnt work

silent zealot
#

Found where IsoSurvivor is used: for character avatars, like the character select screen.

raven epoch
#

oh so thats

#

yea makes sense

#

otherwise isoplayer there would have input i guess

#

going to try to figure out this pathfinding annoying thing

#

when the player moves far away from where they are pathfinding i reset their path

#

but that causes them to stop for a second or so

#

no idea how zombies do it seamlessly

silent zealot
#

Zombies don't do it seamlessly, they stop and think and shamble in a new direction when the player is far away

raven epoch
#

no when they are chasing the player

silent zealot
#

and even that gets faked once they are off screen a bit

raven epoch
#

when i run they stop to recalculate the road

#

which looks weird

silent zealot
#

got you, not sure. The Zomboid AI is... well it's artificial.

#

I tried to make sense of some basic animal behavior code and I'm not suprised there is a lack of animal mods.

raven epoch
#

do they use

#

state machines or behaviour trees

#

or

#

what do they use

silent zealot
#

Chaos

#

Pure

#

Chaos

raven epoch
#

waat

silent zealot
#

it made no sense and I am amazed it worked

#

For a given value of "worked" he said as he watched a cow run back to his base and systematically destroy every wall.

raven epoch
#

LOL

#

a

#

ok i think i got an idea

#

maybe they dont stop following the old path till the new one is calculated?

#

though thats going to be

#

very annoying to implement

silent zealot
#

IsoZOmbie has it's own versions of those

#

Also, there is a very good chance what you want is in the java

raven epoch
#

ye true

#

hold on lemme try me idea

#

nah my npc logic in general needs a rewrite

#

its over

#

cooked

#

hold on i think i found the problem with the damage thing

#

something is constantly setting their health to 100?

silent zealot
#

Maybe if they have no wounds?

raven epoch
#

i did try setbleeding i think

#

they do not bleed

silent zealot
#

like a player healing over time, except the heal rate is bugged

raven epoch
#

they only die to 1 hit things

#

so zombies catching them or 100 damage

silent zealot
#

what is the actual goal behind damaging them?

raven epoch
#

so player can fight t hem

#

just shooting with guns does not seem to damage

#

so thats why im manually doing it

silent zealot
#

You shouldn't need to manually set the damage, it should be handled with a bunch of stuff based on player/target/weapon

raven epoch
#

but that doesnt work either

#

very weird

#

u might be right with a bugged healing rate

silent zealot
#

This is possibly one of those times you need to fight the game. Because normally an IsoPlayer can never damage another IsoPlayer unless there is a multiplayer server involved.

raven epoch
#

well it doesnt have to do with isoplayer to isoplayer right now i think

#

since we are doing it manually

#

the onweapon hit event does fire too

silent zealot
#

But you're using IsoPlayer in a way it was not intended to be used.

raven epoch
#

when i set their health manually to 10 and i run it for a few frames its back to 100

#

maybe healing rate is duplicated?

#

because of player count?

silent zealot
#

You probably need to dig through the decompiled java

raven epoch
#

yk i got an idea for a worst case scenario

#

if ZombRandom(1,10) == 1 then
Damage(99999)
end

#

no ones going to notice

#

or i could just simulate their health myself now that i think about

silent zealot
#

Lol

#

You're goingvton have to rewrite the entire game at that rate

civic galleon
silent zealot
#

Forgot half-assed efforts like "moodles in Lua", we need "Project Zomboid in Lua" 🤣

civic galleon
#

Rust rewrite time

icy night
#

Heys so I was loading the game and one of the tooltips said shoes determine the loudness of your steps? But that's not a given value when defining shoes, so does anyone know how that works?

#

Unless StopPower is what controls the noise too

#
    {
        DisplayCategory = Clothing,
        ItemType = base:clothing,
        Icon = BootsARmy,
        BiteDefense = 100,
        BloodLocation = Shoes,
        BodyLocation = base:shoes,
        ClothingItem = Shoes_ArmyBoots,
        ConditionLowerChanceOneIn = 20,
        ConditionMax = 30,
        Insulation = 1.0,
        RemoveOnBroken = false,
        RunSpeedModifier = 0.9,
        ScratchDefense = 100,
        StompPower = 2.5,
        WaterResistance = 0.8,
        WindResistance = 1.0,
        WorldStaticModel = Boots_Ground,
    }```
#

Here's an example of a shoe

bronze yoke
#

there is a check that halves the volume of your footsteps if you are not wearing shoes, otherwise the kind of footwear doesn't seem to matter

icy night
#

hm

#

This is what I had read, for context: UI_quick_tip28 = "Your footwear will change your movement speed, your stomping damage, and how much noise you make when moving.",

#

But yeah, it probably just means shoes vs barefoot, like you said

bronze yoke
#

it also doesn't change movement speed 🤫

#

i'm pretty sure stomping damage is real though

icy night
#

stupid that they still havent implemented that for shoes

outer crypt
#

I haven't found a fix to this yet. Previously I was able to change an existing sprite into an item container and it would update for everyone in multiplayer. It was created client side and it makes sense that won't work anymore. Each client would create their own and make the original disappear. So I moved it server side. It removes the old sprite and has no errors but does not update the clients afterwards.

#

I thought the square transmit lines would update the clients, is there something new that needs to be done instead?

willow tulip
outer crypt
#

I have no idea how to do that. If you have an example, willing to learn 🙂

bronze yoke
#

does the object appear if the client unloads the area and returns?

outer crypt
#

Worth a try, it could be waiting for the square to reveal again.

bronze yoke
#

if no, you are not adding the object correctly even on the server

#

if yes, the issue is purely in transmitting it to the clients

outer crypt
#

You are correct, I just came back and it loaded, so its just not being updated to the clients.

bronze yoke
#

here's how i add objects on the server:```lua
local obj = IsoObject.getNew(square, sprite, "", false)
square:transmitAddObjectToSquare(obj, -1)

#

ah yeah, that's your issue

#

you add the object before transmit, but transmit only does anything if the object hasn't been added yet (it adds it for you)

#
public void transmitAddObjectToSquare(IsoObject obj, int index) {
    if (obj != null && !this.objects.contains(obj)) {
        this.AddTileObject(obj, index);
        if (GameClient.client) {
            obj.transmitCompleteItemToServer();
        }

        if (GameServer.server) {
            obj.transmitCompleteItemToClients();
        }
    }
}
outer crypt
#

Thank you so much!

knotty stone
#

@bright fog Physics and items are still missing, for door, it was neccessary for animating as i remember(its been a while xD). Only "strange" thing is i remember just havin door{} empty is sufficent, but KI5 has the anim down to install/uninstall wrapped, doesnt seem to make a difference.

mellow frigate
#

Hello there, has someone already been able to remove some world context menu options that are added by vanilla java code ? (e.g. Generator submenu when right clicking on a tile with a generator ?)

bronze yoke
bright fog
#

It's always just done with the name of the option

mellow frigate
#

thx a lot

mellow frigate
#

Today, I had two problem reports with reproduction procedure and stack trace. This is a good day.

mellow frigate
#

Do I still need to warn MP users when I remove files from somewhere in a pre-existing mod during an update ?

bronze yoke
#

yes -- when possible you can switch version folders to avoid this though

mellow frigate
#

I was forced to remove the file from common because it took priority of the shared from 42.13 folder

bright fog
#

Basically if you want to remove files, you can simply increment your version folder version, if possible, so older technically deleted files will exist in a different folder not checked by the game

bright fog
#

And heavy assets in common only

bronze yoke
#

basically if your mod is in 42.12 and you want to delete a file, you can copy to 42.13 and remove the file safely since the existing users don't have a 42.13 folder yet

#

of course you can't do this in many situations such as your own

mellow frigate
#

Is the workshop itself keeping a version of each file I once uploaded ?

bright fog
#

It will only live in the player's folders

#

Just rename your versioning folder like 42.12 to 42.13

mellow frigate
bright fog
#

And done

#

Tho in your case you can't for now

bronze yoke
bronze yoke
bronze yoke
#

a new user subscribing to your mod to play on 42.12 does not have that version if you removed it

bright fog
#

That was an example I gave

#

Not taking into account the fact people can play on 42.12

#

Take 42.9 and rename to 42.10

#

Here

bronze yoke
#

anyway since it's in the common folder you'll just have to remove it and warn people

bronze yoke
#

GOG can often be several versions behind so it's nice for them at least

frank elbow
#

Related to this topic: I'm not sure I understand why I'd want to use the version folders at all until I need them (versioning is the obvious benefit, but for the initial version, I mean). It seems like others are using 42 by default, though. Why is that?

bright fog
#

Bcs you'll end up like Tcherno if you don't

frank elbow
#

That is, by default I've just been putting everything save for mod.info in common & if I need a per-version override I intend to use a version folder

bright fog
#

Where you've had code in the common and now you're fucked

frank elbow
#

What's wrong with the “deletion” method from before?

bright fog
frank elbow
#

By deletion method I mean clearing the file without deleting it, as was done for b41

bright fog
#

So if you delete in common, you literally can't do anything about it and users will end up with files still in this folder unless they do a clean reinstall

bright fog
frank elbow
#

So other than that, why?

bronze yoke
bright fog
frank elbow
frank elbow
bright fog
#

Sure you can simply not give a shit about it, but the moment you get a new 42.13 breaking everyone's mod and you need to have two versions of the your mod, now you're absolutely fucked and have to use shitty tricks to "delete" files

bronze yoke
#

i don't think i've *ever* actually needed to override common, i only put things in common that i expect to be universal such as assets

#

of course that means i have far more duplicate files than if i had working in common to begin with, but that would also mean my codebase would be weirdly fragmented between the two when i needed to start overriding

#

also i don't know how you'd get emmylua to understand that the lua files in common are used, except file A is not used in favour of 42.13's file A

frank elbow
#

I think I'd prefer single file overrides of only the logic that requires overriding—I'm okay refactoring when the time comes. But those reasons make sense & maybe I'll reconsider with some more thought. Thanks y'all

frank elbow
bright fog
#

Like I said, it costs nothing to do it, and it'll cost you everything when you need to do it

frank elbow
#

I don't think it'll cost everything

bronze yoke
#

i will note one major downside: version folders basically wipe git history every time you increment them, and make old branches unmergeable

bright fog
#

It'll cost you changing your whole mod structure and that's problems

bronze yoke
#

i'd like to look into some of these build systems people have developed to get around that but i haven't been putting much energy into modding lately

frank elbow
#

I don't intend to change my mods' structure for a minor refactor for a logic change

bright fog
frank elbow
bright fog
#

And you can't do that if everything's in the common folder

bronze yoke
#

i think there's a few of them, i just don't think anyone really uses them except maybe the creators?

frank elbow
bright fog
frank elbow
bright fog
#

42.13 nuked every single mods out there

#

And saves could not be upgraded to 42.13

#

So a big chunk of people stayed on 42.12

frank elbow
#

Maybe I'm overconfident in my refactoring ability and it'll be my downfall 🤷🏽 I'm not too worried as of now

bright fog
#

If you update your content to 42.13, it wouldn't work for 42.12, so you would possibly break people's mods if you did not support that older version

#

And a significant chunk of them

#

That's the point of the versioning folder, significant version changes that force some users to stay on older version if they want to continue their saves

#

It's rare, but we got our first demonstration of it

frank elbow
#

I understand the versioning benefit & would use it for that purpose

bright fog
#

That's the conclusion of it

bronze yoke
#

i'd like a build system with just a src directory that hides all the versioning from me, mostly for the vcs consequences i mentioned earlier

frank elbow
frank elbow
#

Plus it'd open the door for stuff like code generation, macros

bright fog
#

You retrieve them from tags of your git or something like that ?

bronze yoke
#

yeah something like that, i don't modify them anyway and i could move the tag if i really had to

frank elbow
# bright fog But what's the drawback ?

I don't like the idea of duplicating code and messing up the git history for versioning unless necessary. If I write a versioned file it's going to be written with the intent of addressing what needs to be addressed, rather than having a duplicate of the file with stuff changed

#

But that's just my preference

bright fog
#

It'd be nice if they had a folder like "main" alongside the common folder

#

tho idk how it'd handle selecting if it should load from main or versioning folder

bronze yoke
#

what would that do?

bright fog
#

Load main or versioning, so you don't rename your main code folder

#

And you keep the versions

#

And whenever you need to support an older version, you duplicate its content into an older version

frank elbow
#

Assuming the version folder code stays as it is post-42, it seems like the 42 folder serves that purpose unless I've misunderstood?

bright fog
#

So say a player is on 42.12.3 and the mod has such a folder, it'd load that one, and if there isn't a folder of that exact version, it loads the main one

bright fog
bronze yoke
#

i don't really see the purpose compared to version folders

bright fog
#

The reason everyone uses 42 is because there was no need for the versioning before, until we got 42.13

frank elbow
#

Ah right, because it just uses all the content from the highest one

bright fog
frank elbow
#

I think I understand the distinction

bright fog
#

Which is what bothers Omar

#

So I was thinking of a solution to keep it

bronze yoke
#

ah yeah i guess you could fork off versions when they were no longer needed and do all your development in main

bright fog
#

Yup

#

That'd remove the need for a build system

frank elbow
#

Now that the word macro has escaped my lips (or fingers, since we're typing) I'm dreaming of #ifs and #endifs (with version comparisons) either way

bright fog
#

Which like we discussed in the past not very needed with the way PZ is designed and adds some extra steps to test your changes

frank elbow
#

But idk if I can see a way to do that in plain Lua that wouldn't confuse EmmyLua

frank elbow
#

Version comparisons in the Lua code within the src folder which change the emitted code for each version

bronze yoke
#

yeah i've considered it too but i feel the debugging downsides (line numbers not matching up, code potentially not either) and language server confusion probably wouldn't be worth it

bright fog
#

Aaah to have different code based on the version ? You can technically do that, but yea EmmyLua's going to go absolutely insane

#

I also am not sure if that'd be good practice for the long term handling of your mod

#

10 versions later, if elseif version hell

frank elbow
#

Hey, if C devs can do it then I can—legends say that no bug has ever been written in C

#

Yeah that's fair, I would hope it wouldn't need too many of them though

bronze yoke
#

personally i don't care about older versions beyond them being available, if they have unique bugs or missing features or whatever that doesn't bother me

#

there are some other compelling reasons for preprocessing though

#

there's a script out there that flattens all local function calls that always tempts me

frank elbow
#

Ooh

#

I was only thinking about moving initialization to preprocessing, perf improvements would be even nicer

late hound
#

Has this been hotfixed yet?

bronze yoke
#

no

#

i'd probably expect it to wait until 42.14 now

late hound
#

I have some people trying to tell me off, saying I am wrong that this problem doesn't exists. 🙄

late hound
neon hamlet
#

So, no matter what I change in my mod - I keep getting the same error everytime. I've adjusted the model, changed the name a couple of times, re-did the code. I have no idea what to do, any ideas? --- This is for a weapon I'm trying to get into the game, B41.

icy night
#

Which is safer: Re-writing a whole vanilla script or simply hooking on to the script to change the functions you want changed?

#

I assume the latter but Ive seen a lot of big modders do the first

frank elbow
#

Your assumption is correct; a mod being popular doesn't always mean its code is the best role model 😅 No offense intended to those mods, of course

#

If something can be achieved without overriding an entire file then it probably should be

icy night
#

alr, thx. Wanted to make sure

willow tulip
#

Also, full overrides are less likely to work correctly next zomboid update if you don't update your code to match any vanilla changes

neon hamlet
winter bolt
neon hamlet
winter bolt
#

you need to add weapons/2handed to the start of the file path i mean

#

its looking for the model in media/models_x

violet obsidian
#

Hi all, I'm just wondering how should I properly spawn an item in the multiplayer environment? I'm trying to spawn something on zombie's corpses, but there's a bug in my current code - sometimes I can see the item on my end, but I cannot pick it up, and other players cannot see it. So the mod currently works fine in SP, but buggy in MP. Thanks in advance if anyone could give some advise/guidance. https://github.com/buguniao55555/zombie-cure

GitHub

Contribute to buguniao55555/zombie-cure development by creating an account on GitHub.

winter bolt
#

wait nvm im stupid its already in the server

winter bolt
#

this should work

winter bolt
#

im assuming antibiotics are meant to be the most common of the item drops but i think your code accidentally makes it the rarest

violet obsidian
winter bolt
# violet obsidian We are updating an old mod so that's the logic of the original author, but yeah ...
local items = {
    "Antibiotics",
    "ZombieCure.ZombieCureMed1",
    "ZombieCure.ZombieCureMed2",
    "ZombieCure.ZombieCureMed3",
    "ZombieCure.ZombieCureMed4",
    "ZombieCure.ZombieCureMed5",
}
local function ZombDropextra(zombie)
    if (ZombRand(1000) <= 5) then
            local randomItem = items[ZombRand(1, #items)]
            
            local item = instanceItem(randomItem)
            local inv = zombie:getInventory()
            inv:getInventory():AddItem(item)
            sendAddItemToContainer(inv, item)

            print("Spawning item on zombie: " + randomItem)
    end
end

i think something like this will work and then you can just add multiple of some items to the list to change the chances

mellow frigate
silent zealot
#

They didn't even bother looking at the top few comments before asking. 😭

umbral raptor
#

Hi! Need some help, I think the devs changed how defining bodylocations for clothes works. Can someone tell me what exactly changed? Here's my old script

local group = BodyLocations.getGroup("Human")
group:getOrCreateLocation("MALeftArm")
group:getOrCreateLocation("MARightArm")
group:getOrCreateLocation("MAHAZMAT")
group:getOrCreateLocation("CarrierVest")
group:getOrCreateLocation("Cloak")

#

Haven't modded in a long time now, haha

mellow frigate
#

Fun fact: last 2 digits of the player position on x & y axes are always 25 or 75 (b42.13.1 MP, client side). I wonder if this is due to [display rounding] / [mod data storing] / [something multiplexing info in less significant part of floating number] / [a mix of those] / [something else..]

mellow frigate
umbral raptor
#

couldnt find anything in pinned messages.

umbral raptor
#

Oh shit, do I have to put base: before all base game body locations and my mod's name before new body locations?

bright fog
neon hamlet
bright fog
#

texture=R

#

uh

#

Also

#

You shouldn't have media/model_x

#

Also isn't it models_X ?

#

Yes it should be models_X

red plank
#

Allo! Just a quick question. Under what file can I find the UI for exercise?

neon hamlet
bright fog
#

You didn't take the time to read it properly

#

Because it's pretty clear you're doing something wrong

#

I've seen you on this model issue for a while now

neon hamlet
#

okay - i verified them, and even did a quick test run of just putting the model FBX in the models_x folder as is.. still nothing.

bright fog
#

And show your model full path

#

Show your file

#

Show all of these

red plank
neon hamlet
#
{
    imports {
        Base,
    }

item AkiBlade
    {
        MaxRange    =    1.35,
        WeaponSprite    =    AkiBlade,
        MinAngle    =    0.8,
        Type    =    Weapon,
        MinimumSwingTime    =    3,
        KnockBackOnNoDeath    =    TRUE,
        SwingAmountBeforeImpact    =    0.002,
        Categories    =    LongBlade,
        ConditionLowerChanceOneIn    =    25,
        Weight    =    5,
        SplatNumber    =    3,
        PushBackMod    =    0.3,
        EnduranceMod    =    2,
        SubCategory    =    Swinging,
        ConditionMax    =    15,
        MaxHitCount    =    5,
        DoorDamage    =    60,
        IdleAnim    =    Idle_Weapon2,
        SwingAnim    =    Heavy,
        DisplayName    =    Belle's Blade,
        MinRange    =    0.61,
        SwingTime    =    3,
        HitAngleMod    =    -30,
        SplatSize    =    5,
        KnockdownMod    =    3,
        SplatBloodOnNoDeath    =    TRUE,
        Icon    =    LLP,
        RunAnim    =    Run_Weapon2,
        TwoHandWeapon = TRUE,
        SwingSound = WoodAxeSwing,
        DoorHitSound = WoodAxeHit,
        HitSound = WoodAxeHit,
        HitFloorSound = WoodAxeHit,
        BreakSound = WoodAxeBreak,
        TreeDamage  =   55,
        MetalValue = 120,
        CriticalChance    =    50,
        CritDmgMultiplier = 12,
        MinDamage    =    1.3,
        MaxDamage    =    1.6,
        BaseSpeed = 1,
          WeaponLength = 0.65,
          RequiresEquippedBothHands = TRUE,
        DamageCategory = Slash,
        DamageMakeHole = TRUE,
        AttachmentType = BigBlade,
        Tags = ChopTree;CutPlant,
  }
}

Zomboid\mods\TestingMod\media\models_X\weapons\2handed\AkiBlade.fbx

I'm not sure which part you mean by file tho - Like send over the mod file entirely?

mellow frigate
#

Thats for B41 or earlier right ? Zomboid\mods\TestingMod\media

bright fog
neon hamlet
#

yeah, i'm on b41

#
{
    {
        mesh = 2handed/AkiBlade,
        texture = R,

        attachment world
        {
            offset = 0.0000 0.0000 0.0000,
            rotate = 0.0000 0.0000 0.0000,
        }
    }
}
#

mb

bright fog
#

Yea no shit that doesn't work lmao

#

Wasn't that the same issue you had last time ???

#

Where is your model definition here ?

#

I'm not joking, go read that wiki page, you did NOT read it

verbal yew
#

Hey guys, how can I determine that what's in the hands is actually a melee weapon and not a flashlight? (42.13.1)

bright fog
verbal yew
#
    local mhweapon = player:getPrimaryHandItem()
    if not mhweapon then
        return
    end
    local mhIsMeleeWeapon = mhweapon:getStringItemType()
    -- zReTIPS доп проверки
    if mhIsMeleeWeapon and mhIsMeleeWeapon ~= "MeleeWeapon" then
        print("Nah")
        return
    end

?!

bright fog
#

Why getStringItemType ?

#

Weapons are InventoryItems but more importantly they are HandWeapons

verbal yew
bright fog
#
if instanceof(mhweapon, "HandWeapon") then
    print("yes"
end
verbal yew
bright fog
#

Yes

#

But you can check for that too

verbal yew
#

but why i cant check this? getStringItemType()

bright fog
#

Your item ALREADY has functions to check if it's a firearm or not, if it's a weapon

#

Also I'm fairly certain that getStringItemType returns HandWeapon

#

Because it's the ItemType

#

And ItemType are ... handweapon, drainable etc etc

bright fog
neon hamlet
# bright fog Yea no shit that doesn't work lmao

Okay, please assume i know little to nothing about modding bc i really don't. I'm getting by on what I know and what little videos there are out there for weapon mods -- That link you sent is for b42. The link they have for b41 is basically the same thing, just less organized. A of now i've re-read it twice, going for a third after i send this message. If you see what's wrong please tell me or point me toward what exactly I'm meant to be reading because I don't see anything in the b41 wiki page about model definition.

bright fog
bright fog
#

Also I have explicitly told you what the problem is here

verbal yew
bright fog
verbal yew
#

nah, all fine...

#

should sleep

neon hamlet
#

but i'm not on b42, i'm on b41. And yes. I had copied it on the very first attempt of the mod, I had the static in there and i included the scale code bit as well before removing it

And again. "point me toward what exactly I'm meant to be reading because I don't see anything in the b41 wiki page about model definition."

and i don't see anything about model definition in the b42 wiki link either

verbal yew
#

or another not melee weapons stuff

#

now all fine

#

jesus...

bright fog
#
model Burger
{
    mesh = Burger,
    scale = 1.5,
    static = true,
    texture = BurgerTex,

    attachment Bip01_Prop2
    {
        offset = 0.0142 0.0401 0.0000,
        rotate = -23.3606 21.2788 37.5386,
        scale = 0.8280,
    }
}
#

Now read your code ? What are you missing ?

#

Spoiler: it's the first line

#

You do not define a model here

#

You can find plenty of examples of this in the vanilla code, in other mods, even the rare videos and guides about adding items must be showing this at all time

raven epoch
#

how do i emit particles?

bright fog
raven epoch
#

yep

bright fog
#

Uuuh I don't remember how, I'd suggest looking at the pipe bomb code

raven epoch
#

okey ty

#

ah actually i will just play a sound instead

#

ok for some reason

#

when you crouch

#

all isoplayers crouch as well

#

which is very annoying

neon hamlet
#

added it in, still nothing same error - so either it was never that or now my other bits of code are wrong

bronze yoke
#

that was absolutely a major issue regardless of whether it fixed it fully, a model script with no type will never ever work

verbal yew
#

if i want inject func

require "TimedActions/ISInventoryTransferUtil"

ISWorldObjectContextMenu = {}
ISWorldObjectContextMenu.fetchVars = {}
ISWorldObjectContextMenu.fetchSquares = {}
ISWorldObjectContextMenu.tooltipPool = {}
ISWorldObjectContextMenu.tooltipsUsed = {}
ISWorldObjectContextMenu.tooltipInvPool = {}
ISWorldObjectContextMenu.tooltipInvUsed = {}

ISWorldObjectContextMenu.grabItemTime = function(playerObj, witem)
    local maxTime = 120;
    -- increase time for bigger objects or when backpack is more full.
    local destCapacityDelta = 1.0;
    local inv = playerObj:getInventory();
    destCapacityDelta = inv:getCapacityWeight() / inv:getMaxWeight();

    if destCapacityDelta < 0.4 then
        destCapacityDelta = 0.4;
    end

    local w = witem:getItem():getActualWeight();
    if w > 3 then w = 3; end;
    maxTime = maxTime * (w) * destCapacityDelta;

    if getCore():getGameMode()=="LastStand" then
        maxTime = maxTime * 0.3;
    end

    if playerObj:hasTrait(CharacterTrait.DEXTROUS) then
        maxTime = maxTime * 0.5
    end
    if playerObj:hasTrait(CharacterTrait.ALL_THUMBS) or playerObj:isWearingAwkwardGloves() then
        maxTime = maxTime * 2.0
    end

    if playerObj:isTimedActionInstant() then
        maxTime = 1;
    end

    return maxTime;
--    local w = witem:getItem():getActualWeight()
--    if w > 3 then w = 3 end
--    local dest = playerObj:getInventory()
--    local destCapacityDelta = dest:getCapacityWeight() / dest:getMaxWeight()
--
--    return 50 * w * destCapacityDelta
end

its right?:

require "TimedActions/ISInventoryTransferUtil"

local originalGrabItemTime = ISWorldObjectContextMenu.grabItemTime
function ISWorldObjectContextMenu.grabItemTime(playerObj, witem)
  local maxTime = originalGrabItemTime(playerObj, witem)
  maxTime = maxTime * 0.4  -- Уменьшаем на 60%
  return maxTime
end
bright fog
#

When you reference it, you need to reference it with the module too

#

In item script

raven epoch
#

whats wrong with this?

#

it says invocation target exception

#

even though i copy pasted it from admin commands lua

frail violet
#

Wait, we need to have separate folders for 42.12 and 42.13?

quartz ibex
#

offhand are there any items that are also workstations? Specifically I'm looking at making a book a workstation

#

I figured I'd look through examples, but I'm unsure what a good example to work off would be.

neon hamlet
bright fog
#

The problem is that you don't reference its module

neon hamlet
#

okay, and where/how should I reference it?

bright fog
silent zealot
# frail violet Wait, we need to have separate folders for 42.12 and 42.13?

You can, if you want to support 42.12 and 42.13. Personally I use git on my mods and tell people if they really want to rollback they can checkout the previous version, but if one of mods would break the game if removed (as opposed to just losing access to the stuff in the mod) I'd setup 42.12 and 42.13 folders.

silent zealot
#

Not a workstation, which AFAIK have to be a world object and not an inventory item, but same idea.

quartz ibex
neon hamlet
# bright fog Where you use it ?

i meant like .. what would the code look like? Idt I understand what you're getting at - should I just change all my modules into base?

bright fog
#

Your model is TestingMod.WhateverID you gave it so it needs to be refered as TestingMod.WhateverID

neon hamlet
#

in the model script?

bright fog
#

question to yourself, I already know where you use it

#

Do you understand where that model script is being used ?

neon hamlet
#

i don't think i do

bright fog
#

In your item script you need to define what model it uses at some point right ? And if I'm not mistaken you have already done that, but improperly that's what I've been talking about for the past convo we had

neon hamlet
#

ah - if i've corrected it then i'm assuming you mean weapon sprite? In which case the TestingMod.XID goes there instead of just the name of th eID

bright fog
#

Look at all your parameters and try to think about which one defines your model

neon hamlet
#

nodnod

#

i'll try that

bright fog
#

Tho I never remember if that's the exact parameter for models for weapons, I believe so but I'm never sure

#

Can easily check that in existing weapon definitions

bright fog
bright dawn
wintry tree
#

does everything need to be in lower case, like file names, for mods to work on Linux?

#

Nvm, I'm seeing multiple sources that say it's best practice. Alright then lol

red plank
#

So! I'd like to ask 2 related questions:

  1. Where is the player class actually located? I'd like to see what methods it has and all
  2. Where are the codes included in recorded media for stats and skills handled? Like... how does "BOR-1" get turned into a decrease in boredom?
rustic garnet
#

Hey guys, how can I get intellensense and acess to the source code from PZ while in my project. Back in the day you could decompile the java and add it alongside the lua.

Is there a new way to just add the lua to my IDE(Jetbrains Idea) just to see what are inside classes and functions and get the intellisense

raven epoch
#

if u mean u want autcomplete etc for lua functions u need

#

umbrella

rustic garnet
#

I want to be able to see the vanilla code while coding not just the auto complete.

Like adding a lua library to a project where you can reference and see the source code

raven epoch
#

oh idk

raven epoch
red plank
# raven epoch does this look good

Wait a sec, is it only that one soldier, or are there other ones facing the checkpoint as zombies drop dead?
Because other than the "shooting backwards" angle, it's super cool!

raven epoch
#

there are 4 soldiers its hard to see because of quality

#

and the gun bursts are supposed to be a machine gunner in the background

raven epoch
#

ty btw

#

ye im gonna change it so they face the road at first

red plank
raven epoch
#

its supposed to be like a scripted sequence

red plank
raven epoch
#

where military is distracted by zombie raid so u can sneak in

red plank
raven epoch
stoic ginkgo
#

how do you do that

bright fog
stoic ginkgo
#

oke

stoic ginkgo
#

my man

knotty stone
#

So, i wanted to add repairwithepoxy itemScript:DoParam("Tags = base:hasmetal;base:firearm;base:repairwithepoxy")
to guns, but they are not getting listed in the craftingmenu, is Events.OnGameStart to late or smth else i can do?

bright fog
#

But when the recipe gets loaded it will actually retrieve the items with the tags defined and that's it

#

So it won't find your items since you add their tags with Lua ?

#

Might be something @buoyant violet came across, idk

knotty stone
#

yea recipe stuff is rly wonky <.<
tried to adjust a recipe with sandbox setting, game said "how about no"

bright fog
buoyant violet
#

Alternatively I guess you could create a submod that runs before doing thr params on such items. And a mod that loads after adding the recipes

buoyant violet
#

Just overwritten what I need on the item via item definition

Module Base {
Blah
{ Tags = blah blah}
}

#

Zscript is doom lol

merry grove
#

hey how to make a seprate version for B 42.12 ?

#

A lot of pepole complain my mod is now broken on it

buoyant violet
#

Just have a folder for 42.12

merry grove
#

So just new folder named 42.12 ?

buoyant violet
#

Yeah

merry grove
#

So like this and 42.0 will be for also 13 or

#

Do I need to name it 13

bright fog
#

So 42.12 is the closest so it's the one that will be used for 42.13

merry grove
#

Alright so just name it 42.12 for old and 42.13 for new

knotty stone
#

thx for your input Marz, but scripts are exactly what i wanted to avoid 😅

bright fog
#

You can keep the 42.0 for 42.12 too

#

So you could have 42 and 42.13

#

And 42.13 is used for 42.13+ and 42 for < 42.13

merry grove
#

Alright thx

#

hm

#

Now it just breaks completly

violet obsidian
merry grove
#

From what I understand something wrogn with the function onZombieDead
maybe they changed how loot spawning on bodies work

violet obsidian
#

Yeah I guess so, but I'm not sure how I should fix it hmm

merry grove
#

Running --dubug might help you

#

It usually points to exactly where it fails

violet obsidian
#

The error log is actually complaining this line: sendAddItemToContainer(inv, item)

merry grove
#

Also I have a issue for some reason it shits the bed when trying to get modId

violet obsidian
#

So it works fine in SP, but gives error on MP server side

merry grove
#

Only with the old version

#

id=MattSimpleAddonsFriutsOld
This is how it is in the file

#

Works perfectly fine on the new version with 13
but on 12 it shits the bed

#

Folders look like this. 42.13 works perefctly

#

under it fails

#

but under under thoes it works fine again

frank elbow
merry grove
#

Well it exists

#

function: reloadMods -- file: ModSelectorModel.lua line # 67 | Vanilla
function: onMenuItemMouseDownMainMenu -- file: MainScreen.lua line # 1538 | Vanilla

ERROR: General f:0, t:1767535176892> ExceptionLogger.logException> Exception thrown
java.lang.RuntimeException: attempted index: getId of non-table: null at KahluaThread.tableget(KahluaThread.java:1462).
Stack trace:
se.krka.kahlua.vm.KahluaThread.tableget(KahluaThread.java:1462)
se.krka.kahlua.vm.KahluaThread.luaMainloop(KahluaThread.java:458)
se.krka.kahlua.vm.KahluaThread.call(KahluaThread.java:166)
se.krka.kahlua.vm.KahluaThread.pcall(KahluaThread.java:1754)
se.krka.kahlua.vm.KahluaThread.pcallBoolean(KahluaThread.java:1690)
se.krka.kahlua.integration.LuaCaller.protectedCallBoolean(LuaCaller.java:96)
zombie.ui.UIElement.onMouseDown(UIElement.java:1244)
zombie.ui.UIElement.onMouseDown(UIElement.java:1214)
zombie.ui.UIElement.onMouseDown(UIElement.java:1214)
zombie.ui.UIElement.onConsumeMouseButtonDown(UIElement.java:1497)
zombie.ui.UIManager.updateMouseButtons(UIManager.java:726)
zombie.ui.UIManager.update(UIManager.java:615)
zombie.GameWindow.logic(GameWindow.java:298)
zombie.GameWindow.frameStep(GameWindow.java:790)
zombie.GameWindow.mainThreadStep(GameWindow.java:552)
zombie.MainThread.mainLoop(MainThread.java:68)
java.base/java.lang.Thread.run(Unknown Source)
LOG : General f:0, t:1767535176892> -----------------------------------------
STACK TRACE

function: reloadMods -- file: ModSelectorModel.lua line # 67 | Vanilla
function: onMenuItemMouseDownMainMenu -- file: MainScreen.lua line # 1538 | Vanilla

#

And this says exactly the same thing

merry grove
winter bolt
bright fog
#

The zombie container does exist

#

Just its content was initialized

merry grove
#

And it is nil

bright fog
#

But you can add content to it when OnZombieDead

bright fog
#

It's always something shitty everytime I got that error

merry grove
#

it exists and there is no mistakes as its a DIRECT copy from og

bright fog
merry grove
#

only thing that is change is version min

bright fog
#

With so little context I can't judge more

merry grove
#

Working

#

Not working

bright fog
#

You have a common folder ?

merry grove
bright fog
#

What's in the common ?

merry grove
#

nothing