#mod_development

1 messages ยท Page 206 of 1

fast galleon
#

This only changes the style of your code and where you make the checks.

#

It's not an error fixer.

valid steppe
#

Anyone willing to do a remington 700 commission just to replace the skin of the msr700 and msr788? I want to keep the rest of the stats and magazine capacity and stuff vanilla

void cargo
#

Thank you from the future ๐Ÿ™‚ I'm gonna try this out later

#

@valid steppe I saw another PZ discord with a channel for commission requests, will dm

valid steppe
#

Sweet thanks

limber geyser
#

Iโ€™m looking to get into modding. I would like to start with changing pill durations like to antidepressants from two hours to three hours. I opened up the script file for items, I didnโ€™t see a line in the code under antidepressants that was for duration. Can anyone point me in the right direction?

verbal yew
#

notepad++, ctrl + F

nova socket
#

Is there a way to ask devs a question without tagging them?

#

Need to know what is the exact load order of lua files.

#

Wild guess is that anything in base media/lua is loaded first but I have to know if it is true.

fast galleon
#

you don't need to ping devs for this, you need to use search or check the logs

nova socket
#

But according to log it does seem to be that way

fast galleon
#

@nova socket

boreal garnet
#

looking for the file that governs reloading skill XP stressed

nova socket
boreal garnet
heady crystal
#

Does anyone here know how to trigger an animation?

#

Preferably through setVariable

upper sapphire
#

Hey guys! Can you help me out, please? I'm a real newbie at pz modding. I need to spawn a car and some items on the first launch of a server. I've found the functions I need already, but what event should I use?

lunar shore
#

How does a campfire make ashes and in which file to search for this function?

sour island
#

I vaguely recall discussing zombie and custom AI here a while back, did someone figure out how to track zombies consistently without using outfitIDs?

#

Wish discord had personal pins

#

I know you can retain modData using reanimatedPlayer but being this could be for alot of zombies, that will tank the savefile size.

#

Also, looking through the java a bit to see if there's anything abusable - I don't see a place where zombie modData is thrown out.

nova socket
#

Because you cannot just spawn anything in unloaded areas

sour island
#

Seems like the zombies are calling load() using super. all the way to objects which have their modData saved ๐Ÿค”

#

I wonder if the modData is getting saved, and just not recovered due to object IDs being inconsistent

mental marlin
#

Hey guys i have a question

#

How difficult is make your mod compatible with other mod

finite yarrow
mental marlin
#

But i reffer you make something like

sour island
#

In general overloading functions properly helps avoid issues - or makes them a load order fixable issue

upper sapphire
mental marlin
#

Crossbow mod and you want to make compatible with like the britass

sour island
#

That's highly dependant on those mods

finite yarrow
sour island
#

You can write a patch

finite yarrow
#

of course!

sour island
#

Not something that comes with a tutortial to do so, though

finite yarrow
#

you gotta be able to code it yourself, as an end user you can't do anything about it, is what i wanted to say spiffo

upper sapphire
# nova socket `When` you need to spawn it will determine the way of doing.

I want to make a simple mod for our upcoming small private game for 5 players. I want to give some players some items from the start (even on a respawn), I've already figured it out - I check player's username on OnNewGame event and give him what I want. But I don't want to spawn items in containers and a car as the game goal manually. So it would be cool if I had an opportunity to spawn it automatically right after a server created the world

sour island
upper sapphire
#

I used a code from "More Traits" mod tho. It spawns sigarettes for smokers from the start

sour island
#

For anyone curious, I found where zombies are told not to load their modData

nova socket
mental marlin
nova socket
#

@upper sapphire Areas (cells) that are unloaded cannot provide any specific information about its content to server, until player physically loads it in by visiting it. So the only way you can spawn anything is using player context, with events.

#

maybe there is a way to forcefully load specific cell i dunno, but I would probably not recommend doing that.

#

I had to deal with such geo before and I just literally bound my stuff to having a loop on server side to lookup if specific squares are loaded or not and then continue to operate with what's inside.

sour island
#

There's systems to schedule loading/events once the area is loaded

upper sapphire
#

Hmmm... What about the idea: there will be some value stored in server's save file. Like SpecCarSpawned = 0. And when the target chunk will be loaded by some player's visit, it will check this value, then spawns a car and set the value to 1

nova socket
#

like @sour island said its better to target squares.

bronze yoke
nova socket
sour island
#
public void load(ByteBuffer var1, int var2, boolean var3) throws IOException {
      float var4 = var1.getFloat();
      float var5 = var1.getFloat();
      this.x = this.lx = this.nx = this.scriptnx = var1.getFloat() + (float)(IsoWorld.saveoffsetx * 300);
      this.y = this.ly = this.ny = this.scriptny = var1.getFloat() + (float)(IsoWorld.saveoffsety * 300);
      this.z = this.lz = var1.getFloat();
      this.dir = IsoDirections.fromIndex(var1.getInt());
      if (var1.get() != 0) {
         if (this.table == null) {
            this.table = LuaManager.platform.newTable();
         }

         this.table.load(var1, var2);
      }

   }

   public void save(ByteBuffer var1, boolean var2) throws IOException {
      var1.put((byte)(this.Serialize() ? 1 : 0));
      var1.put(IsoObject.factoryGetClassID(this.getObjectName()));
      var1.putFloat(this.offsetX);
      var1.putFloat(this.offsetY);
      var1.putFloat(this.x);
      var1.putFloat(this.y);
      var1.putFloat(this.z);
      var1.putInt(this.dir.index());
      if (this.table != null && !this.table.isEmpty()) {
         var1.put((byte)1);
         this.table.save(var1);
      } else {
         var1.put((byte)0);
      }

   }
#

I think I can jerryrig zombiemoddata using readbooks - but it will be ugly as hell

#

Looking around to see if there's another way

nova socket
#

for the case of how to know if area is loaded or not you can either use the mod above or something like this

...
local square = getCell():getGridSquare(x,y,z);
if square then print('So square is now loaded!') end
...

@upper sapphire

#

If square is not nil that means its cell is loaded in. getCell() on server returns a merged information about all currently loaded cells at once in the world.

upper sapphire
nova socket
#

I use my own stuff for schedules

sour island
#

Seems like zombie save their data and don't load them - but on the next load it would be saving a blank table unless it's reused the same way

nova socket
#

@upper sapphire

function IC:sleepDo(seconds, func, condition)
    local time = os.time();
    local targetTime = time + seconds;
    if condition == nil then condition = true end; -- Optional 


    local function OnSleepTick()
        local timeNew = os.time();
        if not condition then 
            Events.OnTick.Remove(OnSleepTick);
            return
        end
        if timeNew >= targetTime then
            Events.OnTick.Remove(OnSleepTick);
            func();
        end
    end
    Events.OnTick.Add(OnSleepTick)
end
#

allows you to use time based schedules, not ticks or frames or whatever.

upper sapphire
#

Thank you, I really appreciate your help, guys

#

I'm going to try it all. But it seems that it's much easier to spawn these few things manually

nova socket
#

Can anyone tell me why some of the object placed through building menu aka ISBuildingObject enables some sort of collision at of north of a built sprite, meanwhile its totally set to be non-solid or non-blocking and it doesn't do that with brush tool?

sour island
bronze yoke
#

i'm looking into it and i'm not convinced zombies usually go through these methods to begin with

sour island
#

I assume when it calls super.save/load it does

#

I'm also not familiar with bytecode stuff

bronze yoke
#

i don't think they usually use save/load is what i mean

sour island
#

ah

bronze yoke
#

the code for reusing zombies doesn't call anything related but i haven't got the full picture yet

sour island
#

so poking around that may not even help me find a way to make a consistent ID

sour island
bronze yoke
#

yeah

sour island
#

is reuse the same as load?

#

I'm looking for a way to identify the same zombie

bronze yoke
#

reuse is how the game recycles isozombie objects to avoid reallocating memory constantly

sour island
#

so that would be garbage collection - for dead zombies

#

or unloaded ones

bronze yoke
#

sort of

#

when a zombie unloads it gets its info reset and added to a reusable pool, when zombies load it checks if there's zombie objects in the pool to use instead of creating new ones

#

so anything it uses to load zombies should probably be called there

sour island
#

