#mod_development
1 messages · Page 363 of 1
Thank you for the tip will check this out. 🙂
i am currently making mod downloader for nosteam players
@small ospreyyup no problem 🙂
Those are missing definitions, thx for reporting it I'll add those
Is it possible to have separate sandbox options for singleplayer vs multiplayer? As in, is it possible to not include all options or have different default values?
No
You'll have to make 2 different options
Can be in 2 different pannels
Could do the trick
So panel 1: My Mod [MP]
Panel 2: My mod [SP]
Thank you @bright fog! ||Would it be possible to get the custom sandbox page https://pzwiki.net/wiki/Sandbox_options#Sandbox_options_in_the_Lua to state one can enter a custom page name and/or a list of the vanilla pages? I am not sure how I was able to figure out the vanilla page Time is called TimeOptions, it was likely just told to me some time ago. Knowing this now, I can see how it could be inferred from this companion page https://github.com/demiurgeQuantified/PZModdingGuides/blob/main/guides/SandboxOptions.md, but I think it is also easily missed as a fact||
I made an account and am working on it myself, sorry to bother!
Hello devs,
Im making a mod to control reanimated IsoZombie with "Companion" role to follow the player and attack zombies around the player.
At the moment Im fighting against the zombie tendency to lunge and aggro the player in every OnZombieUpdate before perceiving and action according to the Companion role.
Refering to Bandits code, it seems to juggle the zombie's target and pathfindbehavior around to de-aggro and move (which Ive made good progress on)
But some action state and therefore animations get stuck. Bandits code says a bandit that goes to Lunge state becomes useless and has their pathfindbehavior reset.
Can anybody point me the way to deeply understand how to hijack the action state and what are the implications of zombie:setUseless(true) ?
That wiki page is one of the very first one I've made, so yea it deserves to get some love for sure
What i got just manually testing so far. I haven't figured out the last two or how if it is possible to have your options appear anywhere but the bottom of the page
Sandbox Option Page Names
Time = TimeOptions
Zombie = Zombie
Loot = Loot
World = World
Nature = NatureOptions
Meta = Meta
Character = Character
Vehicles =
Livestock =
ZOMBIE OPTIONS = ZombieOptions
By default you can't get your option to not appear at the bottom of the page
You have to hack in the UI for that
Also I suggest not adding your mod options to vanilla menus
Bcs then players don't make the difference between modded and vanilla features
You can find the other vanilla page IDs from the translation entries most likely
Does this mean it is possible to alter the display name of custom tab? They're prefaced with Sandbox_ by default
Yes
You should add translation to the page name
That's how it's meant to be used
I think that wiki page needs a shit ton of love lol
Ahh I did find it on that page under translations
I have some open faced helmets in my mod. When the character drinks the character automatically un-equips/equips the helmet. Is there a way to prevent this?
This is what I get for assuming translations are only for alternative languages x_x
Thank you yet again!
so turns out b42 disabled rendering for isoplayers
mod is cooked 👍
at least it works in b41
Can you give me more info on this screenshot ? What error do you get for the table armor ?
table blocks can have custom IDs ?
yea, thats from the rotatorlib armor
seems so, its pretty special, but tsarlib has something similar too

This sounds deprecated
Because script blocks don't have equal signs normally
@grizzled fulcrum uh oh
Omg I see what's going on ? That script block literally defines a Lua table no ?
Oh man that's cursed as shit
@bronze yoke do you know anything about those table scripts ?
I need to find the vehicle parser I think
?
the needs = {?
Yea
Literally a table definition
but its easy fix
I mean it should be a parameter and not a block I think
oh
@knotty stone
Can you tell me what the needs block error is here please ?
yeah it should definitely be classed as a param
in any case, since there will always be a { after the equals that is how you can differentiate it from a normal parameter value
if you still have issue after (which i doubt you will since you use regex pretty well) then lmk but im sleeping now
if armor.needs.part then
local guard = vehicle:getPartById(armor.needs.part)
if not guard or not guard:getInventoryItem() then
return false
end
if armor.needs.condition then
local condition = tonumber(armor.needs.condition)
if not condition or guard:getCondition() < condition then
return false
end
end
end
end```
Yea I think it should be fine even for the highlights
will that still work?
hi
any materials or java code sources to understand the AI action state engine further than what the wiki says?
are u making npcs?
Yes, friendly using IsoZombies
ooo
idk about the vanilla but i can show u me state machine
it uses isoplayers tho
Yeah, my pain comes from the aggroing I need to overwrite ):
heres my first post
No idea, idk about aoqia's suggestion here
are u confused about the
lua part
or the vanilla ai part
i can help with lua but no experience on vanilla sadly
Im reading a lot dor bandits code. Either I dont know enough about how to manipulate the zombies like they do. Im doing every operation they are doing and I still get diff states
ok
cant send files
💀
hold on
bruh
local NPCStateMachine = {}
local TypeToStateModule = {
Officer = require("Type_OfficerStates")
}
function NPCStateMachine.ChangeState(NPC, NextState, Tick)
local StateModule = TypeToStateModule[NPC.Type]
StateModule[NPC.State].Leave(NPC,Tick)
NPC.State = NextState
StateModule[NPC.State].Enter(NPC, Tick)
NPC.NextState = nil
end
function NPCStateMachine.UpdateState(NPC, Tick)
local StateModule = TypeToStateModule[NPC.Type]
StateModule[NPC.State].Update(NPC, Tick)
NPC.Object:addLineChatElement(NPC.State)
if NPC.NextState then
NPCStateMachine.ChangeState(NPC,NPC.NextState, Tick)
end
end
return NPCStateMachine
there we go
i called this every 500 ms or so
Wow, those are some new interfaces
OfficerStates.NoAiAlert = {
Enter = function(NPC, Tick)
end,
Update = function(NPC, Tick)
local ConditionTable = Conditions.CheckCondition(NPC, "ClosestVisibleTarget", {Range = FIND_TARGET_RANGE}, Tick)
local NearestTarget,DistanceToTarget = ConditionTable.Target, ConditionTable.Distance
if NearestTarget then
NPC.NextState = "Idle"
end
end,
Leave = function(NPC, Tick)
ISTimedActionQueue.clear(NPC.Object)
end
}
and this is what it would call for an example (depends on state)
none of these interface with vanilla code its just lua
its a table
NPC.Object is isoplayer
NPC just holds
name weapons range state that kinda stuff
ye i switch around using NextState
I never saw this b4
ISTimedActionQueue.clear(NPC.Object)
it is for IsoPlayers
it clears timed actions
since ur going to use zombies tho
u can also use condition type thing i made
["needs"] and [needs] both seem to work, armor still functioning
yeah but maybe it works with IsoGameCharacter
u see this right Conditions.CheckCondition(NPC, "ClosestVisibleTarget", {Range = FIND_TARGET_RANGE}, Tick)
it calls
function Conditions.CheckCondition(NPC, ConditionName, ConditionArgs, Tick)
if not (NPC.ConditionData[ConditionName]) or (NPC.ConditionData[ConditionName] and (Tick - NPC.ConditionData[ConditionName].Tick >= ConditionData[ConditionName].CheckRate*60) or (ConditionData[ConditionName].ValidityFunction(NPC, ConditionArgs, Tick) == false )) then
NPC.ConditionData[ConditionName] = ConditionData[ConditionName].ConditionFunction(NPC, ConditionArgs, Tick)
NPC.ConditionData[ConditionName].Tick = Tick
end
return NPC.ConditionData[ConditionName] or {}
end
so basically
Interesting
Well idk what to do with this info because needs is also valid 😅
I'm interested to get your feedback long term on it too, I'm actively working on it rn and going to add parameter support soon enough
check condition checks if:
the npc already checked for a target not too long ago
if so VALIDATE the target, do not loop and find a new one (faster)
if the npc did not check too long ago, or it has been too long
loop and find a new target
for loops checking and validating every target generally kills performance in npcs
so u want to keep that low
I have a throttle function keep CPU cool
ye good idea
a better naming ngl
u might also want to check out behaviour trees if ur companion ai is going to be very complicated
they are annoying to set up but are easier to manage
Way easier
I just wanted to make it very straight foward to code
and testing wether I can keep the zombie under control
before diving on state pattern
i can send u me mod file if u want
im going to most likely leave it since isoplayers dont work in b42 😭
mod works fine on b41 tho last i checked
No need, I appreacite it tho
If you want to see me fighting the vanilla ai state machine -> MohgulBehavior orquestrates MohgulProgram
https://github.com/shinkenuu/mohgul/tree/state-machine
local actionStateControls = {
["onground"] = function()
if zombie:getVehicle() then return true end
if zombie:isUnderVehicle() then
zombie:setX(zombie:getX() + 0.5)
zombie:setY(zombie:getY() + 0.5)
end
return false
end,
["turnalerted"] = function()
-- if MohgulPerception.IsHostile(zombie:getTarget()) then return false end
zombie:changeState(ZombieIdleState.instance())
MohgulCombat.Passify(zombie)
zombie:changeState(ZombieIdleState.instance())
return true
end,
["pathfind"] = nop,
["lunge"] = function()
if MohgulPerception.IsHostile(zombie:getTarget()) then
MohgulCombat.Passify(zombie)
zombie:changeState(ZombieIdleState.instance())
end
return true
end,
["getup"] = nop,
["getup-fromonback"] = nop,
["getup-fromonfront"] = nop,
["getup-fromsitting"] = nop,
["staggerback"] = nop,
["staggerback-knockeddown"] = nop,
["idle"] = function()
MohgulCombat.Reutilize(zombie)
return true
end,
}
end
--- Clear aggro list and target seen time
--- @param zombie IsoZombie
function DeAggro(zombie)
print("DeAggro(zombie=" .. tostring(zombie) .. ")")
zombie:clearAggroList()
zombie:setTargetSeenTime(0)
end
--- Resets target, aggro list, target seen time
--- @param zombie IsoZombie
function Passify(zombie)
print("Passify(zombie=" .. tostring(zombie) .. ")")
-- zombie:setUseless(true)
zombie:setTarget(nil)
DeAggro(zombie)
end
--- Set as useless and passify
--- @param zombie IsoZombie
function Inutilize(zombie)
print("Inutilize(zombie=" .. tostring(zombie) .. ")")
zombie:setUseless(true)
Passify(zombie)
end
--- Set as not useless safely
--- @param zombie IsoZombie
function Reutilize(zombie)
print("Reutilize(zombie=" .. tostring(zombie) .. ")")
if zombie:isUseless() then zombie:setUseless(false) end
end
I use IsoZombie:pathToLocation(nearPlayerX, nearPlayerY) to keep social distance when near player and IsoZombie:pathToCharacter(player) when its far away (like 8 steps away)
Also for the future, do know you can contribute to the modding wiki in case you see problems or things that need updated info
That's what I did 🙂 I have only added the small note about setting page name.
I agree though about making your own tabs for mod settings, so I don't plan to list the names to add options to vanilla settings tabs on the wiki. I am unsure why I had mine originally under Time instead of its own. Perhaps B41 did not allow for it on MP launch? Regardless, I have moved to a new tab hahaha.
Thank you as always!
Can someone help me with how I can implement an infinite weapons mod on my multiplayer server? The mods that exist here are local, single-player only, and I can’t figure out how to make this work. Can anyone help me?
Hey guys. Right now, the area behind the character is only slightly dark, so you can still see floors and walls, and sometimes you can barely even tell where the vision cone actually is. I’d really like to make a mod that fully or almost fully darkens everything outside of the character’s vision cone, something closer to how it worked back in B41.
My programming skills kinda suck, I mostly rely on Cursor to write code, so I don’t really know which values or functions control the vision cone darkening. If anyone knows where this is handled in Build 42, or whether it’s even possible to change, I’d really appreciate any help.
you're not going to like this but these are also blocks
type: needs id: =
Does anyone know how to remove these errors that always appear in console.txt? because they bother me to debug
LOG : General f:0, t:1767207586826> ERROR: mods isn't a valid workshop item ID
LOG : General f:0, t:1767207586832> ERROR: mods isn't a valid workshop item ID
LOG : General f:0, t:1767207586838> ERROR: mods isn't a valid workshop item ID
...
you can't
it can't be done?
it can't be fixed
Would need to be a java mod, and mucking with PZ's rendering engine is 9th level cursed.
all the code is raw opengl calls with all literals replaced with numbers.
Has anyone thought about an indepth temperature system for vehicles
Like Windows frosting up to a point you can't see out of them
I'd just like more scene setting for winter temperatures
Maybe snow dosent set under areas occupied by vehicles and snow develops ontop of cars the longer its not removed
Or a cold start may damage the engine or cause the engine to turn over slower but once it begins to heat up, the engine will work good intill it goes cold again
Or just add a scrapper tool or use a credit card to scrape frost off windows
Which will prevent you from seeing outside of the car
Go for it tiger 🙂
Hello, I have a question I hope someone can answer:
I have been trying to spawn items within a backpack/bag through Lua code, but cannot figure out the correct method to do so for a multiplayer server.
The player would already have the bag/pack and the right click context menu > add items, and it should add the items, but it is not doing so.
I've tried a few different methods, such as sendItemsInContainer, as well as getInventory():AddItem("Apple"), as well as getItemContainer():AddItem(), and none of these seem to work correctly.
I can check the bag first, to see if an item already exists with getItemContainer():getItems(), and loop through that array, and it finds items already within, so I know I can access the bag. But when I try to spawn an item, it does not seem to work.
Does anyone have any insight into this? I'm trying to remember a mod that spawns items like this, but I just can't remember off the top of my head to look for reference.
Thanks for your time! And Happy New Years everyone!
These are blocks ? No a table thing ?
Have you checked the Project Zomboid API for Inventory Items PDF, in particular section 5 "Synchronisation of the creation, deletion and modification of items and objects"? it will be in the stickies in this channel
I'm not certain it will answer your question, but it's a starting point.
Did you use AddItem and sendItemToContainer at the same time?
I'm sorry for the confusion, I'm still working on B41 right now. Should clarify moving forward with my questions
did the B42MP update change the process for adding custom items?
i suppose it must have since my old code doesn’t work anymore
oh goddamnit ammo types are different now too
this is a problem for tomorrow me
It changed a lot of things.
Including items.
The changes are not difficult; have a look at vanilla items to see the new syntax... but the changes affect lots of things
I know that feeling too well!
Hi. I want to make my first PZ mod, but I'm unsure if what I want to make is even possible.
I want to create a new action that requires a pickaxe and will remove any type of 'street' tile and replace it with any type of 'brush' tile. e.g. I can dig up a driveway and then plant crops in the new 'turf'. In DEBUG mode I have to use the Brush Tool to delete the 'street' tile, which leaves a black hole in the map, and then I have to use the Copy Tile option to copy a 'brush' tile and paste it into the black hole gap.
I want to do this but require a pickaxe and do it not in DEBUG mode, but instead have it as an action that can be done whenever the player has a pickaxe. I also want to have SANDBOX options to increase/decrease the time it takes in-game to dig up the tile.
Is this even possible?
Any suggestions on what I need to look into to do this - btw, I want to do this for B42.13+
Yeah, this is possible, but you’re thinking about it the same way the debug brush works, which won’t work in normal gameplay.
In PZ you don’t really “delete” street tiles. The brush tool is editor-level stuff, that’s why it leaves black holes. In a mod you have to replace the floor tile, not remove the square.
Okay, that's a great help. I've seen there is a separate discord for mapping/tiles stuff - do I need to go there to look at 'swapping' a tile stuff, or is it something that can be done just with Lua?
Yes, it can be done only in Lua.
Timed actions, checking for a pickaxe, reading the floor sprite, replacing it with setFloor(), and adding sandbox options are all exposed to Lua
above
Thanks! You've been a great help.
basic example
if not square then return end
local floor = square:getFloor()
if not floor then return end
local sprite = floor:getSprite()
if not sprite then return end
local name = sprite:getName()
if not name then return end
-- simple check, you’d expand this for more tiles
if not string.find(name, "street") and not string.find(name, "road") then
return
end
-- replace the street with grass/dirt
square:setFloor("blends_grass_01_0")
square:transmitUpdatedSprite()
end````
Hi everyone! 🙏
I’m trying to implement a boundary mechanic in 42.13. The idea is:
When the player spawns, they are enclosed by invisible, indestructible walls.
Each subsequent day, the boundary expands outward, giving the player more space.
Is it possible to achieve this in 42.13? If so, what’s the best approach to implement it?
24 or 42
sorry, 42
This is invaluable! Thank you so much! The 'transmit' I would never have known about and the setFloor is perfection! Thank you.
Yeah, this is doable.
You don’t mess with the map or editor walls. The clean way is to spawn invisible blocking objects at runtime.
On player spawn:
• Grab the player’s starting square
• Calculate a box or radius around them
• Spawn a ring of invisible, indestructible blockers along that boundary
These aren’t real map walls, just world objects that block movement. You can do this in Lua with something like an IsoThumpable (or similar) set to:
• invisible sprite
• not thumpable
• effectively indestructible
• collision enabled
For the expansion:
• Keep track of the current boundary size
• Once per in-game day, remove the old blockers
• Spawn a new ring farther out
Key points:
• Only update once per day (performance)
• Test which blocker setup works best for player/zombie collision
• Use transmit calls so it syncs properly in MP
You’re not editing tiles or the map itself, just adding/removing blocking objects, which Lua supports. The idea is solid — the only trial-and-error part is picking the exact invisible object settings that feel right.
Is there an example mod with comments or a good B42 tutorial about how to create a mod that adds an option to the context menu?
-- Simple example: Add a context menu option to cigarette pack
local function onClickSmoke(playerObj, cigarettePack)
cigarettePack:Use()
print("You clicked smoke! Pack has " .. cigarettePack:getCurrentUses() .. " cigarettes left")
-- You can do anything here:
-- - Reduce stress
-- - Play animation
-- - Show a message
playerObj:Say("*lights cigarette*")
end
local function addSmokeCigarettePackOption(player, context, items)
local playerObj = getSpecificPlayer(player)
-- Loop through items being right-clicked
for i, item in ipairs(items) do
-- items table contains wrapped objects, get actual item
if not instanceof(item, "InventoryItem") then
item = item.items[1]
end
-- Check if item exists and is a cigarette pack
if item and instanceof(item, "InventoryItem") then
if item:getFullType() == "Base.CigarettePack" then
-- Check if it has cigarettes left
if item:getCurrentUses() > 0 then
-- Add the menu option with icon
local option = context:addOption("Tapa na pantera", playerObj, onClickSmoke, item)
option.iconTexture = getTexture("Item_CigaretteRolled")
end
break
end
end
end
end
-- Register the function to run when right-clicking inventory items
Events.OnFillInventoryObjectContextMenu.Add(addSmokeCigarettePackOption)
getThumpableWall and getThumpableWindow can both return null
even though i am next to a window?
A window isn't a wall
No ?
most walls aren't thumpable
oh
is it possible to damage isoobjects then?
there is a :Damage function but i have yet to see it do anything
If it's ones you placed, you can probably place them as thumpables
Instead of just IsoObjects
i need to destroy the ones game generates
There is an IsoObject.AttackObject but the logic looks fairly limited
Outdated, probably
hmm
In what way ?
Like having an entity attack them ? Or just remove them ?
poof gone and i spawn some planks i guess
what im trying to do
is when soldiers fire on u and miss
i want them to damage the enviorment
That much is covered by AttackObject, assuming it works
That isn't something the base game does in the first place, what's the reason you want to add that in ?
But again, limited logic with presumably not ideal side effects
well the soldier npcs have a
supress behaviour
when they cant see u but are close enough
they keep firing to keep u in place while assaulters move in
i want to emphasise that
You probably want to just use mod data for damage & "destroy" it yourself
Why don't you just make the NPCs suppress fire you while some are moving close to you to get you when you are pinned down ?
hmm alright
they already do taht
it just feels weird without them damaging anything yk
tho maybe players wont notice
It also feels weird adding that in when the player literally can't do that in the first place, that sounds out of the scope of your mod?
You know what would be the most inconvient and annoying mod ever
Fuseboxes
Each house has a fuse for each room
you gotta do an among us fuse puzzle to get in
If a fuse goes, you gotta replace it in alittle menu
You can mod that in
That's the fun part, you can learn
Fair fair
Or pay someone to do it
Also fair
guessing this needs to move server side in MP? getPlayer():getStats():set(CharacterStat.UNHAPPINESS, 0)
yes
can someone has the documentation on how to create custom animal? Also, is it possible to use it in multiplayer with them to be just in standing mode? I cant find docs or page that refers to it on google sadly.
I dont need it to walk, I just want them to stand or something as long as its humaniod
there aren't really any resources for animals yet, we're planning to make some guides after we release the horse mod
we honestly don't know, so much of our code in its current state won't work in multiplayer that we haven't even bothered to test it
i have no reason to think they won't work in multiplayer though
I see, thank you sir
Standing with albion, there isn't much reason that the animal itself doesn't work in MP
The parts that for sure don't work for us in MP are custom behavior stuff
You can follow the release in #1366841696796672031
I am unsure if this is an error with the game or an error in my code, but player:getBedType() always returns averageBed no matter if you sleep on a bed, bed with pillow, couch, or the floor. Is this not the correct way to find out the "Sleeping Quality" of the bed the player is sleeping on?
Animals can work in multiplayer. it’s feasible to throw custom code at them and make them do stuff as well.
however, animals are in a state right now where unless you have several hundred hours free ~ even with documentation ~ i wouldn’t recommend trying to make one.
For one, it needs Blender skills/experience as a baseline to even get a model in game
I am pretty sure this should be one of the things that affects sleep quality. This is from IsoPlayer.java
get and set in IsoGameCharacter.java
i honestly don't think the animal api is nearly as complex as you always say it is, if we weren't working on an animal that had so much added complexity due to needing extra features to feel 'complete' at a basic level i think we could've had a release within a few weeks, less than that if we knew the weird trip ups ahead of time

the majority of the time we spent on vanilla animal features was just figuring out how they work and especially working out how they don't work properly for mods, future modders will benefit from that knowledge
sorry to drop on your message but very much interested in having access to the java code. Can you point me the way to it, please? 😄
This guide goes in detail on how to decompile the Project Zomboid game code to more easy navigate the game files and systems, and more easily understand how the game works in depth. This is a process often necessary when Lua modding to better understand what classes and functions do.
Relevant Wiki pages:
https://pzwiki.net/wiki/Decompiling_game...
What's the context in which you're calling it? Surrounding code, when it's called, etc.
local player = getPlayerByOnlineID(args.playerId)
This code is reachable through a clientCommand response on the server
can you check the value on the client as well? the server might just not know the correct value
I will add to client side and see 🫡
client side did return correct results! Is there a solid way for to identify when a method should be used on the client vs the server and vice-versa?
not at all
any place besides the wiki I can mod knowledge?
I just spend a week fighthing the action state machine in LUA and today I realized I can declare the state machine transitions and states with XML
That hurts, bro 🙁
There is the PZ Modding Community discord too.
I can only find broken invite links 🙁
I can PM you?
sure
Check the pinned messages
Tho I guess my message was sent quite far down now
Want to get started with modding or need information ? See the following !
- Useful links
- Getting started guides
- Latest information
- Community links
- Assets and how to get them
- Character rigs
Modding information
Wait what ??? Images can be used relative to the root folder of your mod ???
@bronze yoke that's obscure as shit lol
Yea i used that for my mods with the new update to save space
Oh the freaking .. !
Oh shit ok I didn't knew you could use relatives
That's actually way more important than expected of an information
Well thx for adding that in
I remember it being said that it is hacky to place custom sandbox options anywhere but the bottom of a page. Does this mean it is also not simple to add subsections to your custom sandbox option tabs?
I'm confused as to why the ../common is necessary? Using the names directly works fine for me as-is when they're in common (although I was unaware it was a shared pool, so I'll be updating those 😅)
For context: It would be cleaner if I was able to have the centered sub-section name Bed Quality Modifiers and remove all the multiplier suffixes
When your mod info is in 42 folder and your pics are in common they don't load without it
Well never worked for me
Maybe a recent fix, then—I only moved to developing on b42 after 42.13
Not possible atm
That was my reaction as well when I wanted to use it
I feel like this is clear enough 🤞
Sure, but you should know how much ppl are willing to read these days lol
Oh I got so many "ur mod broke plz fix" I had to disable comments
pre-b42MP, 550k subs, last updated 4 years ago "Mod broken"
yea comments... like, "is that mod mp ready?" when 2 comments below i said its not🙄
Things I no longer bother to respond to and just delete comments:
"I installed your mod but it does not show up on my modlist!" Because it's a B42 mod and you're on B41
"Mod does not works" refuses to elaborate
"Does this work on <latest version>/multiplayer/with <other mod>" Why don't you spend 5 minutes to find out instead of posting a question and waiting hours for a response?
"Your mod is broken!" gives error from something completely unrelated
"Can you make a mod to do <completely unrelated thing>" Why do you look at this mod and think of that?
...that turned out more rant-like than I planned.
doesnt work in mp
I used to have a work around to get higher value capacity in containers but this also appears to no longer work.
… or the classic:

Just like Rimworld's "Does this work with CE?"
i’ve yet to play rimworld, but i can only imagine hehe 😆
Le classique
hey folks, due to my love for a simple map mod i love, it be a bunker, (utilizing vanilla assets too) how do i take the reins and update it myself for me and my buddies indifferent broccolli server? i've been studying a bit with how to make a map with the tools and such, but i have a feeling that it really might take some sort of direct patch i have to manually apply into the code..
any thoughts, or assistance in general to help on my quest would be most loved.
for context the mod i referencing to is called "last minute prepper" authored by fred cooper: https://steamcommunity.com/sharedfiles/filedetails/?id=3428165477
You should contact the author
He goes by the same name if I remember right, and you should be able to find him in the mapping Discord
i was nervous about that due to not wanting to be rude towards asking him about such. but alas, if that's what it takes.
As long as you're not a complete idiot, there's no reason this would be badly taken
Don't come at him like "GIVE ME YOUR MAP NOW", and just ask "Can I continue your map if you don't plan to ?"
lmao, never. genuinely i loved his design for the map so much. because of his 'art' i was able to find a great decree of entertainment with the game to find 250+ hours of fun
thank you so much sim, shall ask him from a direct inquire.
np
I see why it only works client side. The nice part about the old work around was that you could define new container types and capacities on load before players ran into the sprites. You could overwrite the original values on existing sprites.
Do map making tools work properly for below surface levels now? If so you coudl always build a multi-level bunker inspired by the stylings in that one (Which AFAIK were inspired by actual cold-war era "fake suburban houses" bunkers)
Of course
The unofficial ones have been out for a while now
Not the official ones tho, those one will come only with stable from TIS's information
yo, the new trait and occupations creation method suuucks.
I mean, the scripts looks nice and are obviously much better organized but I hate learning new methods lol

do i need to enable something to be able to damage isoplayers?
i already enabled isoplayer.setcoopvp
i tried manually adding damage or setting health, doesnt seem to work as well
their health keeps getting set to 100
Are you setting it on the client or the server?
Hello, I just want to say that the issue with client–server–client communication is solved. I had to create a shared file that both the server and the client have access to. I’m not sure this was the best approach, but I’m happy that it works. Thanks for all that had some input.
client
but its singleplayer
so is there a difference?
setting damage on myself works but not on npcs
How exactly are you trying to do damage to the player that isn;t working, also B41 or B42?
Also, what object are you trying to damage - if it's not the player, is it something that extends the IsoGameCharacter class?
help why does it look so funny
Bald Chinese man with long wispy beard high on marijuana?
(it would look better wrapped around the actual model)
it was supposed to be rabies but he lowkey looks like sensei wu
or rather SHE
because fem zed
also I am using born of birch's human zeds as a base
so credits to him
also major inspirations from rabies patients AND 28 days later
I was trying to make a custom wave defense accumulator challenge and after copying all the scripts and changing names where appropriate there seems to be some kind of hardcoded limitation or weird quirk that i can't figure out
any time i go to use my challenge instead of the normal one, it shows my characters for last stand accumulator and i can't find where to change the search directory
supposed to be saliva but I just suck at texturing
😔
basically,
rabies
It's too visible
I have yet to see anyone make a custom scenario, I don't think it's possible or at least it's not that easy
dang, i guess i'm messing with stupid stuff then
would it be probably less uh... frustrating, to just modify the scenario instead of making a new one then? i'm assuming i can't add java code
It's definitely possible but not in the way you think, you don't go defining a scenario file, you could just mod the UI to add a custom behavior that creates a new save where you are on the normal map, or custom one and have the player spawn at a specific place of the map and activate the logic for your scenario
Even that probably wouldn't do it or you'd possibly break the game ? Idk really
And no you can't add Java code, tho you can do a Java mod but it requires a manual installation
i'm fairly sure you can just add more scenarios but some of the last stand stuff in particular is hard coded
i see.
the last stand accumulator lets you play the same character over and over for metaprogression and they never did anything cool with it
re: Damage: I just checked single player B42 and getPlayer():getBodyDamage():getHealth(), getPlayer():getBodyDamage():AddGeneralHealth(10), and getPlayer():getBodyDamage():ReduceGeneralHealth(10)all work as expected, getting/changing the general "hitt points" bar next to the injury portrait. I'd expect that to also work for any IsoGameCharacter derived class, which AFAIK is really only IsoZombie unless you're doing stuff with NPC ,pds which might use IsoSurvivor. @raven epoch
you can add more but the directory seems to be hardcoded yeah, or at least i can't find a way to disqualify save files that aren't my scenario that wouldn't be possible to load from the vanilla one
i may need to make the save files so obtusely different that the vanilla last stand doesn't even try to load it
What if you made a very simple 3D model, defined an "invisible" clothing item to put it under the mouth, and textured it with a foam pattern (pretty much just whaite static at zomboid resolution)
More work than texturing, but might give better results. Also, it won't be hidden under beards.
wait
why is this actually peak
and do I need blender?
You can use any 3D modeling tool that can export .fbx files (probably all of them) but Blender is 1) Free 2) has lots of general tutorials 3) is the default for any zomboid tutorials and 4) is less of an insane UI nightmare to learn than it was twenty years ago, but it's still along way from easy if you've not used it before.
okay, how can I possibly layer the clothing to put it under the mouth?
ok so i think i have figured it out, what i need to do to make this work
is lua able to read data from a file in a target location? almost like a config file?
if i can get around using the getLastStandPlayerFileNames() function i can save the data however i want
There are limited ways to read/write to files, but I'm not familiar with them... but if you have a config file, you can just make it a lua file.
Or you need some specific file you did not create for this last stand thing?
i need a relative directory to the zomboid install to store user data in
So a way to save data for your mod that persistss between games?
unless i can litearlly just do getLastStandPlayersDirectory() .. "/../WD/player" and go up a folder
Definitely not, that function just returns an ArrayList of strings.
untrue
Mods can save stuff to C:\Users<windows-username>\Zomboid\Lua
that's the folder i need
but i need a relative path so it doesn't break when people have user folders installed on another drive
Oh I did filename,s not directory
So...... I have some good news: you don't need that function, you can just assume it will return "LastStand"
The bad news being that probably isn;t useful to you
(From decompiled B42.13.1 )
"Should we make it an option in a config file?" "No, just hard code it in Java in a way that we can turn into a config file with technical debt later"
i guess i can't fault them for doing that considering this challenge is basically untouched for b42
old notes of mine:
This works for stuff in C:\Users\username\Zomboid\Lua
writeSettingsFile = function(tbl, filename)
local file = getFileWriter(filename, true, false)
if not file then
return
end
for key, value in pairs(tbl) do
file:write(key .. " = ".. tostring(value) .. "\r\n")
end
file:close()
end
readSettingsFile = function(tbl, filename)
local file = getFileReader(filename, true)
if not file then return end
while true do repeat
local line = file:readLine()
if line == nil then
file:close()
return
end
line = string.gsub(line, "^ +(.+) +$", "%1", 1)
if line == "" then break end
for key, value in string.gmatch(line, "(%w+) *= *(.+)") do
tbl[key] = value -- note that value will be a string, you may need to convert to number or w/e
end
until true end
return tbl
end
But only files underthat Zomboid\lua folder
thank you! let me check if these exist in b41
im on b41 btw
Those notes are probably from B41... something useful I copied into my Zomboid Modding OneNote in case I wanted it one day
testing rn
i think i am getting somewhere finally ty for the chat
bandits store info in
the User/Zomboid/lua as far as i am aware
@silent zealot sadly same result
wait
hold up
it worked never mind
thank you
hahah
i thought health was 100?
you can do other injuries as well with BodyDamage
they got double or triple tapped when i did reduce damage 100
yea weirdly enough setbleeding or damagefromweapon didnt work
Sometimes it's 0 to 100, sometimes it's 0 to 1.0
even though it works fine on the player
From memory to need to use BodyDamage and get a body part and create an injury.
lets goo
NPC mod?
Bandits NPC?
Or are you making an NPC mod?
Hey guys, would appreciate some help
I get the following error in console, but can't pinpoint them. Is this vanilla or a mod, and how do I know what mod this is related to? Sorry for the noob question.
LOG : Lua f:312, t:1767369102419, st:376,635,180> : Grapple:corpseStorageCheck.doContextGrabCorpsesFromContainers Searching for suitable containers that contain a corpse. LOG : Lua f:312, t:1767369102419, st:376,635,180> : Grapple:corpseStorageCheck.doContextGrabCorpsesFromContainers No suitable containers found.
Good luck!
thank you
I know Bandits uses IsoZombie and does a lot of forcing to equip them and make them behave
And if the mod breaks all the NPCs areound your base turn back into zombies.
yea thats why i didnt bother with isozombies and b42
making their ai itself is hard enough
Why not use B42? B41 is a bit of a dead end, by the time you have the mod made peopel will have left it
shame isoplayer rendering is disabled in 42
Now that B42 MP is out.
ye problem is
in b42 for some reason
it doesnt render the isoplayers
only your own
they exist they can shoot they can chat
just not render
Well, by design isoplayers is for players and isosurvivor is for NPCs. except ISOSurvivor is not finished.
Nope.
shame
It exists. There was a mod a loooooooong time ago thatt tried to make it work.
It's likely a dead end unless you are willing to go as far as making a java mod.
na only know lua
annoying thing is
isoplayers cant run for some reason?
seems to do with pathfinding
You'd have to figure out a way to try, AFAIK IsoSurvivor is almostt unused but is left in because a few things do something with it.
You'd be fighting with the code a lot I expect, sincec IsoPlayer is supposed to be reacting to player input not an AI script
thats what im aiming for rn
yea fortunately
they got functions like
setNPC
and NPCsetAiming
that do work
i even tried to get them to try to drive cars though that one doesnt work
Found where IsoSurvivor is used: for character avatars, like the character select screen.
oh so thats
yea makes sense
otherwise isoplayer there would have input i guess
going to try to figure out this pathfinding annoying thing
when the player moves far away from where they are pathfinding i reset their path
but that causes them to stop for a second or so
no idea how zombies do it seamlessly
Zombies don't do it seamlessly, they stop and think and shamble in a new direction when the player is far away
no when they are chasing the player
and even that gets faked once they are off screen a bit
like watch this vid right
when i run they stop to recalculate the road
which looks weird
got you, not sure. The Zomboid AI is... well it's artificial.
I tried to make sense of some basic animal behavior code and I'm not suprised there is a lack of animal mods.
waat
it made no sense and I am amazed it worked
For a given value of "worked" he said as he watched a cow run back to his base and systematically destroy every wall.
LOL
a
ok i think i got an idea
maybe they dont stop following the old path till the new one is calculated?
though thats going to be
very annoying to implement
IsoZOmbie has it's own versions of those
Also, there is a very good chance what you want is in the java
ye true
hold on lemme try me idea
nah my npc logic in general needs a rewrite
its over
cooked
hold on i think i found the problem with the damage thing
something is constantly setting their health to 100?
Maybe if they have no wounds?
like a player healing over time, except the heal rate is bugged
what is the actual goal behind damaging them?
so player can fight t hem
just shooting with guns does not seem to damage
so thats why im manually doing it
You shouldn't need to manually set the damage, it should be handled with a bunch of stuff based on player/target/weapon
but that doesnt work either
very weird
u might be right with a bugged healing rate
This is possibly one of those times you need to fight the game. Because normally an IsoPlayer can never damage another IsoPlayer unless there is a multiplayer server involved.
well it doesnt have to do with isoplayer to isoplayer right now i think
since we are doing it manually
the onweapon hit event does fire too
But you're using IsoPlayer in a way it was not intended to be used.
when i set their health manually to 10 and i run it for a few frames its back to 100
maybe healing rate is duplicated?
because of player count?
You probably need to dig through the decompiled java
yk i got an idea for a worst case scenario
if ZombRandom(1,10) == 1 then
Damage(99999)
end
no ones going to notice
or i could just simulate their health myself now that i think about
Why try to modify the games existing fatigue recovery system when I can rewrite it myself 
Forgot half-assed efforts like "moodles in Lua", we need "Project Zomboid in Lua" 🤣
Rust rewrite time
Heys so I was loading the game and one of the tooltips said shoes determine the loudness of your steps? But that's not a given value when defining shoes, so does anyone know how that works?
Unless StopPower is what controls the noise too
{
DisplayCategory = Clothing,
ItemType = base:clothing,
Icon = BootsARmy,
BiteDefense = 100,
BloodLocation = Shoes,
BodyLocation = base:shoes,
ClothingItem = Shoes_ArmyBoots,
ConditionLowerChanceOneIn = 20,
ConditionMax = 30,
Insulation = 1.0,
RemoveOnBroken = false,
RunSpeedModifier = 0.9,
ScratchDefense = 100,
StompPower = 2.5,
WaterResistance = 0.8,
WindResistance = 1.0,
WorldStaticModel = Boots_Ground,
}```
Here's an example of a shoe
if i'm reading the code correctly this does not seem to be true
there is a check that halves the volume of your footsteps if you are not wearing shoes, otherwise the kind of footwear doesn't seem to matter
hm
This is what I had read, for context: UI_quick_tip28 = "Your footwear will change your movement speed, your stomping damage, and how much noise you make when moving.",
But yeah, it probably just means shoes vs barefoot, like you said
it also doesn't change movement speed 🤫
i'm pretty sure stomping damage is real though
fr
stupid that they still havent implemented that for shoes
I haven't found a fix to this yet. Previously I was able to change an existing sprite into an item container and it would update for everyone in multiplayer. It was created client side and it makes sense that won't work anymore. Each client would create their own and make the original disappear. So I moved it server side. It removes the old sprite and has no errors but does not update the clients afterwards.
I thought the square transmit lines would update the clients, is there something new that needs to be done instead?
Just a subnote, but please cache Terminal:getModData() as function calls are rather slow in Lua
I have no idea how to do that. If you have an example, willing to learn 🙂
does the object appear if the client unloads the area and returns?
Let me try that.
Worth a try, it could be waiting for the square to reveal again.
if no, you are not adding the object correctly even on the server
if yes, the issue is purely in transmitting it to the clients
You are correct, I just came back and it loaded, so its just not being updated to the clients.
here's how i add objects on the server:```lua
local obj = IsoObject.getNew(square, sprite, "", false)
square:transmitAddObjectToSquare(obj, -1)
ah yeah, that's your issue
you add the object before transmit, but transmit only does anything if the object hasn't been added yet (it adds it for you)
public void transmitAddObjectToSquare(IsoObject obj, int index) {
if (obj != null && !this.objects.contains(obj)) {
this.AddTileObject(obj, index);
if (GameClient.client) {
obj.transmitCompleteItemToServer();
}
if (GameServer.server) {
obj.transmitCompleteItemToClients();
}
}
}
Thank you so much!
@bright fog Physics and items are still missing, for door, it was neccessary for animating as i remember(its been a while xD). Only "strange" thing is i remember just havin door{} empty is sufficent, but KI5 has the anim down to install/uninstall wrapped, doesnt seem to make a difference.
I'll add those in thx
Hello there, has someone already been able to remove some world context menu options that are added by vanilla java code ? (e.g. Generator submenu when right clicking on a tile with a generator ?)
It's the same way as always
i don't remove vanilla options but i do mess with them, this might give you an idea of how to search for them
https://github.com/demiurgeQuantified/WaterGoesBad/blob/8ba086a3da46d3782ab91b3cdfe17ebfb73bf16a/Contents/mods/WaterGoesBad/42.13/media/lua/client/WaterGoesBad/ContextMenu.lua#L166-L182
It's always just done with the name of the option
thx a lot
Today, I had two problem reports with reproduction procedure and stack trace. This is a good day.
Do I still need to warn MP users when I remove files from somewhere in a pre-existing mod during an update ?
yes -- when possible you can switch version folders to avoid this though
I am not sure I understand what you mean boss. I had a lua file in common/../client that is now moved in 42/../client (old version) and also copied in 42.13/../shared. remaining versions are now different.
I was forced to remove the file from common because it took priority of the shared from 42.13 folder
Basically if you want to remove files, you can simply increment your version folder version, if possible, so older technically deleted files will exist in a different folder not checked by the game
That's why code should go in the versioning folder
And heavy assets in common only
basically if your mod is in 42.12 and you want to delete a file, you can copy to 42.13 and remove the file safely since the existing users don't have a 42.13 folder yet
of course you can't do this in many situations such as your own
I see. I do not like the evergrowing duplication it will induce but I see. 🙁
Is the workshop itself keeping a version of each file I once uploaded ?
You don't have to keep the old versioning in your uploaded version
It will only live in the player's folders
Just rename your versioning folder like 42.12 to 42.13
that's a relief.
this does break compatibility with older versions for new users
yeah, i prefer to leave empty files and only remove them when i have to move to the next version folder anyway because of breaking api changes
Wdym ?
a new user subscribing to your mod to play on 42.12 does not have that version if you removed it
That was an example I gave
Not taking into account the fact people can play on 42.12
Take 42.9 and rename to 42.10
Here
anyway since it's in the common folder you'll just have to remove it and warn people
i still dislike this approach, i just leave them as-is and set them as ignored in vscode so i don't have to look at them and get search results from them etc
GOG can often be several versions behind so it's nice for them at least
Related to this topic: I'm not sure I understand why I'd want to use the version folders at all until I need them (versioning is the obvious benefit, but for the initial version, I mean). It seems like others are using 42 by default, though. Why is that?
Bcs you'll end up like Tcherno if you don't
That is, by default I've just been putting everything save for mod.info in common & if I need a per-version override I intend to use a version folder
Where you've had code in the common and now you're fucked
What's wrong with the “deletion” method from before?
If you delete files, they stay in users mod files unless they do a clean reinstall
By deletion method I mean clearing the file without deleting it, as was done for b41
So if you delete in common, you literally can't do anything about it and users will end up with files still in this folder unless they do a clean reinstall
Blank file ? Yea of course you can do that
So other than that, why?
the annoying thing about this is a version folder can't remove a file from common, only override it, so if i no longer need a file i have to add an empty in the version folder
Why what ? Using the versioning folder ?
I see. I'm not sure this would be enough to push me towards it, but good to consider
Yeah, I'm saying I don't see a good reason personally other than for the purpose of versioning
It overall costs nothing to put your code files in the versioning folder, and makes sure you'll never have problems later down the line when you end up needing it
Sure you can simply not give a shit about it, but the moment you get a new 42.13 breaking everyone's mod and you need to have two versions of the your mod, now you're absolutely fucked and have to use shitty tricks to "delete" files
i don't think i've *ever* actually needed to override common, i only put things in common that i expect to be universal such as assets
of course that means i have far more duplicate files than if i had working in common to begin with, but that would also mean my codebase would be weirdly fragmented between the two when i needed to start overriding
also i don't know how you'd get emmylua to understand that the lua files in common are used, except file A is not used in favour of 42.13's file A
I think I'd prefer single file overrides of only the logic that requires overriding—I'm okay refactoring when the time comes. But those reasons make sense & maybe I'll reconsider with some more thought. Thanks y'all
Maybe I spoke too soon because this does sound annoying to deal with lol
Like I said, it costs nothing to do it, and it'll cost you everything when you need to do it
I don't think it'll cost everything
i will note one major downside: version folders basically wipe git history every time you increment them, and make old branches unmergeable
It'll cost you changing your whole mod structure and that's problems
i'd like to look into some of these build systems people have developed to get around that but i haven't been putting much energy into modding lately
I don't intend to change my mods' structure for a minor refactor for a logic change
But if you need two versions of your mod to support older versions, you have to
Build systems? I'm unsure I'm aware of any, except maybe the one Konijima had if that was one
And you can't do that if everything's in the common folder
There's a recent one
i think there's a few of them, i just don't think anyone really uses them except maybe the creators?
Wym by the support older versions part? Like pre-42, or you mean in the future?
42.12 and 42.13 is an example
Interesting, I'll give it a read
42.13 nuked every single mods out there
And saves could not be upgraded to 42.13
So a big chunk of people stayed on 42.12
Maybe I'm overconfident in my refactoring ability and it'll be my downfall 🤷🏽 I'm not too worried as of now
If you update your content to 42.13, it wouldn't work for 42.12, so you would possibly break people's mods if you did not support that older version
And a significant chunk of them
That's the point of the versioning folder, significant version changes that force some users to stay on older version if they want to continue their saves
It's rare, but we got our first demonstration of it
I understand the versioning benefit & would use it for that purpose
But if all your files were in the common folder, then now you need to use blank files to properly render the old ones in the common folder useless, or do some weird splitting singular file override which sounds terrible
That's the conclusion of it
i'd like a build system with just a src directory that hides all the versioning from me, mostly for the vcs consequences i mentioned earlier
To each their own, I'm unsure what was discussed here beats the drawbacks in my eyes. I'd much prefer just having a build system though, like albion said
But what's the drawback ?
Plus it'd open the door for stuff like code generation, macros
How would you handle the extra versions to build ?
You retrieve them from tags of your git or something like that ?
yeah something like that, i don't modify them anyway and i could move the tag if i really had to
I don't like the idea of duplicating code and messing up the git history for versioning unless necessary. If I write a versioned file it's going to be written with the intent of addressing what needs to be addressed, rather than having a duplicate of the file with stuff changed
But that's just my preference
I don't like the duplicate either but in reality you don't really have to bother with it most of the time anyway
It'd be nice if they had a folder like "main" alongside the common folder
tho idk how it'd handle selecting if it should load from main or versioning folder
what would that do?
Load main or versioning, so you don't rename your main code folder
And you keep the versions
And whenever you need to support an older version, you duplicate its content into an older version
Assuming the version folder code stays as it is post-42, it seems like the 42 folder serves that purpose unless I've misunderstood?
So say a player is on 42.12.3 and the mod has such a folder, it'd load that one, and if there isn't a folder of that exact version, it loads the main one
Yes but the moment you have a version higher for the versioning, it'd load that higher one
i don't really see the purpose compared to version folders
The reason everyone uses 42 is because there was no need for the versioning before, until we got 42.13
Ah right, because it just uses all the content from the highest one
You keep the git history
I think I understand the distinction
ah yeah i guess you could fork off versions when they were no longer needed and do all your development in main
Now that the word macro has escaped my lips (or fingers, since we're typing) I'm dreaming of #ifs and #endifs (with version comparisons) either way
Which like we discussed in the past not very needed with the way PZ is designed and adds some extra steps to test your changes
But idk if I can see a way to do that in plain Lua that wouldn't confuse EmmyLua
Wdym ? What for ?
Version comparisons in the Lua code within the src folder which change the emitted code for each version
yeah i've considered it too but i feel the debugging downsides (line numbers not matching up, code potentially not either) and language server confusion probably wouldn't be worth it
Aaah to have different code based on the version ? You can technically do that, but yea EmmyLua's going to go absolutely insane
I also am not sure if that'd be good practice for the long term handling of your mod
10 versions later, if elseif version hell
Hey, if C devs can do it then I can—legends say that no bug has ever been written in C
Yeah that's fair, I would hope it wouldn't need too many of them though
personally i don't care about older versions beyond them being available, if they have unique bugs or missing features or whatever that doesn't bother me
there are some other compelling reasons for preprocessing though
there's a script out there that flattens all local function calls that always tempts me
Ooh
I was only thinking about moving initialization to preprocessing, perf improvements would be even nicer
Has this been hotfixed yet?
I have some people trying to tell me off, saying I am wrong that this problem doesn't exists. 🙄
thanks for the sanity check
So, no matter what I change in my mod - I keep getting the same error everytime. I've adjusted the model, changed the name a couple of times, re-did the code. I have no idea what to do, any ideas? --- This is for a weapon I'm trying to get into the game, B41.
Which is safer: Re-writing a whole vanilla script or simply hooking on to the script to change the functions you want changed?
I assume the latter but Ive seen a lot of big modders do the first
Your assumption is correct; a mod being popular doesn't always mean its code is the best role model 😅 No offense intended to those mods, of course
If something can be achieved without overriding an entire file then it probably should be
alr, thx. Wanted to make sure
Hooking to change what you want allows better inter-mod compatability, only 1 mod can do a full override and then other mods have to load after the override to not get overridden themselves
Also, full overrides are less likely to work correctly next zomboid update if you don't update your code to match any vanilla changes
what folder is the model in
Media/weapons/2handed
file path starts in media/models_x
you are right and that is there - i just forgot to include it
you need to add weapons/2handed to the start of the file path i mean
its looking for the model in media/models_x
Hi all, I'm just wondering how should I properly spawn an item in the multiplayer environment? I'm trying to spawn something on zombie's corpses, but there's a bug in my current code - sometimes I can see the item on my end, but I cannot pick it up, and other players cannot see it. So the mod currently works fine in SP, but buggy in MP. Thanks in advance if anyone could give some advise/guidance. https://github.com/buguniao55555/zombie-cure
in b42 mp they changed it so only code that runs on the server can spawn items
wait nvm im stupid its already in the server
you have to do sendAddItemToContainer after adding the item to sync it to the other clients
this should work
also im looking at the random item code and im not sure if it will end up working as im guessing you're intending
im assuming antibiotics are meant to be the most common of the item drops but i think your code accidentally makes it the rarest
will try that, thanks
We are updating an old mod so that's the logic of the original author, but yeah I guess the chances are messed up
local items = {
"Antibiotics",
"ZombieCure.ZombieCureMed1",
"ZombieCure.ZombieCureMed2",
"ZombieCure.ZombieCureMed3",
"ZombieCure.ZombieCureMed4",
"ZombieCure.ZombieCureMed5",
}
local function ZombDropextra(zombie)
if (ZombRand(1000) <= 5) then
local randomItem = items[ZombRand(1, #items)]
local item = instanceItem(randomItem)
local inv = zombie:getInventory()
inv:getInventory():AddItem(item)
sendAddItemToContainer(inv, item)
print("Spawning item on zombie: " + randomItem)
end
end
i think something like this will work and then you can just add multiple of some items to the list to change the chances
People being wrong and assertive on the Internet ? Na, you must be mistaking: trolls do not exist. 
They didn't even bother looking at the top few comments before asking. 😭
Hi! Need some help, I think the devs changed how defining bodylocations for clothes works. Can someone tell me what exactly changed? Here's my old script
local group = BodyLocations.getGroup("Human")
group:getOrCreateLocation("MALeftArm")
group:getOrCreateLocation("MARightArm")
group:getOrCreateLocation("MAHAZMAT")
group:getOrCreateLocation("CarrierVest")
group:getOrCreateLocation("Cloak")
Haven't modded in a long time now, haha
Fun fact: last 2 digits of the player position on x & y axes are always 25 or 75 (b42.13.1 MP, client side). I wonder if this is due to [display rounding] / [mod data storing] / [something multiplexing info in less significant part of floating number] / [a mix of those] / [something else..]
game updated so as always: check pinned messages.
im aware, just dont know how to fix it
couldnt find anything in pinned messages.
Oh shit, do I have to put base: before all base game body locations and my mod's name before new body locations?
Did you read the full thing ?
Notice regarding MP unstable for modding
Official docs from TIS were released for modders to update their mods for B42 MP unstable:
sorry for the ping - i did add that but i still get the same issue
texture=R
uh
Also
You shouldn't have media/model_x
Also isn't it models_X ?
Yes it should be models_X
Read that please
Allo! Just a quick question. Under what file can I find the UI for exercise?
i have read that a couple of times - i'm not sure what i'm meant to be looking for but nothing there afaik helps me in my situation
Verify your parameter values
You didn't take the time to read it properly
Because it's pretty clear you're doing something wrong
I've seen you on this model issue for a while now
okay - i verified them, and even did a quick test run of just putting the model FBX in the models_x folder as is.. still nothing.
Show your script
And show your model full path
Show your file
Show all of these
Nevermind, found it at FitnessUI
{
imports {
Base,
}
item AkiBlade
{
MaxRange = 1.35,
WeaponSprite = AkiBlade,
MinAngle = 0.8,
Type = Weapon,
MinimumSwingTime = 3,
KnockBackOnNoDeath = TRUE,
SwingAmountBeforeImpact = 0.002,
Categories = LongBlade,
ConditionLowerChanceOneIn = 25,
Weight = 5,
SplatNumber = 3,
PushBackMod = 0.3,
EnduranceMod = 2,
SubCategory = Swinging,
ConditionMax = 15,
MaxHitCount = 5,
DoorDamage = 60,
IdleAnim = Idle_Weapon2,
SwingAnim = Heavy,
DisplayName = Belle's Blade,
MinRange = 0.61,
SwingTime = 3,
HitAngleMod = -30,
SplatSize = 5,
KnockdownMod = 3,
SplatBloodOnNoDeath = TRUE,
Icon = LLP,
RunAnim = Run_Weapon2,
TwoHandWeapon = TRUE,
SwingSound = WoodAxeSwing,
DoorHitSound = WoodAxeHit,
HitSound = WoodAxeHit,
HitFloorSound = WoodAxeHit,
BreakSound = WoodAxeBreak,
TreeDamage = 55,
MetalValue = 120,
CriticalChance = 50,
CritDmgMultiplier = 12,
MinDamage = 1.3,
MaxDamage = 1.6,
BaseSpeed = 1,
WeaponLength = 0.65,
RequiresEquippedBothHands = TRUE,
DamageCategory = Slash,
DamageMakeHole = TRUE,
AttachmentType = BigBlade,
Tags = ChopTree;CutPlant,
}
}
Zomboid\mods\TestingMod\media\models_X\weapons\2handed\AkiBlade.fbx
I'm not sure which part you mean by file tho - Like send over the mod file entirely?
Thats for B41 or earlier right ? Zomboid\mods\TestingMod\media
Where's the model script ?
yeah, i'm on b41
{
{
mesh = 2handed/AkiBlade,
texture = R,
attachment world
{
offset = 0.0000 0.0000 0.0000,
rotate = 0.0000 0.0000 0.0000,
}
}
}
mb
Yea no shit that doesn't work lmao
Wasn't that the same issue you had last time ???
Where is your model definition here ?
I'm not joking, go read that wiki page, you did NOT read it
Hey guys, how can I determine that what's in the hands is actually a melee weapon and not a flashlight? (42.13.1)
Flashlights are considered handweapons ?
local mhweapon = player:getPrimaryHandItem()
if not mhweapon then
return
end
local mhIsMeleeWeapon = mhweapon:getStringItemType()
-- zReTIPS доп проверки
if mhIsMeleeWeapon and mhIsMeleeWeapon ~= "MeleeWeapon" then
print("Nah")
return
end
?!
Why getStringItemType ?
Weapons are InventoryItems but more importantly they are HandWeapons
ItemType = base:drainable
if instanceof(mhweapon, "HandWeapon") then
print("yes"
end
guns is HandWeapon should be
Yes
But you can check for that too
declaration: package: zombie.inventory.types, class: HandWeapon
but why i cant check this? getStringItemType()
Why would you have to ?
Your item ALREADY has functions to check if it's a firearm or not, if it's a weapon
Also I'm fairly certain that getStringItemType returns HandWeapon
Because it's the ItemType
And ItemType are ... handweapon, drainable etc etc
What does it return then ?
Okay, please assume i know little to nothing about modding bc i really don't. I'm getting by on what I know and what little videos there are out there for weapon mods -- That link you sent is for b42. The link they have for b41 is basically the same thing, just less organized. A of now i've re-read it twice, going for a third after i send this message. If you see what's wrong please tell me or point me toward what exactly I'm meant to be reading because I don't see anything in the b41 wiki page about model definition.
That link I sent applies for B42 too
Did you read the example on the wiki page ?
Also I have explicitly told you what the problem is here
flashlights -> other
ranged weapons -> RangedWeapon
sledgehammer -> MeleeWeapon
screvdriver -> MeleeWeapon
Then what's the problem ? Why did you ask about it if it already differentiates the flashlight ?
im stupod. im not use
if mhIsMeleeWeapon and mhIsMeleeWeapon ~= "MeleeWeapon" then
i have in another place ==. not ~= (same part of code)
nah, all fine...
should sleep
but i'm not on b42, i'm on b41. And yes. I had copied it on the very first attempt of the mod, I had the static in there and i included the scale code bit as well before removing it
And again. "point me toward what exactly I'm meant to be reading because I don't see anything in the b41 wiki page about model definition."
and i don't see anything about model definition in the b42 wiki link either
just in next i had error with this
local ADoorDamage = scriptItem:getDoorDamage()
local AEnduranceMod = scriptItem:getEnduranceMod()
and my flashlights dont have this parameters xD
or another not melee weapons stuff
now all fine
jesus...
Dude, did you read the screenshot I sent ?
model Burger
{
mesh = Burger,
scale = 1.5,
static = true,
texture = BurgerTex,
attachment Bip01_Prop2
{
offset = 0.0142 0.0401 0.0000,
rotate = -23.3606 21.2788 37.5386,
scale = 0.8280,
}
}
Now read your code ? What are you missing ?
Spoiler: it's the first line
You do not define a model here
You can find plenty of examples of this in the vanilla code, in other mods, even the rare videos and guides about adding items must be showing this at all time
how do i emit particles?
Such as smoke ?
yep
Uuuh I don't remember how, I'd suggest looking at the pipe bomb code
okey ty
ah actually i will just play a sound instead
ok for some reason
when you crouch
all isoplayers crouch as well
which is very annoying
added it in, still nothing same error - so either it was never that or now my other bits of code are wrong
that was absolutely a major issue regardless of whether it fixed it fully, a model script with no type will never ever work
if i want inject func
require "TimedActions/ISInventoryTransferUtil"
ISWorldObjectContextMenu = {}
ISWorldObjectContextMenu.fetchVars = {}
ISWorldObjectContextMenu.fetchSquares = {}
ISWorldObjectContextMenu.tooltipPool = {}
ISWorldObjectContextMenu.tooltipsUsed = {}
ISWorldObjectContextMenu.tooltipInvPool = {}
ISWorldObjectContextMenu.tooltipInvUsed = {}
ISWorldObjectContextMenu.grabItemTime = function(playerObj, witem)
local maxTime = 120;
-- increase time for bigger objects or when backpack is more full.
local destCapacityDelta = 1.0;
local inv = playerObj:getInventory();
destCapacityDelta = inv:getCapacityWeight() / inv:getMaxWeight();
if destCapacityDelta < 0.4 then
destCapacityDelta = 0.4;
end
local w = witem:getItem():getActualWeight();
if w > 3 then w = 3; end;
maxTime = maxTime * (w) * destCapacityDelta;
if getCore():getGameMode()=="LastStand" then
maxTime = maxTime * 0.3;
end
if playerObj:hasTrait(CharacterTrait.DEXTROUS) then
maxTime = maxTime * 0.5
end
if playerObj:hasTrait(CharacterTrait.ALL_THUMBS) or playerObj:isWearingAwkwardGloves() then
maxTime = maxTime * 2.0
end
if playerObj:isTimedActionInstant() then
maxTime = 1;
end
return maxTime;
-- local w = witem:getItem():getActualWeight()
-- if w > 3 then w = 3 end
-- local dest = playerObj:getInventory()
-- local destCapacityDelta = dest:getCapacityWeight() / dest:getMaxWeight()
--
-- return 50 * w * destCapacityDelta
end
its right?:
require "TimedActions/ISInventoryTransferUtil"
local originalGrabItemTime = ISWorldObjectContextMenu.grabItemTime
function ISWorldObjectContextMenu.grabItemTime(playerObj, witem)
local maxTime = originalGrabItemTime(playerObj, witem)
maxTime = maxTime * 0.4 -- Уменьшаем на 60%
return maxTime
end
Your model is in a custom module
When you reference it, you need to reference it with the module too
In item script
whats wrong with this?
it says invocation target exception
even though i copy pasted it from admin commands lua
Wait, we need to have separate folders for 42.12 and 42.13?
offhand are there any items that are also workstations? Specifically I'm looking at making a book a workstation
I figured I'd look through examples, but I'm unsure what a good example to work off would be.
how do i remove it from being a custom module? just changing it to
module base ?
Yes but that's not the source of the problem
The problem is that you don't reference its module
okay, and where/how should I reference it?
Where you use it ?
You can, if you want to support 42.12 and 42.13. Personally I use git on my mods and tell people if they really want to rollback they can checkout the previous version, but if one of mods would break the game if removed (as opposed to just losing access to the stuff in the mod) I'd setup 42.12 and 42.13 folders.
You can use an OnTest in the recipe and make a function to check if the player has the book. https://pzwiki.net/wiki/OnTest
Not a workstation, which AFAIK have to be a world object and not an inventory item, but same idea.
Honestly my half baked idea was have it be a book while in inventory, with specific media. Like a mod manual. Then after placing it into the world, it'll be a workstation for the mod.
i meant like .. what would the code look like? Idt I understand what you're getting at - should I just change all my modules into base?
Your model is TestingMod.WhateverID you gave it so it needs to be refered as TestingMod.WhateverID
in the model script?
Where do you use the model script ?
question to yourself, I already know where you use it
Do you understand where that model script is being used ?
i don't think i do
In your item script you need to define what model it uses at some point right ? And if I'm not mistaken you have already done that, but improperly that's what I've been talking about for the past convo we had
ah - if i've corrected it then i'm assuming you mean weapon sprite? In which case the TestingMod.XID goes there instead of just the name of th eID
Look at all your parameters and try to think about which one defines your model
Yes
Tho I never remember if that's the exact parameter for models for weapons, I believe so but I'm never sure
Can easily check that in existing weapon definitions
can someone please tell me what is the code for getting the current player traits, i used this https://projectzomboid.com/modding/zombie/characters/traits/TraitFactory.html getTraits() but but upon trying it it doenst give anything
declaration: package: zombie.characters.traits, class: TraitFactory
does everything need to be in lower case, like file names, for mods to work on Linux?
Nvm, I'm seeing multiple sources that say it's best practice. Alright then lol
So! I'd like to ask 2 related questions:
- Where is the player class actually located? I'd like to see what methods it has and all
- Where are the codes included in recorded media for stats and skills handled? Like... how does "BOR-1" get turned into a decrease in boredom?
No
Hey guys, how can I get intellensense and acess to the source code from PZ while in my project. Back in the day you could decompile the java and add it alongside the lua.
Is there a new way to just add the lua to my IDE(Jetbrains Idea) just to see what are inside classes and functions and get the intellisense
I want to be able to see the vanilla code while coding not just the auto complete.
Like adding a lua library to a project where you can reference and see the source code
oh idk
does this look good
Wait a sec, is it only that one soldier, or are there other ones facing the checkpoint as zombies drop dead?
Because other than the "shooting backwards" angle, it's super cool!
there are 4 soldiers its hard to see because of quality
and the gun bursts are supposed to be a machine gunner in the background
Oooh, yeah
Oh, alright!
No problem! Always fun to see these kinds of NPCs
its supposed to be like a scripted sequence
Yeah, probably where they SHOULD be facing ;vwv
where military is distracted by zombie raid so u can sneak in
Oh, hm!
Alrgithy, that's actually really interesting!
how do you do that
F11 menu or use the community debug tools
oke
my man
So, i wanted to add repairwithepoxy itemScript:DoParam("Tags = base:hasmetal;base:firearm;base:repairwithepoxy")
to guns, but they are not getting listed in the craftingmenu, is Events.OnGameStart to late or smth else i can do?
My guess is the craftRecipe doesn't dynamically retrieve the item tags
But when the recipe gets loaded it will actually retrieve the items with the tags defined and that's it
So it won't find your items since you add their tags with Lua ?
Might be something @buoyant violet came across, idk
yea recipe stuff is rly wonky <.<
tried to adjust a recipe with sandbox setting, game said "how about no"
Could also be Events.OnGameStart being too late ? But that's if the recipes get initialized when launching a save and not when they load
Yeah correct. Do params don't run before craftrecipe is cleared. So the items won't he part of the recipe. To get around it I just added tags via zscript
Alternatively I guess you could create a submod that runs before doing thr params on such items. And a mod that loads after adding the recipes
Wdym you added tags via zscript ?
Just overwritten what I need on the item via item definition
Module Base {
Blah
{ Tags = blah blah}
}
Zscript is doom lol
hey how to make a seprate version for B 42.12 ?
A lot of pepole complain my mod is now broken on it
Just have a folder for 42.12
So just new folder named 42.12 ?
Yeah
The closest version to the current version played will be used
So 42.12 is the closest so it's the one that will be used for 42.13
Alright so just name it 42.12 for old and 42.13 for new
thx for your input Marz, but scripts are exactly what i wanted to avoid 😅
You can keep the 42.0 for 42.12 too
So you could have 42 and 42.13
And 42.13 is used for 42.13+ and 42 for < 42.13
I'm getting this error for this mod - can anyone help? It seems that the mod is trying to find the container but cannot get any?
https://github.com/buguniao55555/zombie-cure
From what I understand something wrogn with the function onZombieDead
maybe they changed how loot spawning on bodies work
Yeah I guess so, but I'm not sure how I should fix it hmm
The error log is actually complaining this line: sendAddItemToContainer(inv, item)
Also I have a issue for some reason it shits the bed when trying to get modId
So it works fine in SP, but gives error on MP server side
Only with the old version
id=MattSimpleAddonsFriutsOld
This is how it is in the file
Works perfectly fine on the new version with 13
but on 12 it shits the bed
Folders look like this. 42.13 works perefctly
under it fails
but under under thoes it works fine again
Typically it's more helpful to share the error than it is to say “shits the bed” lol, but a failure on that line presumably means modInfo is nil
Well it exists
function: reloadMods -- file: ModSelectorModel.lua line # 67 | Vanilla
function: onMenuItemMouseDownMainMenu -- file: MainScreen.lua line # 1538 | Vanilla
ERROR: General f:0, t:1767535176892> ExceptionLogger.logException> Exception thrown
java.lang.RuntimeException: attempted index: getId of non-table: null at KahluaThread.tableget(KahluaThread.java:1462).
Stack trace:
se.krka.kahlua.vm.KahluaThread.tableget(KahluaThread.java:1462)
se.krka.kahlua.vm.KahluaThread.luaMainloop(KahluaThread.java:458)
se.krka.kahlua.vm.KahluaThread.call(KahluaThread.java:166)
se.krka.kahlua.vm.KahluaThread.pcall(KahluaThread.java:1754)
se.krka.kahlua.vm.KahluaThread.pcallBoolean(KahluaThread.java:1690)
se.krka.kahlua.integration.LuaCaller.protectedCallBoolean(LuaCaller.java:96)
zombie.ui.UIElement.onMouseDown(UIElement.java:1244)
zombie.ui.UIElement.onMouseDown(UIElement.java:1214)
zombie.ui.UIElement.onMouseDown(UIElement.java:1214)
zombie.ui.UIElement.onConsumeMouseButtonDown(UIElement.java:1497)
zombie.ui.UIManager.updateMouseButtons(UIManager.java:726)
zombie.ui.UIManager.update(UIManager.java:615)
zombie.GameWindow.logic(GameWindow.java:298)
zombie.GameWindow.frameStep(GameWindow.java:790)
zombie.GameWindow.mainThreadStep(GameWindow.java:552)
zombie.MainThread.mainLoop(MainThread.java:68)
java.base/java.lang.Thread.run(Unknown Source)
LOG : General f:0, t:1767535176892> -----------------------------------------
STACK TRACE
function: reloadMods -- file: ModSelectorModel.lua line # 67 | Vanilla
function: onMenuItemMouseDownMainMenu -- file: MainScreen.lua line # 1538 | Vanilla
And this says exactly the same thing
The error just says the same thing I said I said it, it can't get modid for- some reason
from what i remember zombie inventories are created 1 frame after onzombiedead
And it is nil
But you can add content to it when OnZombieDead
Verify the content of your mod.info file
It's always something shitty everytime I got that error
it exists and there is no mistakes as its a DIRECT copy from og

only thing that is change is version min
With so little context I can't judge more
You have a common folder ?
What's in the common ?
nothing