and that would be using the load( ?

bronze yoke
#

i don't see load being used anywhere

#

but i don't have the full picture yet

sour island
#

I'll keep looking - poking around chunks and cells

bronze yoke
#

it would make sense with how i understand the zombie architecture to work for them to not truly save/load though

sour island
#

looked at the other similiar mods and they use hashCode() which does very little for what I'd need

#

I would assume OnlineID is consistent

#

even the descriptor object isn't saved lol

#

ah game Character has a flag to only load it in a certain byte condition

#

figured it out

#

๐Ÿ˜ฎ

#

nvm

#

If you set a timed since last smoke it gets saved but it appears to also count down lol

#

oh it's clamped from 1 to 10

#

hmmm

#

well that's interesting

#

time since last smoked is saved, but to the objectID

#

which is recycled

#

This is using the stuff I can find with in save/load @bronze yoke

#

Seems like the game has parallel systems for saving/loading zombies - one looks to be depreciated though(?)

#

I don't see a point to saving object data for recyclable objects

#

The weapon in back changed which outfit it was in

#

This seems to only happen when you reload the game though

#

Anyone able to confirm if onlineIDs are persistent?

old ginkgo
#

Hate to entirely derail the conversation, recently getting back into Zomboid and modding, and I'm trying to pick up a side-hobby I had with trying to expand the base Zomboid chat functionality by adding some interactable buttons to add/remove tabs at a whim and possibly a menu to specifically assign chatstreams to the tabs on the user's end. Anyone familiar with the ISChat.lua and the associated dependencies of "ISUI/ISCollapsableWindow" "ISUI/ISRichTextPanel" "ISUI/ISButton" "ISUI/ISTabPanel" by chance?

I'm trying to figure out how/where the game calls the 'Admin' tab to be created on chat initialization and if I can hook off of that to have it generate tabs on user client button presses instead.

sour island
#

@nimble spoke I know you had a suite of AI tweaks, did you run into anyway to handle persistent IDs on zombies? ๐Ÿค”

#

I wonder if I could create a hash using their outfit, hair, position

nimble spoke
sour island
#

You used outfitIDs like I did for specials?

nimble spoke
#

Yeah, outfits are enough for that

sour island
#

and I looked over that mod, and it appears they supply an ID using HashCode() but it's also not persistent

#

oh wait, they actually do track it

#

they're using the cell's zombieList ๐Ÿค”

#

zombieList is also not persistent

#

seems like they're going through some trouble writing to a textfile - I wonder what is going on

nimble spoke
#

I looked around back then and seemed very complex for what it is supposed to do, but didnยดt get to test or anything

real marsh
#

Hi all, i have zero experience in zomboid modding but i just wanted to know if anyone thinks its even slightly possible, can you randomise the cells on the map, sorta like old school roguelikes where you get a new map every time

sour island
#

appears they're saving the makeup of the cell's crawlers/sprinters etc - to maintain the %s

#

they do mention the mod requires the %s for each to total 100

#

The persistent ID challenge is the kind of whitewhale I can sink hours into trying to crack

nimble spoke
#

If you really need to make them persistent it might be worth the trouble, I simply neve had a reason to try

sour island
#

I mostly don't need to do it - but it would be nice to figure out

#

Working on a zonable zombie behavior mod

#

using my zoneAPI (the UI)

#

there's alot of things the zombie code locks out though

#

no setters for basically any of the stats

#

and they recalculate the stats every tick requiring update events to offset them (which you're aware of since you made specials)

old ginkgo
noble moat
#

what's the best way to increase a stat over time at a constant rate while a condition is met?
i know that there's OnPlayerUpdate but i'm not clear on if it runs at a fixed interval or not

bronze yoke
#

it doesn't, it's tied to framerate

#

you can use a delta to compensate for that

sour island
#

persistentoutfitID might actually work ๐Ÿ˜ฎ

#

@bronze yoke Have you messed with this?

#

so far tested in SP, and moving away or reloading is persistent - they all seem unique

bronze yoke
#

interesting

noble moat
sour island
bronze yoke
#

yeah, that would be correct

sour island
#

in MP, used fast move to unload

bronze yoke
#

i presumed that referred to the id of the outfit itself, but now that i think about it, what would 'persistent outfit' actually mean except a specific instance of an outfit

sour island
#

same

#

and I'm figuring this is used to load the zombies too

#

maybe it's a hashed ID of some sort

bronze yoke
#

yeah when i think about the terminology that would make perfect sense

#

the outfit is basically the only thing unique about a zombie anyway

sour island
#

I assumed it was like outfitID which is a string, but noticed it wasn't

#

this could be pretty slick

bronze yoke
#

wonder what these do, they do slightly concern me that they might not be unique

sour island
#

I tried to spawn a few of the same outfitID - i know there's some chanced clothing options but haven't seen any matching

#
    public void dressInPersistentOutfitID(int var1) {
        this.getHumanVisual().clear();
        this.itemVisuals.clear();
        this.m_persistentOutfitId = var1;
        this.m_bPersistentOutfitInit = true;
        if (var1 != 0) {
            this.bDressInRandomOutfit = false;
            PersistentOutfits.instance.dressInOutfit(this, var1);
            this.onWornItemsChanged();
        }
    }
```isoZombie
#

Seems like it can be 0 at some point ๐Ÿค”

#
   public void dressInPersistentOutfit(String var1) {
      int var2 = PersistentOutfits.instance.pickOutfit(var1, this.isFemale());
      this.dressInPersistentOutfitID(var2);
   }

   public void dressInPersistentOutfitID(int var1) {
   }
```isogamecharacter
#
   public void dressInOutfit(IsoGameCharacter var1, int var2) {
      var2 = this.getOutfit(var2);
      if (var2 != 0) {
         int var3 = var2 & 2147450879;
         short var4 = (short)(var3 >> 16);
         short var5 = (short)(var3 & '\uffff');
         PersistentOutfits.Data var6 = (PersistentOutfits.Data)this.m_all.get(var4);
         if (var6.m_useSeed) {
            OutfitRNG.setSeed(this.m_seeds[var5 - 1]);
         }

         var6.m_outfitter.accept(var2, var6.m_outfitName, var1);
      }
   }
#

it's a seed/hash

sour island
#

Trying to figure out a way to handle the zombieIDs now that I have them

#

I think having it stored on a table/saved would probably cause alot of issues

#

and math.randomseed is not exposed ๐Ÿ˜ฆ

sour island
#

๐Ÿ˜

#

Wait this just makes a persistent ID?

mellow frigate
#

afaik MP valid and all ๐Ÿ™‚

sour island
#

This seems to be more about syncing onlineID

#

I assume once everyone logs out the ID is no longer cached

#

persistentOutfitID is a persistent int ๐Ÿ˜… - so alot less overhead in that regard

#

I assume it's natievly sync'd

#

my issue now is what do I do with the ID - as I don't think making a giant list to compare to is a good idea

#

I'd like to maybe mimic a randomseed using the persistentoutfitID

#

So supplying the outfit ID produces the same result

#

Cobbled together a seed thing looks good on lua.org

fleet bridge
#

I'm trying to write a mod to overwrite the Remove Propane Tank function off of BBQ Grills from ClientCommands.lua.

ocal _orig_bbq1 = Commands.bbq.insertPropaneTank

Commands.bbq.insertPropaneTank = function(player, args)
local bbq = getBarbecue(args.x, args.y, args.z)
if bbq then
local tank = bbq:removePropaneTank()
if tank then
player:getSquare():AddWorldInventoryItem("Base.Processedcheese", 0.5, 0.5, 0)
end
tank = InventoryItemFactory.CreateItem("Base.PropaneTank")
tank:setUsedDelta(args.delta)
bbq:setPropaneTank(tank)
bbq:sendObjectChange('state')
end
return _orig_bbq1(player, args)
end

#

But I'm getting an error:
unction: VanillaLuaOverwrite.lua -- file: VanillaLuaOverwrite.lua line # 4 | MOD: ApocalypticCrafting

ERROR: General , 1700956308527> 196,037,382> ExceptionLogger.logException> Exception thrown java.lang.RuntimeException: attempted index: bbq of non-table: null at KahluaThread.tableget line:1689.
ERROR: General , 1700956308527> 196,037,382> DebugLogStream.printException> Stack trace:
java.lang.RuntimeException: attempted index: bbq of non-table: null
at se.krka.kahlua.vm.KahluaThread.tableget(KahluaThread.java:1689)

sour island
#

attempted index: bbq of non-table: null

#

line 4

fleet bridge
#

local _orig_bbq1 = Commands.bbq.insertPropaneTank

this is line 4

sour island
#

Well Commands = null here

fleet bridge
#

ok - i think i see an issue, let me try and see if it works

sour island
boreal garnet
#

I keep running into an issue with the crafting menu breaking when i try to introduce a new recipe via modding unhappy

sour island
#

Used modulo on the persistent outfit ID to lower the number of passes

#

Seems good

iron hatch
#

Can anyone point me towards a resource for adding custom console commands? Either an example of a mod that does it well or discussion thread? I've searched for e.g. "add custom console command" but I get mostly results about reading from the console. I'm really new to PZ modding, my objective is to build reward systems I can "pay out" via the console but this is the first hurdle I need to overcome

heady crystal
#

@sour island @mellow frigate Any of you know how to force a player to trigger an animation? I have copied a .X file from the original vanilla animations and written an XML animset, and triggered it's condition but nothing happens. I don't know what I'm missing?

#

You're my last resort, nobody else seems to know unhappy

sour island
#

Are you using setVariable on the player?

heady crystal
#

Yeah

sour island
#

what does the xml look like?

heady crystal
#

Copied this vanilla sleep file

#
<?xml version="1.0" encoding="utf-8"?>
<animNode>
    <m_Name>SleepIdle</m_Name>
    <m_AnimName>Bob_SitGround_SleepIdle</m_AnimName>
    <m_deferredBoneAxis>Y</m_deferredBoneAxis>
    <m_Looped>true</m_Looped>
    <m_EarlyTransitionOut>true</m_EarlyTransitionOut>
    <m_SpeedScale>1</m_SpeedScale>
    <m_BlendTime>0.20</m_BlendTime>
    <m_Conditions>
        <m_Name>sleepidle</m_Name>
        <m_Type>BOOL</m_Type>
        <m_BoolValue>true</m_BoolValue>
    </m_Conditions>
</animNode>
sour island
#

what does your setvariable look like?

heady crystal
#

playerObj:setVariable("sleepidle", true)

sour island
#

bools there are text I think

#

try "True"

#

Oh it's cause I made it a string

#

<m_Conditions> <m_Name>SCUCK_Anim</m_Name> <m_Type>STRING</m_Type> <m_StringValue>True</m_StringValue> </m_Conditions>

heady crystal
#

Nothing either :/

sour island
#

Seems like vanilla uses bools, maybe there's something else

heady crystal
#

I know the .X file itself works, you can even see it in the animations debug thing

sour island
#

I would dobule check the basics, make sure its the right playerobj etc

#

animation stuff isn't well documented so most of what can be learned is in the vanilla files

heady crystal
#

Setting it to string didn't cut it either

sour island
#

If you have a git repo I can check it out

heady crystal
#

I'll try a timed action

#

Do you know how to loop an animation there?

#

Ah think I found it

drifting ore
#

Say, what's the size of item icons again?

#

32 x 32?

heady crystal
#

Yeah

drifting ore
#

Is that the maximum width and length or can it be, say, 16 x 32? Or just 20 x 20?

#

Or does it have to be 32 x 32?

boreal garnet
heady crystal
#

Afaik it has to be 32x32 if you want it to fix properly in the hotbar and stuff

#

And the game just scales it otherwise

heady crystal
boreal garnet
#

in laymens terms? MiyanoWow

heady crystal
#

It don't exist!

#

Whatver you're calling isn't there

boreal garnet
#

does it tell me what variable it misses?

#

what do i need to supply for it to work

#

its an error message that pops up when failing to open the crafting menu

#

i was adding a recipe with my mod

sour island
#

added tooltip support

drifting ore
#

Say, what's the difference between these tree items? Why are they listed as pop1empty, pop2empty, and pop3empty?

sour island
merry quail
#

How to specify a bag that only contains 1 category

#

i need help

abstract pine
#

Is there a way to manipulate fields of scriptItems directly for fields that don't have a function to do it? Like e.g in place of DoParam("DisplayCategory = Accessory"), there's no setDisplayCategory so I'm not sure the best way to do it. I just realised how slow DoParam is in terms of performance and that I probably shouldn't be using it at all.

fast galleon
abstract pine
# fast galleon it's ok to use it once, during loading

Does that mean there is no better way to do it? I'm doing it hundreds of times on loading, and I'm having long loading times, so I thought I'll double check my own mods before I troubleshoot everything else, then I noticed how slow DoParam is

fast galleon
#

You can use python to generate the files once and then no need for in-game logic.

max performance?

abstract pine
#

Is there a guide on how to do that? I know a little python but I don't know what files I'd even want to generate, I'm iterating through and tweaking other mods' script items in a personal mod. I don't really care about max performance necessarily though, I just wanted to know a better way to do it than DoParam if there is one.

bronze yoke
#

if there's no setter there isn't another way, you can't write to fields directly

abstract pine
#

ah damn, I suppose I could do a java mod if I really wanted to

#

easier than lua, except I don't think you can add any new files with java from what I tried, so no compatibility between java mods that way

bronze yoke
#

easier than lua? stressed

abstract pine
#

haha, I get so lost modding this game with lua compared to everything else I've worked with, I'm constantly thinking of a simple way to do something, then lua is too simple to be able to do that

#

It makes it feel so complicated especially when you have to look at the java to see how everything works, it's a shame java modding isn't supported

#

hm, what event is best for tweaking items like with DoParam? A lot of that I'm not even doing in an event since that's the way I saw others doing it when I started modding, not sure if that's bad, think I tried OnGameStart once but then it ended up doing some changes twice since script items weren't reset the second time

bronze yoke
#

you don't need to use an event

#

i usually stick things on OnInitGlobalModData since that's when sandbox options first become available, but if you don't need them there's no point

#

OnGameStart is a bad idea since it fires after the first chunks have loaded, so any properties that are copied to the instance will have the pre-tweak value

abstract pine
#

That's good to know, I remember having trouble with that once where sandbox vars were all default in the event I tried

#

It feels hard to have good practices in my code without any reference or guides on anything, only found a few on the forum

bronze yoke
#

modding is primarily done by complete newcomers so good practice is not easy to come by

#

i've been meaning to write a few more resources

#

mostly just to try and get people to use modules and to stop using globals ever

drifting ore
#

I'am pretty sure the devs said in one of their updates on steam they are working on updating the Modding area, like the guides and what not.

abstract pine
#

Resources would be so useful, using modules as in like making everything local?

bronze yoke
#

people often give out the advice that you should look at how other mods do things, and you absolutely should to find out how things work, but when it comes to code style and optimisation very few are up to standard and you'll likely learn more bad habits than good

bronze yoke
#

globals are slow and prone to name conflicts, better to just avoid them as much as possible

abstract pine
#

interesting, I actually did see one mod doing that for some functions and thought it seemed like a good idea

bronze yoke
#

i've seen a lot of mods that do this but don't keep the table local, which is a lot better since it condenses things down to just one global, but why add one when you can add none

abstract pine
#

Exactly

#

I feel totally unsure the best way to call/set local variables when doing anything, like I would have thought if I'm manipulating a lot of mod data, it'd make sense to only get it once e.g local modData = player:getModData(), but everything I look at tends not to do that and just repeats getModData()

bronze yoke
#

that is much better and you should do that

#

this is faster in all languages, but there is a lot of overhead on calling java from lua so it's really important here

#

it's also just way less ugly...?

abstract pine
#

That's reassuring, I thought so but then it makes me wonder when I see no one else doing it

#

yeah, I always find code easier to read when it actually declares everything with decent names

bronze yoke
#

most mods are written by people who don't have any prior experience with programming

#

that combined with the lack of resources about it means the style can be substandard

abstract pine
#

speaking of mod data, do you know off hand if it needs type checking? It looks like the java creates a table if it's null, but I'm not sure if I need to check if e.g player:getModData().myNumber ~= nil before I try to check/compare the value

#

I see checking it's not nil sometimes and not other times in examples I look at

bronze yoke
#

some comparisons are fine with nil, some aren't

#

generally anything with numbers is going to go bad if nil gets in there, but nil evaluates to false so it can take the place of a boolean fine

abstract pine
#

Thanks, all this cleared up a lot I wasn't sure on ๐Ÿ‘

nova socket
#

Any IsoZombie enthusiasts? I need a solution for server-side to determine if zombie is moving by any means.
isBehaviourMoving() is unfortunately not known to server and always false there. isMoving() doesn't seem to be true ever anywhere.

#

getActionStateName() does seem also not shared with server. So server has literally no behavioral context whatsoever.

heady crystal
#

I have a timed action I make the player execute, that set these custom properties:
action.maxTime = 9999999999
self.action:setBlockMovementEtc(true)

I am trying to cancel it after some time by calling:
ISTimedActionQueue.add(ISTimedActionQueue.clear(playerObj))

But I get the following error:

function: addToQueue -- file: ISTimedActionQueue.lua line # 23 | Vanilla
function: add -- file: ISTimedActionQueue.lua line # 131 | Vanilla
function: DelayFunction -- file: BB_OGTechDemo_Main.lua line # 117 | MOD: Till Death Do Us Part
function: onTick -- file: BB_MyLittleUtils.lua line # 106 | MOD: Braven's NPC Framework
LOG  : General     , 1700979877069> Object tried to call nil in addToQueue

More precisely it's this snippet:

    -- none in queue, so go!
    if count == 0 then
        self.current = action;
        action:begin(); <---------- THIS
        --print("action started.");
        --    ISTimedActionQueue.IDMax = ISTimedActionQueue.IDMax + 1;
    end

Any idea?

heady crystal
#

Just.. messing with zombies at all in multiplayer is a terrible, terrible thing to do.

nova socket
#

Returning velocity of zombie probably has to be the easiest task for a game server

#

trying getMoveSpeed() now

#

Nah, also always 0

dry chasm
heady crystal
#

What?

#

I don't understand what you're trying to say

dry chasm
#

ISTimedActionQueue.add(ISTimedActionQueue.clear(playerObj))

ISTimedActionQueue.clear(playerObj)
From just the sound of it, with the argument provided, it does sound like a method that intends to clear all actions currently queued.
Which would likely not return a specific timed action to then add to the queue again?

heady crystal
#

It's just supposed to stop all timed actions altogether

#

I've been using it on my NPCs, works perfectly for normal actions

#

I think it's related to the time on mine

#

Or something

bronze yoke
#

what's the add call for?

#

if you're just trying to clear the queue that function will handle it

#

clear doesn't return an action so when add treats its return value as one it inevitably errors

heady crystal
#

Ohhh I get what you're saying

#

LOL yeah

#

Why is that there

#

I encapsulated it and didn't even realize

#

Why do I keep coding at almost 4am

#

Yeah that should solve it. Actual facepalm for me. Thanks people!

#

Now I can finish the tech demo

#

That and the animation are it

#

The only 2 things I am missing

#

Take a look!

#

Ignore her animation lmao

#

I just can't find a way to play the damn animation lol

bronze yoke
#

she's in the falling animation? that might be the source of the issue you've been having with that

heady crystal
#

No no, that's just a miserable attempt of mine to play the animation

#

For some reason she ended up doing that

heady crystal
bronze yoke
#

oh right, i was thinking if she was being registered as falling for whatever reason it might be taking precedence over your animation

heady crystal
#

It just won't play

#

So I tried timed actions

#

Nothing either

#

This is my timed action approach

#

Nothing

#

It's sooooooooooo annoying

#

Like if I can manage this one thing, it's over

#

It's all I need

#

Nevermind the raider NPC, it'll be a nightmare but I can handle it. But this? Why won't it woooork

dry chasm
heady crystal
#

I added it

#

To know which action is which

#

Multiple actions in one script

ionic steppe
#

So my dreams with PZ is to make a riverside expansion mod but I have 0 idea of how to even get started, I get the jist of it but also dont know what I am doing, I could use some help on the ways of mapping, really I'd also like it if someone here whos got some experience could help me out.

#

I also dont know if I should wait for B42 or just go for it now to atleast train

drifting ore
loud pelican
#

Agree, the tutorial is so helpful on the beginning of making maps

nova socket
#

Does anyone know if there is a way to instantiate Moveables.* which do not have items bound to them directly (cannot spawn)

coarse sinew
# nova socket Does anyone know if there is a way to instantiate `Moveables.*` which do not hav...

Something like this ?

function DebugContextMenu.OnMannequinCreateItem(script)
    local spriteName = script:isFemale() and "location_shop_mall_01_65" or "location_shop_mall_01_68"
    local obj = IsoMannequin.new(getCell(), nil, getSprite(spriteName))
    obj:setMannequinScriptName(script:getName())
    local item = InventoryItemFactory.CreateItem("Moveables.Moveable")
    item:ReadFromWorldSprite(spriteName)
    obj:setCustomSettingsToItem(item)
    getSpecificPlayer(0):getInventory():AddItem(item)
end
nova socket
boreal garnet
#

fellas, i cant get my recipe mod to work and ive been on it for 2 days unhappybleachbottlefilledwithwater

kind bluff
#

Greetings all, im trying to change the lass display counters to display the gun texture instead of the default jewlery - i cant find any mods for this, so how easy would this be for me to do - i know its a rabbit hole, but i can follow tutorials

#

*glass

#

is this something i could do with tileZ/?

#

or would i make a new craftable container using the vanilla textures - so adding one new tile?

kind bluff
#

another method i was thinking was to just replace the jewlery textures with the gunstore textures? -how could i make this work? even if its just for my game? rather than a seperate mod

trim skiff
muted bronze
#

For adding items to zombie distributions, can I set the max for the group of items I want to try and roll like so?

#

Like I have it set to one roll currently, but I'm noticing zombies can spawn with multiple items from the list I'm adding to them

bronze yoke
muted bronze
mellow frigate
gilded hawk
#

<@&671452400221159444> Why did I get silenced for trying to post some code?

left plank
gilded hawk
#

How am I supposed to shared code without using the triple ` man

left plank
gilded hawk
#

Dude it's code, It has special characters

#

wtf

fast galleon
#

I had something similar while formatting a message.

left plank
#

I'm simply relaying information to you. Please, relax. This is what I know to be the cause. I didn't design the filter for the auto-bot.

gilded hawk
#

Okay, fair still, this is an absolutely idiotic filter. Can you guys disable it for the mod dev channel, otherwise how are we supposed to share code?

gilded hawk
#

Like, check the screenshot

fast galleon
#

does it happen with only the code block? Try posting it like a file or in parts.

gilded hawk
#

This is absolutely idiotic, I posted the same code block, without the lua formatting, and I still got timeout out for 60 second

#

This is absolutely idiotic, why making sharing code more complicated in the channel to share code? @tame mulch and @willow estuary can anyone of you please say something about this?
This change

fast galleon
#

also as the mod said, images are "acceptable" alternative.

gilded hawk
#

wtf man

#

This automod change just killed the ability to actually share code in the code channels.

#

Absolutely idiotic change

bronze yoke
gilded hawk
#

Anyway, this moderation change is dumb, and I'm quite pissed, I'll go out for a walk and a cigarette

iron salmon
#

Meanwhile would be cool if you could get the sand out of your pants

#

Lots of ways to make us aware of it without...whatever this is

gilded hawk
#

Yeah, good point sorry about it, this change and getting randomly silenced really infuriated me, I'll go chill for a bit.

hybrid crest
#

Hey guys, how can I fully override lua file from another mod?

rugged latch
#

you could maybe overwrite all of its functions?

hybrid crest
#

it has only one function, and it's declared as local. I was told that local functions can't be overriden

rugged latch
#

hm i dont know if thats true or not but that would make sense that you couldnt

#

are you trying to disable the entire mod?

#

or just one file

hybrid crest
#

I want to make a "patch" that basically removes a couple lines of code.

bronze yoke
#

you just need to have a lua file with the same name in the same location

hybrid crest
bronze yoke
#

make sure your mod is later in the load order

hybrid crest
#

Is in-game load order accurate?

bronze yoke
#

i don't think vanilla even lets you choose load order

#

not in singleplayer anyway

#

i think mods that require other mods always load later than them? not 100% about that one

#

otherwise it's alphabetical

hybrid crest
#

In-game my mod is after the original. I also tried alphabetical. Still, first original function is called, and then mine.

#

and I also tried adding a requirment, same result

bronze yoke
#

you can see when files load in the log

#

it should never load two files with the same directory and filename

#

have you confirmed your file is being loaded at all?

hybrid crest
#

yes, my function is getting called

#

where can I check loaded files in logs?

bronze yoke
#

in your console.txt you should see a bunch of lines like```
LOG : Lua , 1701031673825> Loading: media/lua/shared/a_requires.lua

#

for modded files it'll show the full path it's being loaded from

#

there should also be some lines like```
loading MyModID
mod "MyModID" overrides MyFilePath

hybrid crest
#

Thanks, I'll check it

ionic steppe
#

Yeah sadly that's the one thing that sucks about B42 but is also why I love Indie Stone. I'll look into this, tyvm.

ionic steppe
#

Is it possible to get vanilla mapping and just modify it from there?

finite kettle
#

is there a way to check if a specific animation is being played? on the player of course

fleet bridge
#

Anyone know where the function for car dismantling is located in vanilla lua files

rugged latch
#

does anyone know if attack speed is also tied to animations or is it a variable something i can easily change?

abstract pine
#

It's tied to animations, but you should be able to change it on weapons by altering their BaseSpeed, MinimumSwingTime, and SwingTime

#

Though I'm not sure those work with the heavy weapon animations, I couldn't manage to increase the speed of one when I tried using those with it

rugged latch
#

alright cool thank you, im going to be messing around with it alot for a trait so would you like me to tell you if i manage to get two handed weapons working?

abstract pine
rugged latch
#

yea

#

ill try those first then actually

abstract pine
#

Nice, good luck, I hope you manage since I ended up thinking the speed was fixed based on the animation for those

mellow marten
#

should this work right?

rugged latch
#

that would work but not for what im trying to do sadly

#

im trying to change the attack speed when your injured only

#

how it slows you down

mellow marten
#

im talking about myself

rugged latch
#

oh lol

#

let me look

#

yea i saw weapon and assumed this was just a list of all the stats for a weapon

mellow marten
#

lol

muted garnet
#

please tell me how I can get a weapon type before starting the game or immediately after starting the game (for example, I need to know if there is a mod or vanilla shotgun in the game)

bronze yoke
#

you can use ScriptManager.instance:getItem("MyMod.MyItem") to check if an item type exists

trim skiff
#

hello guys, i have a question, did servertime using GameTime.getServerTime() also got paused when the server is empty (i turned on the option to paused the server when empty)? and whats the diffrence if im using os.Time(). thanks

leaden furnace
#

Hey I'm the owner of Project Aftermath, a new PVP server that has a lot of mods that need to be developed, if anyone is interested in getting paid to make any of these below please reach out โค๏ธ

Claiming/raiding cars

  • You can claim any car with a specific key that you can only use once, and once its claimed to you it vanishes
  • The car can be lockpicked using a lockpick, it takes 3 minutes irl to lockpick
  • there is an indicator when you right click the car that it is claimed

Better queue system

  • The built in queue system for zomboid uses the slots of the server itself as the queue (Ex. for a 100 player server, 60 can be in the server and 40 in the queue) and anyone -else who wants to join will not be able to do to the โ€œserver being fullโ€
  • On top of that, the queue system lets players in one by one even if there are slots, so if we restart and 100 join, they will all be waiting behind each other in a line to join, which takes forever.
  • The new system would either use a new server to sort of hold all of the queued players then let them in once there is a slot, allowing the actual server to have 100 players -playing at the same time
  • There will also be a priority queue option where we can give vip members priority
  • Or it'd use some other system that'd work as this one would^

Sleeping bag system

  • A system where you can place a sleeping bag down and respawn at it as a spawn point
  • Has a timer that you canโ€™t respawn back on it of 3 minutes

Safezone indicator

  • Allows admins to make a safezone radius that doesn't allow PVP
  • An indicator that youโ€™re in a safezone that doesnโ€™t allow PVP

Codelock mod

  • A mod that allows you to put codelocks on either pre-existing pz doors or player built doors, letting you set a 4-digit codelock that anyone can use
  • Is placeable with a โ€œcodelockโ€ item
#

Sorry for the block of text but im just looking for modders to help us out thanks โค๏ธ

frozen elm
#

what would be the correct syntax for importing more than one module in a .txt file?

#

would it be

    base, othermodule
}```
or would
```imports {
    base
}
imports {
    othermodule
}```
work?
leaden furnace
#

appreciate it though

undone crag
fleet bridge
#

IsRemoveBurntVehicle.lua

#

was searching for dismantle, wreck, etc. lol

muted bronze
#

Is there a better way to control item spawning on zombie corpses? Initially I was using inventorymale and inventoryfemale tables to insert items.

However, I have like 40+ items in a mod I'm working on that I want spawned on corpses but the chance value doesn't seem to apply. As in I'm getting way more items than what my chances should be dropping. Is there a post anywhere that goes into details as to how rolls and chance function when determining dropped loot?

fleet bridge
flat cipher
#

Hey @sour island @nimble spoke, if you have any questions about Random Zombies and its implementation, Iโ€™m happy to share the knowledge and rationale behind some decisions if you @ me.

The math.randomseed functionality youโ€™re trying to recreate is called a hashing function, which is what I do in RZ to avoid having a shambler become a sprinter suddenly (like it is the case in some other zombie mods)

Most of the code in Random Zombies is diagnostics and debug, it does not actually run during gameplay, like the writing to a file bit.

Let me know if youโ€™d like to know more.

sour island
#

I was able to find an alternative that is persistent for IDs - as well as recreated a fixed random set of the numbers to keep the behaviors the same.

#

I also saw you are flipping sandbox options and rerunning zombie stats - is that at all performance impacting? ๐Ÿค”

muted bronze
flat cipher
#

Random Zombies relies on zombie online ids for simplicity and multiplayer friendliness, do you use something else?

Rerunning zombie stats is the only escape hatch I found to trick the game into actually changing zombie stats, since you cannot set these Java class fields directly afaik. Itโ€™s not expensive since itโ€™s Java code thatโ€™s being JIT compiled. You should always profile your code tho, to know if the performance is expected and what is actually the bottleneck

sour island
#

onlineIDs are not persistent

#

Just a heads up on that front - I discovered persistentOutfitIDs are persistent and unique

flat cipher
#

Oh you mean the sandbox options flipping? Thatโ€™s just a set on a Java field, so very inexpensive

sour island
#

The rerunning of zombie stats on each zombie - is my larger concern

flat cipher
sour island
#

No, it appears to be a hash of their combined worn items or something similiar

#

Tested by spawning zombies with the same outfit and did not see any repeats but they were similar in starting digits

#

Also works in SP/MP

#

OnlineID and Object hash are not persistent from what I tested

flat cipher
#

interesting, I'll definitely look into it to understand how they're assigned. Persistence through game reloads was not a big requirement in my case and, anecdotally, I've never received feedback related to it

flat cipher
sour island
#

So your zombies would be rerolled each encounter?

flat cipher
#

each server restart

sour island
sour island
#

The game recycles the zombie object.

flat cipher
#

yes, I have read way too much Java code around zombie recycling that I would have liked, it can be annoying to deal with, especially around cache invalidation

#

if you save stuff in the getModData() table

sour island
#

Yes, zombies don't save that either

flat cipher
#

in terms of gameplay, that would mean that all players moved a long distance away from the zombie, so I'm fine rerolling it

sour island
#

Fair, just curious - cause some people told me it wasn't the case with your mod- and I saw you were doing some slice stuff (I assume to get/confirm the population %s)

flat cipher
#

what wasn't the case? I never check the zombie distribution since I extensively tested the hashing function to have the required properties (that's why there's so much "debugging" code in the mod)

#

(namely the uniformity property)

smoky osprey
#

Hi. Is there anyone here who has worked with ZombieEatBodyState? It looks like it issues an exception when try to access getName() or instance() but everything is fine with other states.

mellow marten
#

Can someone help me with the profession framework? I want to make my own profession to override farmer.

rugged latch
nova socket
#

is getModData() strictly local namespace? Object in question is said IsoZombie

rugged latch
clear compass
#

I have a model ready and such im trying to add a set of armor, head legs and chest

#

how do i insert these models now

flat cipher
thorn brook
#

you can pay me for telling you that

#

lol

leaden furnace
nova socket
#

Found it out already, getModData is local until you transmit it.

fierce tartan
#

Hmm. How does the game distinguish between which items can be used as fuel for fire and which ones aren't? I would have expected a tag on the items, but neither twigs nor branches have anything of the sort.
Nevermind, found the camping_fuel.lua now.

flat cipher
#

Oh you mean local in a client/server sense? the word namespace is pretty confusing here. Glad you found the info

nova socket
#

Well it has to be stored, usually its a namespaces for such things, not sure how it might be called in Lua/Java sense.

#

Next question is what the f*** is receiveObjectModData: index=-1 is invalid x,y,z=12597,908,0

clear compass
#

man im having trouble with this

#

so i have created a model for armor in blender, i think i have the file sets right

#

i exoported the amor as an fbx

#

what the hell am i doing

fierce tartan
# clear compass man im having trouble with this

I haven't done it myself yet, but I know here's Blackbeard's vid on YT about making and importing models into the game. Give it a shot.
https://www.youtube.com/watch?v=ecGTLTup4b0&ab_channel=Blackbeard

0:00 intro
0:46 open Blender
0:57 add background image
2:39 making the model start
6:01 Fast forward / making the model
7:12 Using the Knife Tool to work on the trigger guard area
8:05 Fast forward / making the model
9:17 Adjusting the model thickness
11:25 Map Image (uv mesh)/ Node setup
14:33 Painting to help place image
16:57 Using Photoshop...

โ–ถ Play video
left merlin
#

Anyone know of some good camera mods?

muted bronze
#

I'm getting closer with my mod and being able to use a custom weight table as to not overload the default male and female inventories.

Still not the best at Lua so of course things are breaking. Is anyone able to see why in my screenshot why line 33 is returning Object tried to call nil when trying to add an item?

bronze yoke
#

capitalisation of AddItem doesn't match

muted bronze
#

It still returns something about trying to call nil. I even moved the table out of scope to make it global to the script and same issue regardless of where it is

clear compass
#

alright so im just stupid i guess. Anyone got a complete mod folder i can look at and see what you did

fierce tartan
#

just look for the workshop folder in your zomboid installation, if you have any mods installed, they will be in there

clear compass
rugged latch
#

You need the ones through the steam directory thing
You'll know it's the right one because it's a bunch of number folders of the workshop ids

#

I can't give you exactly where it is right now though sorry

clear compass
#

damn thats alot of numbers

rugged latch
#

Yea just search for the mod name you want lol

#

If you don't know it look at the workshop page and at the bottom

#

It should say the number ID and the name one

clear compass
#

im just working through the mod example stuff and trying to set this up exactly like theirs

rugged latch
#

Hey as long as it works

slow graniteBOT
#
nico2110 has been warned

Reason: Bad word usage

clear compass
#

ok

#

i think ive got it all set up, where do i put my file for this to load

rugged latch
#

Your main project zomboid folder in the workshop folder

void cargo
clear compass
#

do i have to upload in order to use in my game?

void cargo
#

Nah it just needs to be in ~/Zomboid/mods folder

clear compass
#

i can see it in the upload section but not the mods?

void cargo
#

@clear compass I think you have it correct in the workshop folder but maybe not in the mods folder. The directory for your mod in the mods folder shoud have a media folder directly inside of it like Zomboid\mods\<yourfolder>\media if it doesn't it won't show. I link these directories so I don't need to mess around with copy and pasting

clear compass
#

ive got it now. Had to reload game

void cargo
#

How useful! Thank you, replying to spread this (so many useful function calls)

dusk saddle
#

Hey hey folks, I'm trying to figure out how to have a recipe return tailoring experience, does anybody know what the code is for that?

I've looked at other mods, and OnGiveXP:Recipe.OnGiveXP.Tailoring10, seems to be something some folks use, although I haven't had any luck and the game says it doesn't exist in the recipe manager

bronze yoke
#

it doesn't look like there are any vanilla tailoring ongivexp functions

dusk saddle
#

Oh well shoot, I suppose that would be why

bronze yoke
#

but you can just write your own referencing the ones in server/recipecode.lua

dusk saddle
#

I'll be sure to look into that

#

Got ponies being able to be sewn added recently, and figured tailoring XP would be useful

#

All righty, got it working! Thanks! I s'pose it's mainly cooking and stuff in the vanilla recipes thing, which makes sense why tailoring wasn't working

#

Still not 100 on balancing for 'em though

blazing osprey
#

does anyone know / have any documentation for animating world tiles/structures? Or have a mod that does this to refrence?

flint lance
median prairie
trim juniper
#

Hmm, anyone know the simplest way to discern which food items are perishable and which aren't, when first spawned? I've tried various - :isFresh() just returned true for all food until the perishable stuff rots, :getRottenTime() just returns zero for everything, :isPackaged() will be true for some perishable foods, and false for some non-perishables... I can't work out how to just return a simple "this will go off eventually" flag.

void cargo
void cargo
trim juniper
void cargo
trim juniper
#

Ah cool. Thanks for the help. I'll take a look at that then.

void cargo
trim juniper
#

Ah, finally cracked it. Just need getScriptItem() - item:getScriptItem():getDaysFresh() either returns a small number for perishables, or 1000000000 for non-perishables.

#

No field access required

void cargo
#

what a nice big number

trim juniper
#

Yeah, would figure -1 would be a better marker value. Wonder if this means non-perishables still perish, but it takes 2.7 million years...

#

Cool, yep, local isPerishable = item:getScriptItem():getDaysFresh() ~= 1000000000 works a charm

fast galleon
trim juniper
#

Wiped my log now, but pretty sure it showed 6 for Processed Cheese - which tallies with the wiki for Days Fresh.

fast galleon
#

invItem:getOffAgeMax() ~= 1.0e9

trim juniper
#

Huh... so it was there all along huh? Just never clocked that "OffAge" referred to food spoilage ๐Ÿ™‚ Thanks!

#

Yep, just tested, and that works exactly the same. I presume that'd be the less round-the-houses way then. local isPerishable = item:getOffAgeMax() ~= 1000000000

still fossil
#

Hello.

I'm trying to make a mod where the flashlights take a different kind of battery. I've created the new battery item, changed the recipes and edit the "OnCreate"-functions.
If i dismantle the flashlights, both of them, or take the battery out, im getting the new battery item. But when i try to insert a battery, it works for the "Torch" (the yellow big flashlight), but the "HandTorch" takes only the vanilla battery.
I already tried to override and/or hide the vanilla recipes but without success. What am i doing wrong? Can someone help me with that?

twin patrol
#

I want to create a mutant zombie mode but I don't know where to start. Also I couldn't find a guide showing what's needed can someone point me in the right direction?

nova socket
#

So I just encountered some really weird netcode clusterfuck. I picked up a local dedicated server on my local port and just join it to test mods.
What happens is something I cant comprehend

  • I spawned a small horde of 25 with debug tool and one guy just before that.
  • I log out, log in
  • One guy i still there but all 25 others are gone.
  • I log out, log in
  • All 25 guys are back again where they were.

I thought I'm going insane or logging in wrong servers all the time, but no, checked it 3 times in a row and it keeps happening. ๐Ÿซ 

nova socket
#
#!/bin/sh

# Script for checking and restarting server when mod updates are in order
# Use crontab to add this to queue but consider sleep timers to not overlap with cron job.
# Example:
# */10 * * * * /bin/sh /opt/pzserver/checkmods.sh

SOCKET=/opt/pzserver/zomboid.control # Path to your zomboid server socket, FIFO service should be installed as recommended in Dedicated server manual for it to work 
LOG=/home/pzuser/Zomboid/server-console.txt # Path to your server console log to read commands responses

echo checkModsNeedUpdate > $SOCKET;
sleep 10;

if grep -q "CheckModsNeedUpdate: Mods need update" $LOG; then
    echo servermsg \"WARNING! Server restarts in 5 minutes\" > $SOCKET;
    sleep 240;
    echo servermsg \"WARNING! Server restarts in 1 minute\" > $SOCKET;
    sleep 30;
    echo servermsg \"WARNING! Server restarts in 30 seconds! Logout NOW!\" > $SOCKET;
    sleep 30;
    systemctl restart zomboid;
else
    echo not found
fi
#

Oh one thing thou is that manual for zomboid.service is having a control command for stop saying echo exit > zomboid.control which is not true, because there is only quit command, not exit.

boreal garnet
#

if i have an item in the Hotbar, how can i designate a different action than "equip on primary" as the action when the keybind is pressed? mrbeaverton

drifting ore
#

Hello, I have a animation for the zombies using Blender and I want it to be used for the zombies when they are bashing a door for example, I noticed what all the animations in the game are in X Format. Anyone knows how I can add it to the actual game? (Actually I have it converted to X, I only need to know how to vinculate it to the zombies)

fleet bridge
#

I have an item with useDelta = 0.5, but somehow it doesn't 2 uses out of it. Is this an issue with the item not being created at 100% uses?

dull moss
#

So, I've been so far avoiding hooking up my stuff to OnTick event but now I kinda want to, how bad it is to do that?

#

function is very lightweight

#

pretty much adjusts pain level to make sure it doenst go above set threshold

#

when testing didnt notice any impact

#

@trim juniper did you figure it out?

#

you can check if item item is replaced with something when its rotten

#

if it is, then its preishable

#

ez

#
    {
        DisplayName = Ice Cream,
        DisplayCategory = Food,
        Type = Food,
        Weight = 0.2,
        Icon = Icecream,
        Packaged = TRUE,
        ReplaceOnRotten = IcecreamMelted,
        DaysFresh = 1,
        DaysTotallyRotten = 1,
        HungerChange = -30,
        UnhappyChange = -10,
        Calories = 1680,
        Carbohydrates = 180,
        Lipids = 84,
        Proteins = 26,
        WorldStaticModel = IceCream,
    }```
#

ReplaceOnRotten

#

oh wait it doesnt work for everything

#

nevermind

winter thunder
#

Anyone know the easiest way to get the largest value from an array/table? It would look like this:

local myTable =
{ 
  Mustard = int,
  Ketchup = int,
  Relish = int,
  Mayo = int,
}

Basically, I want to compare the int's, but get the actual name of the variable that is the largest. So, if the table looked like:

local myTable =
{ 
  Mustard = 0,
  Ketchup = 7,
  Relish = 1,
  Mayo = 9,
}

The output of whatever I do would return Mayo

|| Not making a condiment mod... just for an example lmao||

winter thunder
dull moss
# winter thunder Usually isnt so bad. Do you have more info about what you are trying to do? I ha...
local function painTolerance(player)
    --local player = getPlayer();
    local PainTolerance = player:HasTrait("PainTolerance");
    local stats = player:getStats();
    local pain = stats:getPain();
    if PainTolerance and pain >= SBvars.PainToleranceThreshold then
        if detailedDebug() then print("ETW Logger | painTolerance(): pain:"..pain.." is above"..SBvars.PainToleranceThreshold) end
        stats:setPain(SBvars.PainToleranceThreshold)
    end
end```
#

i already decided imma go with it

#

thought of a way of making it better

winter thunder
dull moss
#

only if the trait ofc

#

but ye got it covered already

winter thunder
#

Dope, yeah. That should be fine then

winter thunder
#

thank you though, that is actually really helpful lmao

wooden flame
#

Hey guys, is there a way to add a line to a vanilla item without overwriting the whole item? I only want to add an OnEat to plonkies

tulip valve
tawdry basin
#

Its not exactly a mod, but its coding related to zomboid so I figured this would be better of a place then pz_techsupport, Im trying to access rcon like this however it keeps refusing my connection

fading arrow
#

Are the devs working on a new engine/ engine migration? I remember something between those lines from a while back, but couldn't find anything related online.

bronze yoke
#

nothing as grand as that but there are quite a few major engine upgrades expected for b42

tender lion
#

would anyone working on making mods be interested in my ideas?

#

i have a few diffrent ones starting with more fitness choices and things that fit with the 80s

#

willing to put in the work to help with the research and stats

limber summit
#

I'm trying to use the code in the image as a guide to making a mod that prevents xp gain based on a corresponding trait. I'm starting with carpentry. So the "no carpentry" trait would disable xp gain for woodworking in exchange for like 8 - 12 trait points.

I've already got the trait working as far as being selectable and giving the points. I'm having trouble with finding a suitable event to tie the trait functionality to as well as whatever methods call the "traitMultiplier" stat, which I want to set to 0.

#

Currently already have this part workin:
` require 'NPCs/TraitFactory'

local function NoCarpentryXPTrait()
local trait = TraitFactory.addTrait("NoCarpentry", "No Carpentry XP", -8, "You cannot gain Carpentry skill XP.", false, false);
end

local function NoCarpentryXPSkill()
if player:HasTrait("NoCarpentry") then traitMultiplier = .75
end

Events...(NoCarpentryXPSkill)
Events.OnGameBoot.Add(NoCarpentryXPTrait)`

#

Well, the first function and last event

#

the 2nd function I'm guessing the snippet above can help with.

uneven ore
#

If you are changing Sandbox Vars do you have to do it inside the shared folder and the defines.lua file?

bronze yoke
#

you can do it anywhere

blazing osprey
#

is there any better documentation for methods than https://zomboid-javadoc.com/41.78/ ? I'm trying to figure out how to get the direction the player is facing and cant figure out what the parameters are for faceLocation

bronze yoke
#

and a little bit of documentation but most of it seems automatically generated

blazing osprey
#

Is there any way to know what methods do other than just asking?

bronze yoke
#

pretty much just asking

#

you can decompile and work it out yourself

abstract cairn
#

Before I go back and look at my previous questions for another mod I was developing (but then stopped cause next build would fix it anyway) anyone know how one could access the faction system and create two teams and assign people to those two teams through it? Also I can't remember if there is a way to turn off friendly fire for the aforementioned factions, but if there is could it be turned on and off via modding?

Followup, could one check a player's faction and then execute code based on whether or not they are in a certain faction?

edit: the documentation for factions seems to have an array of each player stored in each faction, but I'm wondering of the ability to set - nvm theres a function for that too

bronze yoke
#

but without familiarity with the codebase and stuff it will be difficult to tell what things actually do

bronze yoke
#

i think it is probably pretty likely that you can assign them teams automatically, and if friendly fire toggle functionality already exists i can't see any reason you wouldn't be able to use it

abstract cairn
#

Im a newbie when it comes to modding, would it be possible to setup a script that accesses the time/the current in game date of the server [or uses real life time] and then executes code?

basically im asking if I can make a script that performs a loop/a threaded func in order to run logic essentially separate of the main game [like score, etc]

noble moat
#

i'm trying to set my mod's trait and another mod's trait to be mutually exclusive, however my TraitFactory.setMutualExclusive call is creating an error that (if i'm reading the trace and the decompiled code right) is because the other mod's trait does not exist yet
i've got my trait creation code in an OnGameBoot like i should and my mod is loaded after the other one
how would i make my code run after the other mod's code?

drifting ore
#

Question is it possable to put a Function inside an IF like so.

bronze yoke
#

yeah

bronze yoke
#

e.g. if it's added in shared/MyModTrait.lua, add require "MyModTrait" to the start of your file

noble moat
#

ok

blazing osprey
#

Does anyone have any general advice on how to start learning scripting?

Every YouTube video is about adding items and recipes and I already know how to do that, and written guides are sparse.

I know lua and java but don't know how to start with zomboid integration.

fast galleon
digital carbon
#

it also helps to check out the Lua code in Lua files that may be related to what u want to do

#

and also to check out the code in mods that act the same functionally

#

theres also an excel spreadsheet made by glytch3r thats full of stuff although i dont have the link right now

digital carbon
digital carbon
#

id also like to know that so please ping me if someone answers u

digital carbon
fast galleon
digital carbon
#

i think they want to set whether or not a player can earn any XP at all at a skill

#

oh wait

#

I guess that would work if the max carpentry level is set to 0

sleek heath
#

both music mods are now updated for those who wanted to know :)

#

a lot more jungle music haha

#

gotta put some raver music in there ;)

limber summit
#

So individual players can opt into limited traits and be rewarded for the decision with more trait points.

iron siren
#

I am trying to write a mod so when a player sprints into a door the door opens, and if there is a zombie behind it, the zombie is knocked down:

 local function OnObjectCollide(char, isoDoor, isoGridSquare, isoThumpable, isoWindow, isoZombie)
    if char ~= getPlayer() then return end

    if isoDoor then
        if isoDoor:IsOpen() then return end

        if char:isSprinting() then
            isoDoor:ToggleDoor(char)
            local otherSideSquare = isoDoor:getOtherSideOfDoor(char)
            zombie = otherSideSquare:getZombie()
            if zombie then
                zombie:knockDown(false)
            end
        end
    end
end

Events.OnObjectCollide.Add(OnObjectCollide)

The code "works" if I have a debug breakpoint set anywhere in the OnObjectCollide() ie: the zombie is knocked down and the player is OK. But if I don't break the player is tripped by the zombie. The zombie should be already in knockDown state as the trigger is on the OnDoorCollide, so the player has not passed through the door before the knockDown. I don't know what going into a debugger breakpoint is doing to make it work the way it should, but I would like to know ๐Ÿ™‚

limber summit
#

A trait for each skill

bronze yoke
#

it only passes two objects, the moving object colliding into something and the something it's colliding into

#

oh, i see, your zombie doesn't come from there

#

iirc you have to set some animation variables to knock down a zombie...?

iron siren
bronze yoke
#

if it's unnecessary it might be some weird race condition, otherwise i can't see why a breakpoint changes anything

#

but that kind of race condition is very unusual here as very little in pz is multithreaded

iron siren
#

I tried some of those setVariable(..) but I don't think it liked doing them to an IsoZombie. They seem to only work on an IsoPlayer() but it was 2:00am when I tried it :). It is probably some race condition, or some other animation settle down which runs when breaking. Any ideas where the code is that transitions into the debugger so I can see what states it is setting/freezing?

open river
#

Hello gentlemen. I decided to try to make a mod (for the first time) and almost everything is fine, but there was one problem that I just canโ€™t solve. The problem is that I need to set MaxHealth to the building, which is done EXACTLY through IsoDoor.new. I know that there is no setMaxHealth command, but maybe someone still knows a way. Because of this last little detail, the mod will not be completed. Thank you in advance to everyone who responds and forgive my English.

fast galleon
#

There's things that change while in debug f11, like mouse position which leads to UI weirdness for example when dragging windows or clicking on objects.

iron siren
fast galleon
#

maybe something changes in the collision and then you delay it while in debug.

#

btw, state would change next zombie update. You don't change the zombie state in the shown snippet.

iron siren
#

I tried adding zombie:changeState(StaggerBackState.instance()) before zombie:knockDown(false) and it didn't fix it, and it prevented the "break and run" from working too (player just trips over zombie). This will take some working out I think ... soo much java code to wade through... ๐Ÿ™‚

trim skiff
#

hello, i have question, i can i remove a data from player mod data. i use

modata =  getSpecificPlayer(0):getModData()
modata["itemhotbar"] = {}

i store many item type to that mod data, and i want to remove 1 of the item in that mod data, how to do it?

trim skiff
heady crystal
#

I never tried to save a whole table, but yes you should be able to

#

Just like how you can do modata.X = nil to remove a variable entirely

trim skiff
fast galleon
#

ordered table: use table.remove
key-value table: set to nil

crisp fossil
#

hi guys im modifying a mod to add an attachment but to a different body location. I can now wear it perfectly and attach a weapon to it but it does not show up in my character. Is there anything I missed? Do I need to add to this file too fileGuidTable.xml? I specified a new ClothingItem to it but I'm not sure if it is the right way. Btw, the attached weapon is showing up but the clothing is not

drifting ore
#

Has anyone made it so that when you kill a zombie they can randomly burst into flames?

fast galleon
#

yes, I think somebody has exploding zombies on workshop.

#

I used to have them drop molotovs like last stand.

Fire Hazard mod can randomly set killed zombies on fire.

coarse sinew
#

Hi. Does anyone know what event is called when you hit the window or other parts of the cars?

#

Events.OnWeaponHitXp doesn t seem to be

thorn brook
#

or maybe it was a mod i used idk

nova socket
#

Does anyone know if ModData.transmit can meet a race condition if sent frequently within the same module?

bronze yoke
#

when moddata is received it overwrites the local copy completely, so if two clients transmit the same one at roughly the same time (allowing for ping) it probably will just use the latest one received

#

however there might be handling for this somewhere in the networking as i have literally never seen this cause an issue, when it probably should?

vapid gate
#

Anyone can help make a motorcycle model?

hot patrol
#

How do I make a clothing item that covers the whole body protect your feet?

gilded hawk
#

Does anyone know where the game sets the xp multiplier from the books, when you level up?

#

Cause I need to check where the game sets the multiplier to 0 when you get over the lvl that the book provides

gilded hawk
#

Oh, so in the java side of the addXp?

fast galleon
gilded hawk
#

Alright thank you polter, I will look into the java ๐Ÿฅฐ

fast galleon
#

I had a skill book that gives multiplier for all levels if that's what you are looking for.

gilded hawk
#

Nope, I'm working on a mod that allows you to keep the multiplier after you die, but I have bug where it gives you the previous multiplier when you respawn as higher level

#

Like, I read the book that gives XP boost for carpentry lvl 1 and 2, but the new player spawns at carpentry lvl 3

The code is giving it he boost from lvl 1 and 2, but this should not happen

fast galleon
#

read the next book?

gilded hawk
#

Yeah, that fixes it, but I don't like that

#

Maybe it's a silly math mistake on my side

fast galleon
#

ah, levels are lower by 1 I think

gilded hawk
#

Yep

#

Which is what I'm testing right now

#

Ah, nope still broken ๐Ÿค”

#
function KeepBooksMultiplier:load(player)
  local modData = self:getModData()

  for bookFullName, readPages in pairs(modData) do
    player:setAlreadyReadPages(bookFullName, readPages)
  end

  local skillBooks = self:getSkillBooks()
  for _, skillBook in ipairs(skillBooks) do
    local item = skillBook:InstanceItem(nil)
    local mockAction = ISReadABook:new(player, item, 2)

    -- I had a +1 here
    local skillTrainedLevel = player:getPerkLevel(SkillBook[item:getSkillTrained()].perk)
    local isTooHighLvl = item:getLvlSkillTrained() > skillTrainedLevel
    local isTooLowLvl = item:getMaxLevelTrained() < skillTrainedLevel
    if item:getAlreadyReadPages() > 0 and not isTooHighLvl and not isTooLowLvl then
      Debug:print('Perk:', item:getSkillTrained(), 'lvl:', skillTrainedLevel)
      Debug:print('Apply XP multiplier from:', item:getDisplayName())
      -- checkMultiplier sets the multiplier on the player too :D
      ISReadABook.checkMultiplier(mockAction)
    end
  end
end
#

I think because I'm looping over each book, it's giving the multiplier when it's not supposed to?

fast galleon
#

seems like math is off indeed

gilded hawk
#

Ah goddamit the internal name of carpentry, is not aligned with the item:getSkillTrained()

#

FFS

gilded hawk
#

Alright I fixed it

#

Took a while, but now the system should be bomb proof

#

now I'm always sure on what I'm getting ๐Ÿ˜„

abstract pine
#

How is mod data on items handled by the server in MP? I don't see anything like transmitModData used on items in code I've looked at. Since player inventory is client side, can I expect mod data on items to be automatically transferred with items themselves when they're transferred to the world (and vice versa from the world to a client)?

sour island
#

I did some really janky stuff in GameNight which quickly picks up and places down an item.

#

You could try tapping into the worldInventoryItemObject or whatever that is called

#

and try to push changes into it's InventoryItem there

#

worldInventoryItemObject is an IsoObject so it has transmitModData

abstract pine
#

Thanks, I feared that might be the case but wanted to be sure for anything I do in the future. Luckily, I haven't really done anything yet where it matters if it's kept or not on items

iron siren
#

Just an update on the ZombieSlam mod where sprinting through a door with a zombie on the other side knocks the zombie down: I can repoduce the correct behaviour "Sprint into Door -> Door Opens -> Zombie knocked down" so long as I stop sprinting the moment the door opens. The debugger was doing the same thing - when the debug code breaks, it stops the sprint. I feel a bit silly not realising what it was doing the first time. Anyway... I guess the thing is either the player has to stop sprinting on the door opening, or I have to somehow code the player to not be sprinting for a few frames? Perhaps I can do it by unmapping the sprint key for a brief period and that will be enough? Experiments to follow. Thanks to @fast galleon and @bronze yoke for your assistance ๐Ÿ™‚

verbal yew
#

guys

#

who know how i can see it in online

#

rgb

#

it's standart rgb or...

#

just i can't find this format, only rgb(0-255)

bronze yoke
#

it's the same, it's just 0-1 instead of 0-255

verbal yew
limber summit
# fast galleon sorry it will be something like `if player:HasTrait("ABC") then ...` no way arou...

ty, I did have the code below but it didn't ever prevent xp. Again, the selection of the trait worked when creating the character (it didn't show up on the character sheet later though). And it never prevented xp gain.

`require 'NPCs/TraitFactory'
require 'NPCs/ProfessionFactory'

-- Define the NoCarpentry trait
local function NoCarpentryXP()
TraitFactory.addTrait("NoCarpentry", "No Carpentry XP", -8, "You cannot gain Carpentry skill XP.", false, false);
end

-- Function to apply the trait effect
local function applyNoCarpentryTraitEffect(character, perk)
if not character or not perk then
return
end

local carpentrySkill = "Woodwork" -- The identifier of the Carpentry skill

-- Check if the perk is Carpentry and if the character has the No Carpentry XP trait
if player:HasTrait("NoCarpentry") and perk:getId():lower() == carpentrySkill:lower() then
    -- Set the trait multiplier for Carpentry to 0
    local traitMultiplier = 0

    -- Apply the multiplier effect to the Carpentry skill

    
    print("Carpentry XP gain set to 0 for character with No Carpentry XP trait.")
end

end

-- Event handler for perk leveling
local function onLevelPerk(character, perk, level)
applyNoCarpentryTraitEffect(character, perk)
end

-- Register the trait and event handlers
Events.OnGameBoot.Add(NoCarpentryXP)
Events.LevelPerk.Add(onLevelPerk)
`

agile vigil
bronze yoke
#

if it doesn't show up on the character sheet that's likely just because it doesn't have an icon

agile vigil
#

That's a good shout.

ionic steppe
drifting ore
rugged latch
#

if you dont want a bump animation however then you probably need to do some funky trickery like other people suggest

#

I never got to actually publishing the mod so good luck on your endeavors, maybe youll get to actually post it before you get distracted like me lol

#

if it saves you some trouble this is all you need to play the animation, the bump types are "left" and "right" dont mind the function in it it just returned left or right based off some pretty bad deciding factors

#

and this if you want some fun noises

austere stag
#

hey there, im looking for some mod that i could help develop

#

i have some good knowledge of Java and some of lua

rugged latch
#

you're volunteering?

austere stag
#

yep

#

i need to get some experience to be able to get some job in the area of development

#

so whats better than helping mod one of my favorite games

iron siren
rugged latch
#

If you decide to keep your current implementation thats cool, i'll probably quickly finish and publish my mod since they would then work differently enough that it wouldnt be redundant

verbal yew
#

just cancel animation when on collide with doors

#

nope?

#

looks like mod "zombies jump into windows", when u change state of collide object (Doors in your case) like in open state if its not barricaded and closed (and not locked for doors on your case)

nvm, im stupid

agile vigil
#

Is there any way to use the in-game debugging tools to change modData on an item in my inventory?

I am tiring of having to do 'legitimate' actions to test my mod ๐Ÿ˜„

sour island
#

Just a heads up to anyone using zombies modData as a tempt place to store data - if the zombie gets recycled the modData isn't wiped ๐Ÿ˜…

agile vigil
#

Oh dear.

fast galleon
agile vigil
nova socket
#

If somebody is ever going to be frying their brains trying to understand how items is filled in context menu of inventory

local function yourFunc(player, context, items) end
    items = ISInventoryPane.getActualItems(items)
end
Events.OnFillInventoryObjectContextMenu.Add(yourFunc);

That VERY intersting ISInventoryPane.getActualItems(items) does seem to return PROPER items refs

next vine
#

Does some1 takes commission?

bronze yoke
#

i've taken it to mean 'isometric'

bronze yoke
sour island
#

So people started getting sprinters cause it was the same object ๐Ÿ˜…

blazing osprey
#

It seems like it has something to do with the version but i don't know what i would be able to do about that

blazing osprey
#

hmmm i think im on the wrong gradle version

blazing osprey
outer crypt
#

Does anyone know if there is any documentation on how broadcast radio works? I found some examples but it looks pretty complicated. I have a station created and trying to figure out the loop timing so that the text triggers every 2hrs in game.

#

Right now it triggers for a while and then pauses for hours on end.

limber summit
civic bough
#

Can I make custom animation for a weapon?

quaint brook
#

Does anyone know if it's possible to create new server console commands through the LUA?

fleet bridge
#

Anyone know if it's possible to enter a string with a comma in sandbox vars?

limber summit
#
require 'NPCs/ProfessionFactory'
require 'NPCs/PerkFactory'

-- Define the NoCarpentry trait
local function NoCarpentryXP()
    TraitFactory.addTrait("NoCarpentry", "No Carpentry XP", -8, "You cannot gain Carpentry skill XP.", false, false);
end

-- Function to apply the trait effect
local function applyNoCarpentryTraitEffect(character, perk)
    if not character or not perk then
        return
    end

    local carpentrySkill = "Woodwork" -- The identifier of the Carpentry skill

    -- Check if the perk is Carpentry and if the character has the No Carpentry XP trait
    if player:HasTrait("NoCarpentry") and perk:getId():lower() == carpentrySkill:lower() then
        -- Set the trait multiplier for Carpentry to 0
        local traitMultiplier = 0

        -- Apply the multiplier effect to the Carpentry skill

        player:getXp():addXpMultiplier(perk, traitMultiplier)
        
        print("Carpentry XP gain set to 0 for character with No Carpentry XP trait.")
    end
end

-- Event handler for perk leveling
local function onLevelPerk(character, perk, level)
    applyNoCarpentryTraitEffect(character, perk)
end

-- Register the trait and event handlers
Events.OnGameBoot.Add(NoCarpentryXP)
Events.LevelPerk.Add(onLevelPerk)```
#

I guess I'm struggling to figure out where/how to target that specific multiplier.

fast galleon
fast galleon
sly sigil
#

add big bazongers

dull moss
#

Yo, can anyone help with server-related stuff?
I'm hooking up to vanilla function to catch some stuff

local original_fix_perform = ISFixAction.perform;
function ISFixAction:perform()
    local player = self.character;
    local modData = player:getModData().EvolvingTraitsWorld;
    local vehiclePartCondition = 0;
    if detailedDebug() then print("ETW Logger | ISFixAction:perform(): caught") end
    if self.vehiclePart then
        local part = self.vehiclePart;
        vehiclePartCondition = part:getCondition();
    end
    original_fix_perform(self);
    if self.vehiclePart and ((SBvars.Mechanics == true and not player:HasTrait("Mechanics")) or (SBvars.BodyWorkEnthusiast == true and not player:HasTrait("BodyWorkEnthusiast"))) then
        if detailedDebug() then print("ETW Logger | ISFixAction.perform(): car part") end
        modData.VehiclePartRepairs = modData.VehiclePartRepairs + (self.vehiclePart:getCondition() - vehiclePartCondition);
        ETWActionsOverride.mechanicsCheck();
    end
end```
And it works in SP but in MP it doesn't, apperently ![PepeThink](https://cdn.discordapp.com/emojis/585563074661187605.webp?size=128 "PepeThink")
#

Some server-client stuff and im not really familiar with server side of pz

#

Tested it out and it indeed doesnt update the value

neon bronze
#

Youโ€™d have to transmit that to the server first probably

#

With i think sendServerCommand

dull moss
#

Yea that tells me nothing ๐Ÿ™ƒ

#

there are like 10 of those

civic bough
agile vigil
#

I forget, can we access Java public fields in an instance and expect them to work reasonably correctly?

I want to get all the keys out of a HashMap stored on an IsoGameCharacter.

#

Ack, nevermind, it is a private field.

gilded hawk
#

What is the most performance friendly way to get a list of all items in all the players backpack/fanny bags?

pastel raptor
#

yo guys, anybody available to be hired for a mod? It's a paid work

quiet plank
#

looking to do some tweaks for my server, namely:

1. replace certain vehicles from a vehicle pack with their counterparts in another mod (eg. KI5-M998 in place of FRUsed hmmw)
2. blacklist certain literature items (eg. keep volumes 1, 2, and 5 of Aiming from LY, but exclude 3 and 4)

probably not the first person to ask, so feel free to point me to a page that has the info, but all I've found was prior to some changes that happened in 2021/2022 and at the very least, the mods in the workshop I've loaded to do this aren't working. I've reviewed the code others have written, but can't get them to work properly in my debug instance and so figure there is some step or linkage I'm missing int he chain. Finally decided to make my own mod to patch them out and don't want to be stumbling in the dark.

FTR - I do IT and have a part-time development background, so I don't need to be hand-held, but I do need accurate, current information.

bronze yoke
#

if what the commenter says is accurate the condition is being changed on the server but your code expects it to already be changed on the client by the time that code runs (which will only happen in singleplayer since there's no actual networking going on)

#

if it's deterministic a hack could be to just predict how much the condition would change by based on how the serverside function actually works

dull moss
#

oh wait I think I see something

function ISFixAction:perform()
    if self.item:getContainer() then
        self.item:getContainer():setDrawDirty(true);
    end
    self.item:setJobDelta(0.0);
    FixingManager.fixItem(self.item, self.character, self.fixing, self.fixer);
    if self.vehiclePart then
        local part = self.vehiclePart
        if isClient() then
            -- The server should call FixingManager.fixItem() but doesn't have all the info it needs.
            local args = { vehicle = part:getVehicle():getId(), part = part:getId(),
                condition = self.item:getCondition(), haveBeenRepaired = self.item:getHaveBeenRepaired() }
            sendClientCommand(self.character, 'vehicle', 'fixPart', args)
        else
            part:setCondition(self.item:getCondition())
            part:doInventoryItemStats(self.item, part:getMechanicSkillInstaller())
            if part:isContainer() and not part:getItemContainer() then
                -- Changing condition might change capacity.
                -- This limits content amount to max capacity.
                part:setContainerContentAmount(part:getContainerContentAmount())
            end
            part:getVehicle():updatePartStats()
            part:getVehicle():updateBulletStats()
        end
    end
    -- needed to remove from queue / start next.
    ISBaseTimedAction.perform(self);
end
#

server is doing fixing manager

#

I get 0 hits on looking for fixPart, which is what I assume a client command

bronze yoke
#

yeah, i think vanilla handles them entirely within two files? look for commands and vehiclecommands in the server folder

#

i imagine fixpart is in the latter

fleet bridge
#

was trying to use sandbox string to populate a table, ended up separating the string and using gmatch to populate my table

dull moss
# bronze yoke yeah, i think vanilla handles them entirely within two files? look for commands ...

i found the function in VehicleCommands.lua needed but idk what to do with it. No clue how sending commands stuff works

function Commands.fixPart(player, args)
    local vehicle = getVehicleById(args.vehicle)
    if vehicle then
        local part = vehicle:getPartById(args.part)
        if not part then
            noise('no such part '..tostring(args.part))
            return
        end
        local item = part:getInventoryItem()
        if item then
            part:setCondition(args.condition)
            item:setCondition(args.condition)
            item:setHaveBeenRepaired(args.haveBeenRepaired)
            part:doInventoryItemStats(item, part:getMechanicSkillInstaller())
            if part:isContainer() and not part:getItemContainer() then
                -- Changing condition might change capacity.
                -- This limits content amount to max capacity.
                part:setContainerContentAmount(part:getContainerContentAmount())
            end
            vehicle:updatePartStats()
            vehicle:updateBulletStats()
            vehicle:transmitPartCondition(part)
            vehicle:transmitPartItem(part)
            vehicle:transmitPartModData(part)
        else
            noise('part item is missing'..args.part)
        end
    else
        noise('no such vehicle id='..tostring(args.vehicle))
    end
end```
#

do i overwrite this function to catch condition change?

#

in a same way i did with isFixAction

sour island
#

There's two IfixAction:performs?

#

Oh you're overwriting

#

I would overwrite before the original firing on the event, so it can hit both MP code and SP code in the original

#

As the vanilla function seems to be transmitting the modData of the part

limber summit
#

Can anyone let me know how/where to find info on this "unboostxp"? Google isn't being helpful nor is it findable on the projectzomboid.com/modding site. I've been trying to use a function to change the "traitMultiplier" but I feel like I've just been running around using functions that don't write to that specific variable.

LOG  : General     , 1701469910753> unBoostXP: Woodwork xp:3
   exerciseMultiplier: 1*3= 3
   traitMultiplier: 1*3= 3
   sandboxMultiplier: 1*3= 3
   xpBoostMultiplier: 0.25*3= 0.75
   skillBookMultiplier: 1*0.75= 0.75
Woodwork to be recorded: 0.75
finite kettle
#

is there a way to get this PerkFactory.Perk? this is to addxp on a character

dull moss
#

Commands is local tho PepeThink

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

if isClient() then return end

local VehicleCommands = {}
local Commands = {}

VehicleCommands.wantNoise = getDebug() or false

local noise = function(msg)
    if VehicleCommands.wantNoise then
        print('VehicleCommands: '..msg)
    end
end

function Commands.hotwireEngine(player, args)
    local electricSkill = args.electricSkill;
    player:getVehicle():tryHotwire(electricSkill);
end
...
function Commands.fixPart(player, args)
  code here
end```
#

so I cant catch it like this for example

local original_commands_fixpart = Commands.fixPart;
function Commands.fixPart(player, args)
    if detailedDebug() then print("ETW Logger | Commands.fixPart(player, args): caught") end
    original_commands_fixpart(player, args)
    local vehicle = getVehicleById(args.vehicle)
    if vehicle then
        local part = vehicle:getPartById(args.part)
        if part then
            if detailedDebug() then print("ETW Logger | Commands.fixPart(player, args): part condition: "..args.condition) end
        end
    end
end
#

unless im misunderstanding something

#

Like i just don't have Commands

#

cuz its local to VehicleCommands.lua

dull moss
#

this seem to do the trick

local Commands = {}

function Commands.fixPart(player, args)
    --if detailedDebug() then print("ETW Logger | Commands.fixPart(player, args): caught") end
    print("ETW Logger | Commands.fixPart(player, args): caught")
    local vehicle = getVehicleById(args.vehicle)
    if vehicle then
        local part = vehicle:getPartById(args.part)
        if part then
            --if detailedDebug() then print("ETW Logger | Commands.fixPart(player, args): part condition: "..args.condition) end
            print("ETW Logger | Commands.fixPart(player, args): part condition: "..args.condition)
        end
    end
end

local OnClientCommand = function(module, command, player, args)
    if module == 'vehicle' and Commands[command] then
        local argStr = ''
        args = args or {}
        for k,v in pairs(args) do
            argStr = argStr..' '..k..'='..tostring(v)
        end
        Commands[command](player, args)
    end
end

Events.OnClientCommand.Add(OnClientCommand)

I just joinked how VehicleCommands does its calls and duplicated it

dreamy geode
#

Does anyone know if either of these options is possible for dedicated servers?

  1. Get a total report of items remaining on a server to support a view of the overall map item economy?
  2. Can one export information from a dedicated server such as faction list?
mellow frigate
#
  1. yes
tardy night
#

Hello everyone, I'm trying my hand at modding PZ to add genuine stat differences to the Occult Zombies mod. I got the hang of it, but I have no idea how to give zombies a permanent flag to avoid updating them again once the game is quit then loaded back up. Is such a thing even possible ?

agile vigil
gilded crescent
fierce tartan
#

I wonder. Is there a way to see what code runs when I trigger an action in the game?

I'm trying to find the code that handles combining partially used glue or duct tape, but finding anything in the folders is a bit of a nightmare. For example in Maya I can do stuff in viewport and have all actions printed out in the script editor, so I'm curious if there is a setting in debug that would allow that, so I can get an idea where to look for the specific code I need.

fast galleon
#

Something that usually works for finding actions that trigger from context: search for the translation text, then search for the translation key, then go to the function set for that option.

agile vigil
tribal gull
#
function: doMenu -- file: ISHotbar.lua line # 105 | Vanilla
function: doMenu -- file: MutiesContextMenuIconsAttach.lua line # 11 | MOD: Mutie's Context Menu icons
function: onRightMouseUp -- file: ISHotbar.lua line # 280 | Vanilla
java.lang.RuntimeException: attempted index: null of non-table: null
    at se.krka.kahlua.vm.KahluaThread.tableget(KahluaThread.java:1689)
    at se.krka.kahlua.vm.KahluaThread.luaMainloop(KahluaThread.java:492)
    at se.krka.kahlua.vm.KahluaThread.call(KahluaThread.java:163)
    at se.krka.kahlua.vm.KahluaThread.pcall(KahluaThread.java:1980)
    at se.krka.kahlua.vm.KahluaThread.pcallBoolean(KahluaThread.java:1924)
    at se.krka.kahlua.integration.LuaCaller.protectedCallBoolean(LuaCaller.java:104)
    at zombie.ui.UIElement.onRightMouseUp(UIElement.java:1458)
    at zombie.ui.UIManager.update(UIManager.java:910)
    at zombie.GameWindow.logic(GameWindow.java:262)
    at zombie.core.profiling.AbstractPerformanceProfileProbe.invokeAndMeasure(AbstractPerformanceProfileProbe.java:71)
    at zombie.GameWindow.frameStep(GameWindow.java:765)
    at zombie.GameWindow.run_ez(GameWindow.java:667)
    at zombie.GameWindow.mainThread(GameWindow.java:495)
    at java.base/java.lang.Thread.run(Unknown Source)```
nova socket
agile vigil
nova socket
gilded crescent
#

simply because I'm lazy and wouldn't be able to keep up with updates if I released it public

nova socket
#

You can navigate to ISBuildingMenu.lua or ISInventoryPane to inspect how exactly contextes are built @agile vigil
Basically there is a context within a context that has the same option added via addOption that returns entry. You can set icon to any entry same way you did it for other stuff.

agile vigil
agile vigil
gilded crescent
gilded crescent
#

either way the mod is awesome, been using it all morning and I think it's gonna be one of those mods that is permanent in my load order

nova socket
# agile vigil They're the same context? So I can just get the submenu option by name from the ...
      addSubMenu: ((option: any, menu: any) => any) | any;

      addOption:
        | ((
            name: any,
            target: any,
            onSelect: any,
            param1: any,
            param2: any,
            param3: any,
            param4: any,
            param5: any,
            param6: any,
            param7: any,
            param8: any,
            param9: any,
            param10: any
          ) => any)
        | any;

You can add submenu to existing context. Where menu is the parent context and option is the field this parent has returned from addOption.
So in fact you can build an infinite ladder of options in context menus. context:options() can return all entries of current context.

blazing osprey
#

Does anyone here have capsid intellisense working? I can't figure out what i'm doing wrong

quaint brook
blazing osprey
agile vigil
fast galleon
fast galleon
agile vigil
nova socket
#

Basically you access option, get submenu from it, access its options.. and do that until you reach the end.

agile vigil
#

Which function are you using to get the submenu from the option? And to access an option I need a Context.

So ideally I'd access the submenu context from the option.

agile vigil
#

Got it.

#

A minimum working example.

function test(parentContext, optionName, subOptionName)
  option = context:getOptionFromName(optionName);
  if not option then return end
  local subContext = context:getSubMenu(option.subOption);
  local subOption = subContext:getOptionFromName(subOptionName);
  if not subOption then return end
  subOption.iconTexture = getTexture("media/ui/icons/Test.png");
end

PS: I do not like the stripes much, I think I'll just do a solid colour.

#

Much better. I'll hush for a few hours now laugh

sour island
#

The file for context menu is ISContextMenu, there's a lot of fun things in there

#

A good QoL for a lot of modders to consider is keeping the option even if it's not allowed and instead making it unusable and red instead.

#

Maybe add a tooltip to tell you why - etc

nova socket
agile vigil
#

This repo is so much harder to read than the .lua laugh

nova socket
#

I use it as a pivot when I have no idea of what exactly is going on with specific class methods and functions.

#

i mean otherwise you can use that source (dont have a link) with it described from Java perspective

#

For me its all about having returned types here and there.

tribal gull
#

What's the quickest way to completely get rid of certain items?

tranquil kindle
tribal gull
#

Could doParam that I guess.

tribal gull
#

I don't care about the items themselves, but I wonder how it affects distribution.

outer crypt
#

I have a list of sound items that starts in the game as a defined list.

Playlist.files = {}

Playlist.files[1] = "sound1"
Playlist.files[2] = "sound2"
Playlist.files[3] = "sound3"
Playlist.files[4] = "sound4"

later I have a command that is run by a client to update the sound list.

for i=0, ContainerItems:size()-1 do
local item = ContainerItems:get(i)
Playlist.files[i+1] = item:getType()
print(i+1 .. " is " .. Playlist.files[i+1])
end

I need to get that list to update to the other clients. Is there a way to do this with moddata on a server?

#

Maybe something like this? if isClient() then ModData.transmit("MyModData") end

lofty mantle
#

can i use assetto corsa models in zomboid if i triangulate them in some way

drifting ore
#

-- If Shop.SellisBlacklist and Shop.SellisWhitelist set to false every item is sellable
its was only one set on false
but it work before idk why its not now

nova socket
drifting ore
#

Have a shop ingame to sell the jewelry etc and every item is priced at $1

nova socket
#

Ok, but why are asking me about this?

gilded crescent
# drifting ore

My guess is the fact you have both set to true, blacklists and whitelists do the opposite of eachother so having both turned on will not work.

A blacklist would ban items from being sold, a whitelist would allow only those in the list to be sold, that list can not do both at the same time

#

Having them both on false means, there is no whitelist to allow only the list to be sold, and there is no blacklist to ban certain items from being sold.

boreal garnet
#

I'm looking for the file that govern zombie noise attraction intensity (player shout, gunshots, etc.). Anyone happen to know where it is? mrbeaverton

rugged latch
#

so just a heads up to anyone here it seems that "getPlayerMoveDir()" does not return the correct direction if the player is in combat stance
at least for me it repeatedly reproduces a result different to then if your not combat stance walking that direciton

gilded hawk
#

Is there a reliable way to stop zomboid from trying to load the lua code from your workshop folder when you are in debug mode and working on a local version of your mod?

I just wasted the last hour of work because zomboid kept loading the mod from this path
C:\Program Files (x86)\Steam\steamapps\workshop\content\108600\3001605399\mods\casualoid\media\lua\client\Casualoid\OnGameStart.lua
instead of
D:\ZomboidDevCache\Workshop\pz-Casualoid\Contents\mods\casualoid\media\lua\client\Casualoid\OnGameStart.lua

#

It loaded my local version only after I unsubbed from my own mod ๐Ÿ˜ฆ

#

I'm not sure why this keeps happening, but I remember this used to not be a problem about a year ago

bronze yoke
#

-modfolders mods,workshop

#

steam workshop content (as opposed to workshop folder) is 'steam' in that list

gilded hawk
#

I'm sorry how should I use this lauch option?

#

Shoul I just add it to my current options?

bronze yoke
#

yeah

gilded hawk
#

Does the order matter?

#

Cause I still kinda need to have the steam workshop loaded to debug incompatibilites with other mods

bronze yoke
#

the order doesn't matter

#

(probably)

#

i started just symlinking in mods i want to test with but it's somewhat manual

gilded hawk
#

I do that for my NOS-Client and NOS-Host

#

But for local SP development is very very overkill having to use symlink ๐Ÿ˜• (IMHO)

bronze yoke
#

yeah luckily i just haven't had too much need for it yet, i imagine i'll turn it off when i need to

#

maybe write a python script to do the heavy lifting for me...

gilded hawk
#

Maybe with powershell you could have an easier time since it would already take care of running with admin privileges, and be a bit more native, if you are windows

bronze yoke
#

hmm, i've got no experience with that but it does sound more sensical

shell mountain
#

How does one get started in the modding world?

rugged latch
#

do you know how code?

shell mountain
#

Learning, what language?

opaque fiber
#

you can also make a mod in java but having others download it is not as easy

opaque fiber
#

in 99% of cases the lua api is enough for modding

rugged latch
#

above anything else youll probably need this

#

its a bit overconfusing so you dont have to use it if you dont want to

#

but eventually youll get to a point where it wil be helpful

#

it just lets you get autocomplete and stuff for when writing code

#

https://projectzomboid.com/modding/
this website has like every single function and detail for most things that you'd want to know since rn zomboid doesn't really have a modding documentation this is as good as it gets

#

overall though its sorta just a think of a thing you want to do and throw yourself at it till you get closer or learn something from it lol

civic bough
#

How would you implement changing model of weapon based on current durability?

opaque fiber
#

the only hacky way i can think of doing that would be replacing the item entirely with the different model variant once it either breaks or its durability drops to a certain point

shell mountain
#

Whats the limits of moding?

opaque fiber
#

hard to say for sure

#

there's hard coded things you can't change via lua coding, and that are for example the vehicle and zed stories

#

but you could change those by java modding

#

depends on what you're trying to do i guess?

crisp fossil
#

I have a local mod and it is working perfectly last time but after I tried to verify integrity of game files any changes I made to the mod has no effect. Is there anything I can do? Maybe its cached or something

finite yarrow
crisp fossil
finite yarrow
#

i always delete the mod from Workshop when i have uploaded it to the workshop. I don't know if there is an easier way hungover

crisp fossil
#

Okay. thank you so much for the help!

fierce tartan
#

Hmm. How does the game figure out if a food item is stale? I can find isCooked and isRotten to figure out the other states, but Staleness doesn't seem to be handled the same way.
I can see the food items have the age fresh and rotten coded in. Is the only way to find if an item is stale to query the age of the item and then compare it to the fresh age? :/

mortal pawn
#

Hey I'm looking to make some tshirt retextures for the server I admin. Is there a simple guide for that? or consult the wiki?

#

I dont want to edit stats, or add models, just retexture the vanilla tshirt.

pine patio
noble mauve
#

How can I change character player model if it possible?

cedar kraken
#

Heyo. Iโ€™ve been trying to get started on some mod ideas for a while now, but Iโ€™m having quite a hard time getting things to work and just with figuring out where I should begin

#

One of the mods overhauls everything about the gameโ€™s medicine and health mechanics, I have around 30 documents for organizing the various ideas. Iโ€™m looking for something easier to start with. Two main mods Iโ€™m working on are expanded short blunt and expanded boots.
However, Iโ€™ve run into a few critical issues with the boots mod.

#

I suppose the first issue I have is with changing the properties of Riding Boots.
I want to make it so that they cover both the feet and the shins, and only replacing the shoes, whilst still allowing to wear socks and stuff

#

However I canโ€™t figure out how to get the body locations stuff to function ๐Ÿ˜•

#

Any help is greatly appreciated!

cedar kraken
tranquil kindle
cedar kraken
#

Iโ€™ve come to learn that seemingly few of my ideas have any easy solutions ๐Ÿ˜…

#

I also donโ€™t know how to go about adding new weapon modification slots to firearms. That was probably the first major issue I ever ran into and probably the one that broke me and made me remember why I hate coding lol

#

I could just compile a list of all my main questions and issues and see if anyone can help with them.

cedar kraken
bronze yoke
#

you can have multiple on an item by just separating them with semicolons

#

body locations are mostly just 'equipment slots' in that they're used to make items mutually exclusive with each other, most functionality actually looks for the blood location

gilded hawk
#

New respawn mod prototype, With optional Respawn penalty trait for players who want a bit more challenge.

Trait cost, and XP is fully configurable,:D

cedar kraken
#

Thank you so much!

#

Thereโ€™s one big thing down for me, hooray

quick cape
quick cape
# gilded hawk I like that!

also depending on how it's set up
there should be special interactions if you encounter your old dead body/your zombie self
like
MAX PANIC and MAX STRESS
but only for the first few times, when being a returner is still a concept that has to be digested
would become weaker over time, the stress and panic

agile vigil
gilded hawk
quick cape
#

so
not gonna be able to work on it today
but
any recommendations for when one wants to learn how to mod?

for start i want to add:
-Stone Firepit (Like campfire but you cant walk into it)
-Log barricade Window/Doorframe
-Stick Fortification/Unopanable window
-Cobblestone floor

then slowly expand from that idea when i get better
if i can reverse engineer the games definitions, i'd be very happy

gilded hawk
agile vigil
# quick cape so not gonna be able to work on it today but any recommendations for when one wa...

Either one of these individually are pretty doable - I'd probably argue the fortifications are the most simple, as adding things to the "Building menus" is a headache.

Doing the other things by just making a new menu for your own building is not nearly as difficult, though, and you could look at mods like the ones that let you place concrete floors for examples.

I should make a framework mod to make it less of a headache, actually...

quick cape
agile vigil
agile vigil
# quick cape IntelliSense? dafriq is that?

It's like the catch-all term for type-ahead suggestions and stuff in your coding IDE of choice. It lets you click over to the definition (or uses) of a .lua function so you can see what file implements it as well, and keep clicking around to get a full picture of what's going on, even if everything is in 7 different files.

quick cape
pliant citrus
#

Hey, I'd like to make a small mod that simply adds a few cool posters to the game for me and my friends, should I use the modelling guide found on the forum and use a downsized png for transparency and performance or is there an easier way to add wall decorations similar to the vanilla clock I guess?

cedar kraken
#

Is there a way to change the display name of a vanilla item?

#

Iโ€™m trying to make it so that "Military Boots" are renamed to "Combat Boots"

cedar kraken
#

Canโ€™t seem to get it to work though

sour island
#

๐Ÿ˜ฎ Steamworkshop stealth update - you can now let co-authors upload to workshop

#

Community-Modding account can now be added as a co-author to any mod and update right from a github

foggy finch
#

hey guys, how can i detect if a door is closed or opened

rugged latch
sour island
#

Cows with Guns told me and I just tried it

foggy finch
fast galleon
sour island
#

Only list them as a credit in the description - no clue tbh

#

Maybe in the next 10 years Steam will add support for differentiating contributor to co-author

limber summit
#

When using getPerkLevel(), what exactly should I be using. I tried PerkFactory.Woodworking, "Woodworking", PerkFactory.Perk.Woodworking, to no avail.

bronze yoke
#

Perks.Woodwork

agile vigil
hollow current
#

is there an event for before vehicles spawning but after sandbox options have been loaded? For context, I am trying to add a custom part to vehicles based on sandbox settings, but apparently sandbox settings do not have the time to load yet so the option is always false (at least as far as I understood the problem)

#

I am using this script btw ^

bronze yoke
#

try oninitglobalmoddata

#

i did something to parts and it was fine

hollow current
#

Yup, this does the job, thanks!

quick cape
#

something else i wanna add longterm, but want to know if its possible at all: woodash and woodash cement
I would need a script that checks for how long a fire has burned for in total and then deposits a unit of woodash into the fires inventory after x amount of ingame minutes the fire has burned for.

limber summit
#

I'm messing around with the addXpMultiplier thinking that it would allow me to get at the attached photo's traitMultiplier, but it doesn't seem to have that capability. Any idea which method targets that specific multiplier?

#

Also, is there a way to mess with the .75/1/1.25 boosts such that you can set them to be 0 if you put the number negative?

#

As in, 3*0 = 0 and you get 0 xp.