#mod_development
1 messages · Page 201 of 1
I think you ought to read through https://www.lua.org/pil/1.html, firstly—it'll help you to understand the code better and intuit things like this. The rng variable is the condition you're checking for, so it can be used directly in the if statement without comparing with 1
thanks. ill take a loook and try. is there any mod that u know which i can take a look as an example?
Not sure off the top of my head. I'd recommend my own, but I do some wrapping of it that'd make it a more complex example than necessary
I want a mod where you have options by rightclicking a door of a building that is claimed by you to create a key for
a buildings maindoor(s) //[exterior doors]
individual🚨interior roomdoors
and a masterkey
Who can make that? I would be willing to throw some bucks in, team play with strangers suck rn
This already exists, a mod to create a key for a building, i saw it yesterday but i dont rmeember the name, just do some searching
Not sure about exterior doors though
Like sheds
Ive looked through a lot, there is no mod that can do different for entrance door and individual interior
Individual interior doors? Why not just use a seperate building unless youre bunking with other players
They can only create a key and this applies to all doors of this building
Thats what im aiming for, 1 building multiple squadmembers and everybody has his private area
I think that shouldnt be too nieche of an request
It would definitely be a rework of how structures work in project zomboid
Or attaching a seperate identificer for doors but that'd require seperating a buildings 5 rooms in to 5 seperate buildings
Are you a coder?
I asked for this similar thing from others a while ago and got those same answers
Just letting you know it might be more than youd expect for payment
im in the middle of requesting a mod for baldurs gate 3 rn ngl
Well i hope someone around will face this challenge and some redbullmoney and the praise of the community will be enough for him
A hodge podge solution is that when you leave the game, enter your room and place one plank on it from the inside, or place furniture, but thats no solid solution
Yea if you have a squad member that wants to f you over when you are not looking, this wont stop him
Individual locks or squad rank-based locks would make things so easier
Well yea i mean those locked doors shall be indestructible😄
Its about placing them in a safehouse
So an invincible, lockable door only specific people can get
Thats easily exploitable
Im going to:
Renember where you disconnected
Build 4 doors around it
Private lock it
Unbreakable death box unless you get admin help
😂
Or you light yourself on fire
So while the indestructible lock is only openable for the owner, the tooltip shall display the owners name
So you can screenshot that guy
He can only do it once tho
And at this point
And if you dont insist on waiting in a death box just write the admin and log off you will be ok
Just light the base on fire
as i already said you cant make the game foolproof
But if everybody has his private ‚safe‘ area
People will be less tempted to fck around
Right but im stating that private locks wont help any of your problems, just get container locks, padlocks are a resource in zomboid
I played scum for like 3 years, you can lock the doors rankbased there
In 3 years with lots of squadplay it never happened that somebody broke the doorframe
Just some people of the same rank stole from each other and it happened very rarely
Hold up
I never heard of those
Padlocks can be attached to crafted crates
Only crafted?
Im not sure, but its easy to make crates
It creates 2 keys
Specific to that padlock
Walls are also
Sledgehammer
Its not even like exhaustion
Project zomboid if you want to get in to a location its incredibly easy
Can you do any safezone setting to prevent this
I got it
I just need someone to mod a padlockable indestructable crate
That Sounds cheap af
Just:
- If somebody wants to just ruin your day, fire.
- If somebody wants your stuff, the average server allows that, its called raiding.
- If you are scared of your allies betraying you, you shouldnt be allies.
- I know i know
But if u have like a group of 6 people
And 1 fucks around
And destroys the ‚relationship‘ between all
And there is like no way to track him down
Better to restrict his fuckaroundability
I think raiding people + their vehicles is enough, especially for someone like me who is happy if he can play 6h in a week, having the base raided when im gone sucks big time
I didnt know about the padlocks that helped a lot
hello everyone,
i have a question please.
I made a "poster's mod" and i can put my poster on wall. That's good. (with Tiles properties, texture packs, etc).
But i want to test if the player shoot on the poster.
For that i code this little method :
local function OnWeaponSwingHitPoint(character, handWeapon)
local player = character;
local shootPos = player:getAttackTargetSquare()
for i = 1, shootPos:getObjects():size() do
local thisObject = shootPos:getObjects():get(i - 1)
print(thisObject:getName())
if thisObject ~= nil then
local sprite = thisObject:getSprite()
if sprite ~= nil then
local name = thisObject:getSprite():getName()
print(name)
end
end
end
end
Events.OnWeaponSwing.Add(OnWeaponSwingHitPoint)
But it's really strange because i don't see the sprite name of the poster, i only see "block object" (wall, furniture).
It seems that my poster tile is like an overlay, does someone know how to get the overlay tile with lua code please ?
I want to make a ground object light up, where can i find the objects like buildable lamps in the media folder?
Can you weapons mod makers hurry up and make an L85A2 rifle?
Trying to make a set of tiles, I have some set to be moveables with the pickup weight set to 50. They aren't intended to be moved by anyone but staff. Ingame however, they still only show up with 5 weight. Any ideas as to why that would be?
multiply by 10
Didn't even think of it, or read it anywhere, thank you!
buenos dias amigos
Does anyone have a mod they either made or use for a freezer vehicle?
Good day.
How should look construction like:
if ... then
elseif ... then
...
elseif ... then
...
else
...
end
or
if ... then
elseif ... then
...
end
elseif ... then
...
end
else
...
end
end
?
the first one, but the elseifs generally wouldn't be indented
otherwise it implies that the the elseifs are within the scope of the first if
stuff like:
if not (condition 1 or condition 2) then
return;
elseif condition 4 then
code stuff
elseif condition 5 then
code stuff
else -- condition 6
code stuff
end
understood, thanks
Is there something wrong with this?
if getSandboxOptions():getOptionByName("KnockedDownAllowed"):getValue() == false then
...some code
end
My Error:
ERROR: General , 1697692438253> 1,705,070,465> ExceptionLogger.logException> Exception thrown java.lang.RuntimeException: attempted index: getValue of non-table: null at KahluaThread.tableget line:1689.
I've worked with mod sandbox options but never vanilla. KnockedDownAllowed is a vanilla option.
sounds like it's not finding the option by that name
that's a server option not a sandbox option
how to print info on player head? like player:Say(), but personal, visible only for only this player?
that actually is visible only for that player
vanilla uses it for some stuff like that
oh... nice
how to combine it in one line?
-- player:Say(getText("ContextMenu_EmergencyReload"))
-- player:Say(tostring(ArmorSlot_Jacket:getModData().zReAASCount))
player:Say(getText("ContextMenu_EmergencyReload")..tostring(ArmorSlot_Jacket:getModData().zReAASCount))?
yeah
there's also overloads of getText to format it into the string
IGUI_XP_readingspeed = "Reading Speed: %1%",
getText("IGUI_XP_readingspeed", readingSpeed)
would show e.g. "Reading Speed: 50%"
%1, %2, %3 etc get replaced by the arguments
Thank! As you told me "player:playSound()" was what I needed!
How can I check that if a certain sound is produced, an event is triggered?
default = 0, [1] or false, [true]?
Thanks, King
queen actually ^^
Yes, I know, just a quote from these two big guys :D
ok good ^^ very often i have people in here thinking i am a guy LOL
I think I went too far with the script...
300 lines for the clothing update event 
Do you happen to know what numbers the limbs have?
like covered clothes part
i mean this part:
ArmorSlot_Jacket:getVisual():removeHole(0)
ArmorSlot_Jacket:getVisual():removeHole(1)
ArmorSlot_Jacket:getVisual():removeHole(2)
ArmorSlot_Jacket:getVisual():removeHole(3)
ArmorSlot_Jacket:getVisual():removeHole(4)
ArmorSlot_Jacket:getVisual():removeHole(5)
ArmorSlot_Jacket:getVisual():removeHole(6)
ArmorSlot_Jacket:getVisual():removeHole(7)
ArmorSlot_Jacket:getVisual():removeHole(8)
ArmorSlot_Jacket:getVisual():removeHole(9)
ArmorSlot_Jacket:getVisual():removeHole(10)
ArmorSlot_Jacket:getVisual():removeHole(11)
ArmorSlot_Jacket:getVisual():removeHole(12)
ArmorSlot_Jacket:getVisual():removeHole(13)
0-13
bodyPartIndex
What's the proper way to use setCooldown(0)?
I have tried:
Safety(attacker):setCooldown(0)
attacker:setCooldown(0)
From Docs:
https://projectzomboid.com/modding/zombie/characters/Safety.html#setCooldown(float)
declaration: package: zombie.characters, class: Safety
For context. This throw nil as comment labels below.
local function OnWeaponHitCharacter(attacker, target, handWeapon, damage)
if target:isZombie() then return end
local atkCooldown = attacker:getCooldown() --throws nil
local tarCooldown = target:getCooldown()
attacker:Say(atkCooldown)
target:Say(tarCooldown)
atkSafety:setCooldown(0)
tarSafety:setCooldown(0)
end
Events.OnWeaponHitCharacter.Add(OnWeaponHitCharacter)
Any idea if there's an equivalent of sandboxOptions:sendToServer() but for SP, to change SP sandbox settings?
Solved :)
trying to make a pz mega map, and these cell overlaps keep coming up:
should i be concered...? none of the maps are even close to 0,0 so its just a little bug right?
how do i make multiple functions in the same .lua file? the earliest one stops working if i add another function big noob question i know
Can you show how you're doing it?
nvm i figured it out, thanks for being ready to help though
wasnt using end correctly
By the way. I have an issue with SandboxOptions:sendToServer(), it works if the client player is set to admin only. I tried to instead use sendClientCommand() and apply the sandbox options server-side. They're applied according to few print() statements, but no actual changes appear in effect in-game. What's causing this?
P.S.: I could solve this by temporarily setting the player's access level to admin then re-setting it after sending the sandbox settings to server, but seems like a cheap solution and definitely not optimal
Edit: Solved - Check #mod_development message
My pleasure! Glad you figured it out
I am new to modding and can’t find any documentation on this, is it possible to change the size of models in game in real time (like x happens and makes zombies shrink to 1/2 size) or can the size of 3d models in game not be affected
how do i make the player the source of a sound for an audio file instead of a zombie or sound manager?
is that even possible?
You can play them on the player's emitter: https://projectzomboid.com/modding/zombie/characters/IsoGameCharacter.html#getEmitter()
declaration: package: zombie.characters, class: IsoGameCharacter
Not at my home computer to confirm, but it seems like it's just not propagating them to clients. If you've the source decompiled you can look to see what it's doing, but you may need another command for that propagation. Take that with a grain of salt though bc again, can't confirm at the moment
I don't have the source decompiled unfortunately. How do I access it?
I don't remember off the top of my head. There's a tool that's supposed to do it for you but requires some tinkering to work; I think I ultimately just used fernflower directly
I'll see if I can find the tool
thank you
Thanks
I will try to see if I can use sendServerCommand after sending the client command, maybe that's what I am missing to make it work
Tchernobill wrote a guide here: https://steamcommunity.com/sharedfiles/filedetails/?id=2748451514
Thanks!
https://projectzomboid.com/modding/zombie/characters/IsoGameCharacter.html#getSafety()
attacker:getSafety() to get the safety, then you can call the methods on that. Not sure whether it's a guaranteed return or not, though, so may want to check for nil
declaration: package: zombie.characters, class: IsoGameCharacter
Hello, can anyone help me with a Lua file? I have an item that, when used while placed on the ground, doesn't get consumed 😦
you can consume an item through code using item:Use()
for anyone who may face future issues with this:
I solved this issue by sending a client command to change server sandbox settings, then sending a server command to all online players to change their local sandbox settings to match the changes made from the client command
What is wrong? 😦
if SandboxVars.DukeTaunts.qtog == false then return end
if qtaunt == Keyboard.KEY_Q then
local character = function(player)
character:getEmitter():PlaySound("yell_" .. ZombRand(1, 17))
end
end
end``` how come this doesn't play any sound or give any errors? what am i missing?
add prints and / or breakpoints
VS Code can check your Lua syntax for errors automatically, and it's available free of charge.
You could save yourself a lot of searching your code and debugging and reloading by using a program that checks your syntax for you :d
I should have done that but I used notepad++ instead.
i messed up when pasting the code, its not broken up like that my bad
how do i store the result of a randomizer as a single variable?
player = getPlayer();
emitter = player:getEmitter();
randomizer = ZombRand(1, 17);
if SandboxVars.DukeTaunts.qtog == false then return end
if emitter:isPlaying("yell_" .. randomizer) then return end
if qtaunt == Keyboard.KEY_Q then
emitter:playSound("yell_" .. randomizer)
end
end``` i tried this but both "randomizer" use different results
If they use different results then I think it means the function is running multiple times, getting a new random result each time? (just having looked at that one message ^ and not knowing what the problem is) (also, away)
this is correct, your issue is something else
when i set the randomizer to 1 to guarantee that its the same number it works as intended
but because it rolls between 1 and 17 normally it only works 1/17 times
lol
1/16 times, the upper bound is exclusive
I seem to have an issue triggering climb fence in MP. It works in SP, but for the others I am walking around the fence.
good to know 😮
any idea what the problem could be?
not at all, it is impossible for the value of randomizer to change in this code
btw, you should use local variables as much as possible (local player = instead of player =), it can't be happening in this setup but mod incompatibility can happen and cause issues like this when you use globals
(and globals are just laggy)
but they stop working after the first "end"?
like if i wanna use it again later
i have to create another one?
it stops working after the current scope, e.g.```lua
function whatever()
local foo = bar
end -- foo goes out of scope
function anotherFunction()
local foo = bar
if something then
end
end -- foo goes out of scope here
think how many mods want to use the variable name 'player'
you don't want two mods messing with each other's data unpredictably like that
not really, if you declare it at the top of your file like local player; then it'll be the same variable anywhere within that file
i tried that it gives me nil errors
if you're doing local player = getPlayer() at the top, it fails because there is no player when the lua first runs and that's when that line will run
it doesnt fail, but when i go in game and press q i get the nil error
any idea why printing getPlayer():getBodyDamage():getHealth() in onPlayerTakeDamage prints the body health before the damage is taken?
I could get the damage after player takes damage by subtracting the damage from the getHealth but not sure if its prone to logic errors later on
often times it's fired before the health is actually adjusted
the logic error you'd be prone to is that this is not always the case, depends on the source of the damage
albion do you know how to make it so it wont play a sound if the emitter is already playing any sound at all?
that might work rather than trying to match the randomizer numbers
Are you saying you want it to choose a random number once and have it be the same for that player whenever it's called?
these isClear() and isEmpty() emitter methods seem suspect, don't know what they actually do though
no my mod has various sound files that it randomly picks from, but i dont want them to spam if the player presses q rapidly so i want it tocheck if a sound file is already playing and if it is then it doesnt play another one
Then you'll either have to save the last one played for the isPlaying check, or check for all of them
how would i go about saving the last one played? i figured i could check for all of them but i didnt wanna go down that route
The most straightforward way is a variable local to the file
OnWeaponHitXp is called AFTER all damages and health is reduced from the attacked character.
For attacks, order is:
OnWeaponHitCharacter -> OnPlayerGetDamage -> OnWeaponSwingHitPoint -> Damage is done here -> OnWeaponHitXp
I think the damage resulted from the event isn't directly related to body damage so my approach won't work anyways. Meaning if damage is 50 and health before damage is 100, it doesn't seem to necessarily mean that new health will be 50. At least per my debugging:
LOG : General , 1697737416174> Resulted damage: 79.41693115234375
LOG : General , 1697737416175> Player's health before damage: 100
LOG : General , 1697737416175> Player's health after damage: 20.58306884765625 (Calculated using health before damage minus resulted damage
Printing actual in-game health via console: 85.5290298461914
Player's health after damage doesn't seem to reflect the actual health in game
I am working with Car crash damage
yeah, unfortunately you cannot predict it for car crash damage
the value it gives you is used for a bunch of rng
it's more of an intensity metric than a damage amount
it hits a random number of limbs, partially based on the 'damage', for a random amount of damage, also partially based on the 'damage'
This sucks. This ruins the whole logic that I was building my mod upon
in this case i think it is applied before the event is fired but the overall body health isn't updated until the next player tick
Maybe a work around that gets body health before and after crash
The logic won't be optimal probably
but its the best workaround for now (?)
the value from getHealth is just the average of the body, but it's only recalculated every player update
you could just calculate that
how often does onPlayerMove work? Everytime a movement key is pressed?
every frame while they're holding a movement key and are allowed to move (even if they aren't actually moving, e.g. if they are walking into a wall)
it doesn't fire while driving a vehicle
Thanks for the suggestion, but that does not seem to work. Maybe the OnWeaponHitCharacter character objects do not contain this info? hrmmm...
thanks!
I am using this function for testing:
local function OnWeaponHitCharacter(attacker, target, handWeapon, damage)
if target:isZombie() then return end
local atkSafety = attacker:getSafety()
local tarSafety = target:getSafety()
if atkSafety != nil then
print("atkSafety: " .. atkSafety)
local atkCooldown = attacker:getCooldown()
if atkCooldown != nil then
print("atkCooldown: " .. atkCooldown)
end
atkSafety:setCooldown(0)
end
if tarSafety != nil then
print("tarSafety: " .. tarSafety)
local tarCooldown = target:getCooldown()
if tarCooldown != nil then
print("tarCooldown: " .. tarCooldown)
end
tarSafety:setCooldown(0)
end
end
Events.OnWeaponHitCharacter.Add(OnWeaponHitCharacter)
What do you mean by “doesn't seem to work”? What happens?
atkSafety & tarSafety are always nil
the objects passed by the event are no different from any other character object
I thought they may contain particular info upon certain events.
it doesn't seem like it's ever possible for getSafety() to return null...?
it's initialised by default and there's no method that lets you actually destroy the object
every character should always have a safety, even with weird interference
Hrmm, that was my thought but then again Im not entirely familar with the API or Java code for that matter.
So, ideally I should be getting the Safety object from attacker:getSafety()?
yeah, i can't see any way you wouldn't
This is the only function, and code in general, in this mod that Im using and no other mods to interfere.
How are you testing it?
I am testing on a dedi server as well
Can't check atm but I'm not certain this would fire for a zombie hitting a player—are you testing with a player hitting a player?
so the higher the framerate the player has the more often it fires?
Also, I have tried safety enabled and disabled. PvP enabled of course.
like someone with 240 fps will have it fire 240 times a second while someone with 20 fps only 20?
Yes, definitely pvp. havent tried on zeds.
welp that sucks is there any alternative?
not really, pretty much everything is tied to framerate
what about adding tick rate to OnPlayerMove?
possible?
to make it consistent across all kinds of pcs
not really possible, easier to just adjust for framerate
you can't mess with the event trigger but you can either have some timer to make sure your code doesn't actually activate too often or if it's appropriate just scale the effect by the delta
i went with Every10Minutes and made it so it doesnt fire if the time is sped up or the player is sleeping
should work i think?
Hi guys, are there any modders here who would be willing to work on a fairly small project to help expand their portfolio? In short it is a multiplayer tracking gps that can be crafted, that allows the player to locate the cell that another player is in, and is updated every 12 irl minutes. It would be shown on the map with a red outline, and can allow for roleplay scenarios like bounty hunting/hitmen and general PvP hunting. You could also play essentially dream manhunt in pz. Let me know if anyones interested!! :)
did you check that mod ? https://steamcommunity.com/sharedfiles/filedetails/?id=2877484605&searchtext=gps
hjello
Could anyone tell me how can I use "getPrimaryHandItem()" properly? if player:getPrimaryHandItem() == "ATTS.Zmazon" then~
~~Pretty sure that's right, but you can test with this.
local primHand = getPlayer():getPrimaryHandItem()
if primHand ~= nil then
print("PrimaryHandItem" , primHand)
end
```~~
Just do if primHand then its faster and better to understand
I find it less readable, but I do see more people doing it that way.
As far as i know there is some finicky stuff with ~= nil checks in lua
Interesting, where can i read about it? before I search lol
I think albion mentioned it once here sometime ago
if you want to check the type of the item you'd use player:getPrimaryHandItem():getFullType()
Thanks so much yall. It works smoothly as I wanted now! local Handitem = player:getPrimaryHandItem() if Handitem and Handitem:getFullType() == "ATTS.Zmazon" then
"The game’s use of ModIDs has been altered to be appended by the workshop ID of each mod. This adjustment is aimed at resolving server issues that result in file mismatch errors when users attempt to connect, due to various mod versions sharing the same ModID. This happens on the Steam Workshop a fair bit due to re-uploads and modpacks. Now, with the workshop number attached to the ModID, only the “correct” version of a mod will be loaded by clients connecting to servers. We’re hoping that this will then lessen frustrations with said cursed file mismatch errors whenever you’re in an area of mod self-conflict."
Configuring mod load order, too
i'm happiest about marking incompatible mods
How to make same effect as vanilla? Having stat value increase slowly, rather than instant effect? Learning and have been stuck here for long time, ready to move on
help 
my StatsAPI has utilities for this, otherwise it's pretty complicated
you need to add the stat every tick adjusting for the time delta until you've added the target amount
thank you much
i'm working on a power plant mod and the idea right now is to spawn arrays of invisible generators with modified radius (thanks to the new variable range generator mod) that can power up a big area such as an entire town. Do y'all think its a good idea? or can you think of something better? is there a way i could supply tiles with electricity without having to spawn generators?
i want to add a new face paint. how do i proceed? 
An example of what albion said:
function whatever()
local foo = bar
end -- foo goes out of scope
local player = nil
-- player is now in the scope of both of the functions below this point
function anotherFunction()
player = getPlayer() -- so now the variable's value is the player rather than nil
end -- the function ending doesn't delete the variable, it keeps its value
function thirdfunction()
local foo = player -- if you didn't run anotherFunction earlier, the value is still nil
if something then
end
end -- foo goes out of scope here
@bronze yoke Could you provide me an example of what I am trying to accomplish? I will be fine further on, just need to learn by example. I study your code but there is so much, and has furthered my confusion
you can require the mod and call the functions
unfortunately a lot of the code there is heavily tied to stats api's inner workings for performance reasons so it's not the easiest to generalise
if player:getCurrentState() == PlayerHitReactionStatePVP.instance()
...some code
end
PlayerHitReactionStatePVP.instance() always gives an attempted index: instance of non-table: null error.
Any suggestions on how to get a players pvp hit reaction state?
PlayerHitReactionPVPState
Good morning.
I am looking for a tutorial on how to insert a custom loading screen. Can someone help me. Would be great. Thank you very much.
i have a question how hard is it to make mods?
how do i make a function affect only crawling zombies?
nvm figured it out its isCrawling()
addSound(crawler, crawler:getX(), crawler:getY(),crawler:getZ(), 200, 200) why doesnt this attract zombies?
This is for Items, not players :)
I think it's the default visual detection range, maybe
whats the number?
🤷♂️
Oh wait I remember now
It's the number for the visual detection range
The default one


is there a way to make this not explode my code whenever I'm in a "There is nothing here" foraging zone?
if not zone then return end
if currentZoneType == nil then return end
holy shit it worked thanks guys
how do i change the range from which a player can hear a sound? i tried editing scripts txt & increasing the volume of the sound itself, but the player can still only hear it from about 20 tiles away.
I think you have to make another txt file that looks like this
ok thanks
Somebody can make a padlockable, indestructable metal chest?
I would be really happy if someone had a tip for me.
How do I find out if an object is the source of sound?
local function TryCapWorldSound()
local player = getPlayer()
local stats = player:getStats()
local item = "Tsarcraft.TCWalkman"
local required_sound = "Tsarcraft.CassetteNirvana"
if item:isPlayingUISound() == required_sound
then
player:Say("Sound founded")
stats:setAnger(4)
else
player:Say("Error")
end
end
Events.OnPlayerUpdate.Add(TryCapWorldSound)
Anyone know is it possible to add alternative to Base.LugWrench in this reciepe?
{
items
{
1
{
type = Base.Jack,
count = 1,
keep = true,
}
2
{
type = Base.LugWrench,
count = 1,
keep = true,
equip = primary,
}
}
time = 400,
skills = Mechanics:1,
test = Vehicles.UninstallTest.Default,
complete = Vehicles.UninstallComplete.Tire,
}```
I tried different ways, but nothing works
check function VehicleUtils.testItems
it doesn't seem to be supported.
Hello. I Try to programm an own Loadingscreen. I have tried to put something together but it does not work. Can anyone tell me if this code should at least work?
-- Ladescreen-Modul
module("McFlyPZLoadingdscreen", package.seeall);
-- Funktion zum Ändern des Ladescreens
function setCustomLoadingScreen()
local loadingScreen = getCore():getLoadingScreen();
loadingScreen:doTexture("media/textures/pz.png");
end
Events.OnGameStart.Add(setCustomLoadingScreen);
What's causing the delay in the window movement/anim. while opening the door?
Hello!
I'm trying to make a mod by following Blackbeard's video tutorial, and I'm trying to give myself the item I created using the admin menu, but the item doesn't show up in the menu. Please help
Also, if Blackbeard's video tutorial is out of date at this point, please tell me where to get more up to date information
If I wanted to comission an armor set mod who should I be looking at?
Anybody know a function to get how many days have been since the game started?
Like if there is one
I know if you set a date start in sandbox settings it doesn't really take that into account in the date
I'm worried getClimateManager:getCurrentDay():getDay() will return the current day of the year and I don't wanna be doing a ton of redundant code or spend the time actually waiting more than one in-game year to know lol
getGameTime?
getGameTime():getNightsSurvived()
Won't this only be for the currenct character?
nope
the name is probably prior to that having any meaning
players have a nights survived too but the one on gametime is just 'how many times has 7am passed since the start of the save'
Awesome, thanks!
so if a modder has been manipulating game time to turn the power/water back on, will that stay accurate?
Anyone know how to prevent this hit reaction?
Using OnWeaponHitCharacter with these doesn't do the trick.
target:setIgnoreMovement(false);
target:setHitReaction("");
target:setVariable("hitpvp", false);
target:setVariable("hitreaction", false);
target:setVariable("hitreactionpvp", false);
target:clearVariable("HitPvP")
target:clearVariable("HitReaction")
target:clearVariable("PlayerHitReaction")
handWeapon:setPushBackMod(0)
handWeapon:setKnockBackOnNoDeath(false)
unless they explicitly modified it
Also, getting the targets state in OnWeaponHitCharacter or OnPlayerGetDamage always results in IdleState. Even when hit.
local targetState = target:getCurrentState()
if targetState ~= nil then
print("targetState: " , targetState:getName())
end
LOG : General , 1697840443702> 1,853,075,941> targetState: IdleState
Bump
The hit reaction is set in the Java after those events called. I don't see a good event that could be used to change that honestly
At least in the attack stack
Hrmmm, maybe another way to prevent the reaction from even happening. Ill keep pondering. I did see you albion, and Glytcher talking about it from a while back.
yeah i think i just forced the player into a specific state
This is what you used
my memory fails me 😅
This is what Fajdek used:
local function CancelPVPStagger(player, _, __)
if player ~= getPlayer() then return end
if player:getCurrentState() == PlayerHitReactionStatePVP.instance() then
player:setHitReaction("")
end
end
Events.OnPlayerGetDamage.Add(CancelPVPStagger)
However, in Fajek's case, I dont think he ever tested the code. The state is always Idle at that point. Never comes tout to any other reaction.
Cant get a current State in OnPlayerGetDamage or OnWeaponHitCharacter.
Nvm, dhert you werent in that conversation. My bad.
I swear I make an attempt at getting rid of stun-lock pvp every year since B41 MP came out. 😅
Miss the B40 PvP. Was actually somewhat reasonable if you reduce pvp damage. Standard you would mow player down with high aim skill.
I mean, your fixes somewhat help. It becomes stagger PvP. Can juggle players and they can actually shootback. The server options actually work too.
KnockedDownAllowed=false
# If true, player can hit again when struck by another player.
PVPMeleeWhileHitReaction=true
Are there any guides that deal with animations? Maybe I can take another approach and disable the pvp reaction animations completely.
media/AnimSets/player/hitreactionpvp/HitReaction.xml ```xml
<?xml version="1.0" encoding="utf-8"?>
<animNode>
<m_Name>HitReaction</m_Name>
<m_AnimName>Bob_HitReact_01</m_AnimName>
<m_deferredBoneAxis>Y</m_deferredBoneAxis>
<m_Looped>false</m_Looped>
<m_SyncTrackingEnabled>false</m_SyncTrackingEnabled>
<m_BlendTime>0.10</m_BlendTime>
<m_BlendOutTime>0.20</m_BlendOutTime>
<m_Conditions>
<m_Name>ConditionNeverTrue</m_Name>
<m_Type>BOOL</m_Type>
<m_BoolValue>true</m_BoolValue>
</m_Conditions>
<m_SubStateBoneWeights>
<boneName>Bip01</boneName>
<weight>0.20</weight>
</m_SubStateBoneWeights>
<m_SubStateBoneWeights>
<boneName>Bip01_Neck</boneName>
</m_SubStateBoneWeights>
</animNode>
or maybe you'll need to handle the inheriting classes conditions overrides and do something brutal and ugly like : ```xml
<?xml version="1.0" encoding="utf-8"?>
<animNode>
<m_Name>HitReaction</m_Name>
<m_AnimName>Bob_HitReact_01</m_AnimName>
<m_deferredBoneAxis>Y</m_deferredBoneAxis>
<m_Looped>false</m_Looped>
<m_SyncTrackingEnabled>false</m_SyncTrackingEnabled>
<m_BlendTime>0.10</m_BlendTime>
<m_BlendOutTime>0.20</m_BlendOutTime>
<m_Conditions>
<m_Name>ConditionNeverTrue</m_Name>
<m_Type>BOOL</m_Type>
<m_BoolValue>true</m_BoolValue>
</m_Conditions>
<m_Conditions>
<m_Name>ConditionNeverTrue</m_Name>
<m_Type>BOOL</m_Type>
<m_BoolValue>true</m_BoolValue>
</m_Conditions>
<m_Conditions>
<m_Name>ConditionNeverTrue</m_Name>
<m_Type>BOOL</m_Type>
<m_BoolValue>true</m_BoolValue>
</m_Conditions>
<m_Conditions>
<m_Name>ConditionNeverTrue</m_Name>
<m_Type>BOOL</m_Type>
<m_BoolValue>true</m_BoolValue>
</m_Conditions>
<m_Conditions>
<m_Name>ConditionNeverTrue</m_Name>
<m_Type>BOOL</m_Type>
<m_BoolValue>true</m_BoolValue>
</m_Conditions>
<m_Conditions>
<m_Name>ConditionNeverTrue</m_Name>
<m_Type>BOOL</m_Type>
<m_BoolValue>true</m_BoolValue>
</m_Conditions>
<m_Conditions>
<m_Name>ConditionNeverTrue</m_Name>
<m_Type>BOOL</m_Type>
<m_BoolValue>true</m_BoolValue>
</m_Conditions>
<m_Conditions>
<m_Name>ConditionNeverTrue</m_Name>
<m_Type>BOOL</m_Type>
<m_BoolValue>true</m_BoolValue>
</m_Conditions>
<m_SubStateBoneWeights>
<boneName>Bip01</boneName>
<weight>0.20</weight>
</m_SubStateBoneWeights>
<m_SubStateBoneWeights>
<boneName>Bip01_Neck</boneName>
</m_SubStateBoneWeights>
</animNode>
Yea, in that media/AnimSets/player/hitreactionpvp/HitReaction.xml file I would change:
<boneName>Bip01</boneName>
to:
<boneName>Bip01_Spine</boneName>
That SHOULD keep the animation overall but won't apply the translation data of the animation (so no movement impact). I think you would still need to provide all of the PVP hit reaction action files in your mod as an override though, as they all inherit from that base file and my understanding is that the xml action inheritance only works for files in the local directory.
Or if you want to remove the animation entirely, make a 0-1 frame animation and set all of them to use that animation file via the top bit in each action file:
<m_AnimName>Bob_HitReact_NothingPVP</m_AnimName>
could work, would be dirty though.
Interesting. Time to get my hands dirty. Thanks fellas.
you can also add an invalid animation instead of 1 frame animation. it creates logs but no other problem.
Anybody ever tried to spawn a corpse on MP?
I am using createRandomDeadBody server side and transmitting but they're not lootable for the clients
Sorting recorded media was a shitshow.
So you can kinda stick to media categories to index VHS both home and retail but SURPRISE MOTHERF**KER apparently CD's media cant be listed as category (not sure why) and global indexes change depending on mods. So you literally have to instantiate item scripted, find needed media, get their ids and compare them to be sure its the same thing..
Yikes.
anyone knows how to create a mod for new face paint makeup option? 
Sorry if dumb q but how have people been converting their models to .x from .fbx? Are there any free options?
I don't know who blackbeard is and I've not watched the video but if u paste ur code I cann halp. You can make the message format as lua by typing ` thrice followed by the three letters lua like this
hey
Blender can save as .fbx and I read something about there being a plugin for .x.
module IBC
{
imports
{
Base
}
item IndiesBeerCheat
{
DisplayName = Beer Cheat,
DisplayCategory = Food,
Type = Food,
Weight = 0.3,
Icon = IndiesBeerCheat,
EvolvedRecipe = Soup:8;Stew:8;Beer:9;Beer2:9,
FoodType = Beer,
Alcoholic = TRUE,
CantBeFrozen = TRUE,
EatType = popcan,
Packaged = TRUE,
ReplaceOnUse = BeerCanEmpty,
HungerChange = -100,
ThirstChange = -100,
UnhappyChange = -100,
Calories = 0,
Carbohydrates = 0,
Lipids = 0,
Proteins = 0,
CustomContextMenu = BeginTheCheat,
CustomEatSound = soda-can-opening,
StaticModel = BeerCan,
WorldStaticModel = BeerCan_Ground,
Tags = LowAlcohol;HasMetal,
EvolvedRecipeName = Beer Cheat,
}
}```
That's my script
And then I have this lua:
local MOD_ID = "IBC";
local MOD_NAME = "Indies Beer Cheat";
local MOD_VERSION = "1.0";
local MOD_AUTHOR = "Indie";
local MOD_DECRIPTION = "Adds a cheat beer with a custom sound.";
local debugItems = TRUE;
local function Info()
print("Mod Loaded: " .. MOD_NAME .. " by " .. MOD_AUTHOR .. " (v" .. MOD_VERSION .. ")");
end
--add mod items to inventory at start if (line 6) local debugItems = TRUE;
local function addItems()
if debugItems then
local player = getSpecificPlayer(0); -- Java: get player one
local inv = player:getInventory(); -- Java: access player inv
-- Java: add the actual items to the inventory
--inv:AddItem("Base.Axe");
--inv:AddItem("Base.RippedSheets");
--inv:AddItem("camping.TentPeg");
inv:AddItem("IBC.IndiesBeerCheat");
end
end
Events.OnGameBoot.Add(Info);
Events.OnGameStart.Add(addItems);```
local debugItems = TRUE
lua is case sensitive, this looks for a variable called TRUE, and there is none, so the value is nil and if debugItems then evaluates to false
I am flummoxed or something. If you uncomment a line that adds a base game object, an Axe or a RippedSheets, does that get added? You could try adding `print("hellohail")' to see if th ecode's running although it looks like it is so maybe you don't need to.
edit: albion below :d
:o
it should just be local debugItems = true
idk maybe you could try running the code before the on game start function.
Does anyone know a proper way of grabbing either all objects in N-radius from square/object or grabbing all squares in radius from square/object?
Purpose: need to poll and return specific tiles in certain radius from local player.
Hi, I am planning to create a respawn-after-death mod, which would allow players to restore their current skill set. I'd like to ask if there is any docs to access the player objects that contain their current skill set, level, and so on.
Does the game's Lua code support goto statements?
no, it is mostly 5.1 with some missing features
Okay, thank you, that's a shame
why goto if you have functions
It's just a tool
it's nice for avoiding nesting in loops, because of the lack of continue
It's if statements all the way down otherwise
I've never used Lua before so just trying to learn what I can get away with coming from Kotlin
You could look at the list of functions for things something like GetCell():GetSquareOrTileOrSomething(x, y, z)
I kinda make fake transitions with lua now, it's rather simple once you know to call postupdate().
How can I check the sound is playing?
local function TryCapWorldSound(player)
local player = getPlayer()
local stats = player:getStats()
local item = player:getSecondaryHandItem()
if item and item:getFullType() == "Tsarcraft.TCWalkman" then
local soundEmitter = player:getEmitter()
local soundName = soundEmitter:AmbientSoundLogic:getSoundName()
if soundName and soundName == "CassetteNirvana" then
player:Say("Sound found")
stats:setAnger(4)
else
player:Say("Sound not found")
end
else
player:Say("Error")
end
end
Events.OnPlayerUpdate.Add(TryCapWorldSound)
Ok, but the item should still exist right? If I make myself an admin and try to give myself the item, searching for it doesn't bring it up
Can you please clarify fake transitions? Are they made using the animation action scripts? or the animations themselves?
anyone think that adding complex chemistry would be fun?
I said it's lua, postupdate helps to tick the pz systems. Change the variables, call that and you are in different state or animation.
You can also call it to progress into a state and make changes to that.
Ahhhhh, I kinda see what you mean now.
Id hate to remove hitreaction alltogether so this route seems much better
Looking through some of your mods. Could you point me to one where you have done this before?
It's one I am finishing now.
noice, i look forward to another great mod made by you
So, I solved the problem with the sound check. If it helps anyone here is the code:
local function TryCapWorldSound(player)
local player = getPlayer()
local stats = player:getStats()
local item = player:getSecondaryHandItem()
local sound = "CassetteNirvana" -- Sound name
if item and item:getFullType() == "Tsarcraft.TCWalkman" then -- Full type of the object that makes the sound
local soundEmitter = player:getEmitter()
if soundEmitter:isPlaying(sound) then
player:Say("Sound found")
stats:setAnger(4)
else
player:Say("Sound not found")
end
else
player:Say("Error")
end
end
Events.OnPlayerUpdate.Add(TryCapWorldSound)
I think it would.
I wanna fill an envelope with anthrax and leave it in base for an unlucky soul to find. Maybe some VX nerve agent to slap on other players like what happened to Kim Jong-nam. Perhaps a complex system to brew up an anti-viral I am Legend style.
when did chemisty mean bio weapons?
Haha, those were my first thoughts coming from someone playing PZ exclusively on PvP servers since I started.
guys how do i make it stop playing a sound once a condition is met? like cut it off midway if necessary
ive got a loop that plays sound on repeat until a condition is met, but once the condition has been met it keeps playing the sound file until it finishes. I would prefer if it cut it off immediately. Ive tried getSoundManager getWorldSoundManager and cutting it off via the emitter itself but its not working for some reason
local zombie = idleSprinter:getEmitter()
repeat
if zombie:isPlaying("idle_1") then return end
if zombie:isPlaying("idle_2") then return end
if zombie:isPlaying("idle_3") then return end
if zombie:isPlaying("idle_4") then return end
if zombie:isPlaying("idle_5") then return end
if zombie:isPlaying("idle_6") then return end
idleSprinter:playSound("idle_" .. ZombRand(1, 7))
until(starget)
local starget = idleSprinter:getTarget()
local zombie = idleSprinter:getEmitter()
if starget then
if zombie:isPlaying("idle_1") then
getSoundmanager():StopSound("idle_1")
end
if zombie:isPlaying("idle_2") then
getSoundmanager():StopSound("idle_2")
end
if zombie:isPlaying("idle_3") then
getSoundmanager():StopSound("idle_3")
end
if zombie:isPlaying("idle_4") then
getSoundmanager():StopSound("idle_4")
end
if zombie:isPlaying("idle_5") then
getSoundmanager():StopSound("idle_5")
end
if zombie:isPlaying("idle_6") then
getSoundmanager():StopSound("idle_6")
end
end```
In class BodyPart setHaveBullet() there's a required constructor int doctorLevel.
Anyone know what kind of value it's expecting?
Is it the first aid level required to be able to fix it at all?
Anyone knows?
It lowers the timer of the deep wound, usually used with 0 or level of Perks.Doctor.
Thank you!
The world sounds can't be stopped. You can stop sounds from the player's emitter but those sounds are also only audible to that one player
im trying to stop a sound from a zombies emitter. not possible?
I'm not sure tbh, I've dabbled in sounds but never mastered them
and what do you mean the players emitters sounds are only audible to them?
isnt it audible to everyone
within range of the sound
No some sounds are only audible by the player
I got some sounds working with looping, and I was able to stop them with a button. However, when I tested it with a friend on a server, he couldn't hear them
Yeah that seems ok
--local soundEmitter = getWorld():getFreeEmitter(x, y, 0)
--soundEmitter:playSound("soundName", x, y, 0)
--soundEmitter:stopSound(arg0)
That's what i was doing to get a stoppable sound and it worked, but only local
hm
im trying to stop an idling zombies sound once it gets a target dont think it will work for me
There's also this
self.character:getEmitter():playSound(self.soundName)
That sound can be stopped too.
But i don't know if it's audible by others
I stop it with self.character:getEmitter():stopSoundByName(self.soundName)
i tried this it didnt work but i think its because the game no longer thinks the zombie is actively producing the sound?
because of the loop?
I seem to be calling a different function to you
i was able to stop looping sounds just fine
using the getFreeEmitter thing
so instead of
local zombie = idleSprinter:getEmitter()
and
getSoundmanager():StopSound("idle_1")
why not do
zombie:stopSoundByName('idle_1')
ill try that
i don't know if it works, but it's more similar to the one i know does work
does anyone know how the game combines the correct icons with the correct textures?
doesnt seem to work
what I mean is, for example:
the bandana ( the red, blue or black one) hase 3 textures but how does the game know what the right icon is?
cause in the scripts there a just the name of the icons that are available
can anyone help me out?
Where is this code being triggered? It seems you have a few logic errors, looking at the top loop alone: starget is retrieved once before the loop starts, so the loop won't affect the loop condition. If it weren't for the playSound call (which plays the sound on the emitter, which is checked in the next iteration), this would potentially be an infinite loop (if starget were falsy)
In clearer terms, it's expected that that'd either play a sound or return, as its only outcomes
You can look at the item scripts for bandanas as an example. From media/scripts/clothing/clothing_hats.txt:
item Hat_Bandana
{
DisplayCategory = Accessory,
Type = Clothing,
DisplayName = Bandana (Head),
ClothingItem = Hat_Bandana,
BodyLocation = Hat,
IconsForTexture = BandanaBlack;BandanaBlue;BandanaRed,
ClothingItemExtra = Hat_BandanaTied;Hat_BandanaMask,
ClothingItemExtraOption = TieBandana;TieBandanaFace,
CanHaveHoles = false,
ChanceToFall = 30,
Insulation = 0.10,
Weight = 0.1,
}
item Hat_BandanaTINT
{
DisplayCategory = Accessory,
Type = Clothing,
DisplayName = Bandana (Head),
ClothingItem = Hat_BandanaTINT,
BodyLocation = Hat,
Icon = BandanaBlack,
ClothingItemExtra = Hat_BandanaTiedTINT;Hat_BandanaMaskTINT,
ClothingItemExtraOption = TieBandana;TieBandanaFace,
CanHaveHoles = false,
ChanceToFall = 30,
Insulation = 0.10,
Weight = 0.1,
}
Ah, I missed that you asked how it knows
yeah I did, but I dont understand how the game is able to tell that the blue bandana needs the blue icon
hope I explained that right$
The IconsForTexture value seems to be your answer?
No problem. If you wanted a more detailed answer, you can see how it's handled in the Item and InventoryItem classes (see the property with the same name + the m_TextureChoice field on the visual)
local OnZombieUpdate = function(idleSprinter)
my bad didnt include it for some reason
it works as intended except for the fact that i cant figure out how to stop the sound once the condition is triggered
it finishes playing
even if theres still like 10 seconds left on the clip
Have you checked console.txt for errors? getSoundmanager should be getSoundManager, and StopSound doesn't accept a string. This wouldn't be the problem anyhow, though, since you should be stopping it on the emitter rather than the sound manager
emitter was what i tried first, but it didnt work thats why i went tried soundmanager
no errors in console
I'd try restructuring it to avoid the repeat loop logic (and use a table to have less duplicative code). Something like (pardon the strange tabs, written on Discord):
local sounds = {
'idle_1',
'idle_2',
-- and so on; could also generate this with a loop
}
local function OnZombieUpdate(idleSprinter)
local starget = idleSprinter:getTarget()
local zombie = idleSprinter:getEmitter()
local idleSound
for i = 1, #sounds do
local sound = sounds[i]
if zombie:isPlaying(sound) then
idleSound = sound
break
end
end
if starget and idleSound then
zombie:stopSoundByName(idleSound)
elseif not starget and not idleSound then
zombie:playSound(sounds[ZombRand(1, #sounds + 1])
end
end
wow thanks! I don't really have a grasp on for loops just yet but this will help a lot! Appreciate it 🙂
Now you finna haveta inspect the code that you use to search for the item as well. :}
my femboy species mod is expanding more than i had originally anticipated
its only been like, a few days or so since i uploaded it
:3
i guess people really wanted smth like this
1:14 ratio
wut dat?
Subscribers compared to unique visitors
yeh
(dab)
i may actually make my own model for this mod if it keeps growing aswell, and try to learn blender more
(i had just retextured an already existing model)
one of the issues is that i have absolutely no idea how to create custom hairstyles for this new species
and yes, this is a anthro survivors mod
I have an astrolfo (idk how to spell) meme for this but this aint meme channel :d
D:
so im adding a light to one of my helmets, ive got temp model as the light bulb, when i attach it to the helmet, it show up under the players feet, is there anyway that i can get it to just dissapear?
so I finally got around to testing the mod and the hand axes are just all invisable, with the icons being invisable aswell
heres my code
module Base
{
item HandAxe
{
DisplayCategory = ToolWeapon,
MaxRange = 1.1,
WeaponSprite = HandAxe_yellow;HandAxe_green;HandAxe_orange;HandAxe_brown,
MinAngle = 0.67,
Type = Weapon,
MinimumSwingTime = 3,
KnockBackOnNoDeath = FALSE,
SwingAmountBeforeImpact = 0.02,
Categories = Axe,
ConditionLowerChanceOneIn = 15,
Weight = 2,
SplatNumber = 2,
PushBackMod = 0.3,
SubCategory = Swinging,
ConditionMax = 10,
MaxHitCount = 2,
DoorDamage = 20,
SwingAnim = Bat,
DisplayName = Hand Axe,
MinRange = 0.61,
SwingTime = 4,
KnockdownMod = 2,
SplatBloodOnNoDeath = FALSE,
IconsForTexture = Handaxe_yellow;Handaxe_green;Handaxe_orange;Handaxe_brown,
BreakSound = HandAxeBreak,
DoorHitSound = HandAxeHit,
HitSound = HandAxeHit,
HitFloorSound = HandAxeHit,
SwingSound = HandAxeSwing,
TreeDamage = 15,
CriticalChance = 15,
CritDmgMultiplier = 5,
MinDamage = 0.7,
MaxDamage = 1.5,
BaseSpeed = 1,
WeaponLength = 0.35,
DamageCategory = Slash,
DamageMakeHole = TRUE,
AttachmentType = Hammer,
Tags = ChopTree;CutPlant,
}
}```
or does it only work for hats/clothing items?
that multiple textures are possible
Any major difference in function when adding custom mod parameters when you use mod options vs sandbox options? I guess in mod options players can tweak stuff more for scenarios?
the main difference is that mod options is per-player, sandbox options are the same for everyone on the server
Ooh, news to me. Not modding for MP only, just polishing up a mod I made for myself in case there's wider demand to give some customization options
generally i'd go with sandbox options for most things, people can be weird about dependencies
but if something makes more sense to be a 'player preference' thing and not a real gameplay change, mod options is preferable
Yeah
It's a simple rp trait mod. Start with some injuries. A more RP friendly way to get a ton of extra trait points if I'm totally honest :p
Is there a way to add in a hotkey to drop a specific item and make it activate after landing on the ground?
I was wondering
Is there a mod which disables falling animation after getting shot by the player?
Like, something that would prevent ppl from stunlocking in falling animation durning pvp shooting
Someone else discussed that earlyer see there #mod_development message
see Dhert's answer
I'm looking for a solution for the following problem. I created an action which add the content of a bottle to a target. After this action I'd like to put the item back to the storage where it was before the action.
My problem is now that the item changed during the first action because now it's an empty bottle. So I can't transfer it back.
ISTimedActionQueue.add(AddCustomLiquidIntoCustomLiquidObjectAction:new(playerObj, target, item, 25))
if returnToContainer and item then
ISTimedActionQueue.add(ISInventoryTransferAction:new(playerObj, item, playerInv, returnToContainer))
end
Is it possible to get the new item out of the first action?
Question.
I want to add a set of new variables to the vehicle class as shown in the image below.
What do I use to call these new variables for the vehicle so I can use them in my Lua functions when necessary - in the style of a get?
Examples of what I'm looking help with:
A) I need to check if the Boolean is set to true, and if false or nil return end.
B) I need to get a String Variable and set a local variable to it.
Thanks!
Also apologises for the what im assuming is a stupid question
you can use getModData() to get a table attached to the object, most custom data is put in there
e.g. vehicle:getModData().IsArmoredVehicle = true
I had already tried that, yet it had always returned nil
Weird, i shall try again
Must have had the syntax wrong i guess
hey folks! im wondering where item types like in [Recipe.GetItemTypes.RipSheets] is defined, and how can i use them
specifically i would like to find the item type for empty cans (beer/pop) and ammo, any help would be greatly appreciated!
they're lua functions, they're all defined in server/recipecode.lua
thanks a ton! ima check it out rn
If I wanted to comission an armor set who should I be looking?
How do I set the condition of a vest (bulletproof vest for ex.)?
I'm looking at the documentation but I can't seem to figure out how.
` local clitem = player:getClothingItem_Torso()
if clitem then
clitem:setCondition(clitem:getCondition()-damage)
end`
getclothingitem_torso only seems to get the shirt layer
anyone know how to attach items to a belt?
i know nothing about this and just wanna be able to put the walkmans from true music onto a belt
similar to how you can with radios
Take 4: can someone make a padlockable, indestructable metal chest?
Maybe this will help?
https://steamcommunity.com/sharedfiles/filedetails/?id=2127583399
Is it cuz for older version of API?
Hi, is it possible to spawn zombies without any loot with the horde manager?
No
Yes, zombies with Naked outfit don't have items on them
like the founding fathers intended
is it possible to check if a zombie is male or female?
isZombie()
isFemale()
isMale()
what about checking if a food item is rotten?
ty
isRotten()
seems kind of obvious, but thanks
is it possible to do in multiplayer?
doesnt seem to be working for me Object tried to call nil in OnZombieUpdate
local zmale = idleSprinter:isMale()```
isMale() isn't a thing for zombies. its only isFemale() apparently default zombie is male
someItem:setCondition(stuff) definitely seems it should work. You could add a print to see if it's defin - oh I just saw your next message which seems to say the problem is getting a reference to the vest? Maybe you could iterate through every worn item or every item in the main inventory and do things like instanceof(item, "Clothing") and item:getBodyLocation() and item:getCoveredParts() though maybe the last one will be not great.
This game is making me want to commit self destruct
How is it possible that I can have the SAME clothing item, with the same name, the same textures, the same properties, the same ID, same literally everything, in one mod folder and it works, and the other it doesnt
There a way to print the objects in a square that player right clicks from the OnFillWorldObjectContextMenu? (An object that a player can walk through. A sprite, i guess (?))
I was able to get the square, but the functions I am able to find to use with the square only return actual physical collidable objects (or dropped world objects)
(There are some collidable objects too, part of mapping, that are not showing in the square objects. Any solution to that?)
I had to list those in TchernoLib mod for movement control, depending on what you wanna do, it may (or may not) help to look at shared/Movement/MovePlayer.lua for a subset of "stuff on a tile".
oh sorry I did not list those, just used square functions + vehicles in the end.
ye was about to say that
Do they have the same guids? If they do, they might be overwritten by the previous one
I am basically trying to show a context option when a player right clicks an "object" in the world but that object is not collidable which I assume is a sprite
No I changed the guids
And it still won't work
So tired. So confused 
I got some free time, wanna send me the mods, so I can give you an extra pair of eyes?
i'm just chilling watching HOTD right lol
That'd be great, thanks! 💖
No worries dude, send it in PM, and I'll have a look 👍
Make sure you're not subscribed to the mod you're editing and testing. I faced a lot of such issues before, maybe that's what is happening
Oh yeah, that too, I noticed that problem with my Prox inv too
in my experience the object list returned by the event isn't reliable at all and you should just get the square and loop through its objects manually
That's what I am doing
Nah it's a new mod
but yet it returns nil on those none collidable objects
Btw does anybody know how to mess with Player HP? I swear I found a way once but I seem to have lost it to time
Nope, never tried that tbh
player hp is the average of the hp of all their body parts
You edit each body part's health. It will affect the player's total overall health
Been trying some stuff like setHealth and setOverallBodyHealth but nothing works
i wouldn't expect much
Ohhhh you're right I think that was it!
Thank you!
-- Set the body part health to the new reduced health.
character:getBodyDamage():getBodyPart(bodyPartType):SetHealth(newBodyPartHealthValue)```
My pleasure!
yeah, those methods just set the value that the game automatically recalculates every frame anyway
they shouldn't have setters in the first place
Here it goes
local bodyDmg = playerObj:getBodyDamage()
local bodyParts = bodyDmg:getBodyParts()
for i=0,BodyPartType.ToIndex(BodyPartType.MAX) - 1 do
local bodyPart = bodyParts:get(i)
bodyPart:SetHealth(bodyPart:getHealth() - 30)
end
This works
You can also use ReduceGeneralHealth or AddGeneralHealth for this.
Note to self: 0.3 didn't do much, 30 instantly killed the player. 3 is where it's at.
Actually this works great in my case cause I might want to add random injuries
so this is my first time making a mod with my own new items, and i've got a 3d blender model exported to .dae but im not sure how to assign it to my custom item, do i just do
i've got the model already as .dae in the media/models folder of the mod files
Isnt FBX and X only supported?
idk thats why im asking, i couldnt find much on it online
If you can, export it as FBX, but then still you need to describe model (not sure how its called ), where you name model and assign both mesh and texture to it
hm
alright i've got it as fbx
in the shading and texture paint panels of blender i already gave it textures and opacity stuff and i have the textures exported into the models folder as well tho i should probs move them to the texture folder
you need to make something like this to do it
model BasketBall
{
mesh = WorldItems/BasketBall,
texture = WorldItems/BasketBall,
scale = 0.4,
}
separate txt file i assume too
If you want to talk about the models, it be better to move to #modeling to not disturb this channel
its alr i found the right reference file in the game files
what about for custom icons
i've got the icon in the media/textures folder and for my item i set Icon = <pngname>.png
but i tested it and there was nothing
(my bad for the simple questions, i only started pz modding yesterday so i've yet to get the hang of this properly)
you have to add Item_<pngname>.png if i remember correctly to that texture, but don't add "item_" in txt file
oh alr
Item_iconname underscore didnt worked above even when edited.
example
don't include the file extension either
alr
ok understood
Solved this btw, for anyone with such future issue:
for _, object in ipairs(worldobjects) do
local sq = object:getSquare()
local tileObjects = sq:getLuaTileObjectList()
for _, tileObj in ipairs(tileObjects) do
local textureName = tileObj:getTextureName()
end
end```
and add code based on textureName
Hey all, lots of fog still on certain things but if I create an isoobject and it’s working great when I create a new one… but my goal is for existing isoobjects of the same to inherit this new isoobject class I’ve made, is there an example of how to make sure it applies on already created isoobjects of that same type?
I've got a quick question
I want to make a mod that basically just makes 2 other variants of some clothes
however, I'm not sure how to go about that
nor I am not sure how to make that compatable with something like Spongie's Jackets
Basically, it's only 2 other colors for the leather jacket
Pretty sure there's a function to change the color of a clothing item but if I'm not mistaken, it doesn't work with all clothing items. Haven't messed around with it before
Oh I just mean like
Adding 2 extra textures the clothes can use
Basically the extra textures are really just reskins, for brown and red
I'm sure adding that is the easiest part, but making it compatible with something like spongie's feels like where it gets more complicated
thanks for the answer, i was hoping there was a better way than using a for loop but it looks like its the only way 🥲
I don't know for sure that there isn't a Java function that gets your clothing item for a certain body location though...
Anybody know how to start a fire in a square without causing instant death to nearby players
IsoFireManager.StartFire() instantly kills my char if they're close
Is it somehow possible to get over 100 people on a server?
We've gotten 90-100 our last few events and we have really great server specs. Could I modify the server source or something to get over 100?
ain't that related to the energy parameter of the StartFire ? (4th param)
Hey ya'll can anyone confirm if my understanding is correct here.
Within the Zomboid Distributions.lua most containers that are within the All sub-table use proc-lists, but their are some exemptions, any container that is outside of a room does not use a proc list because of checks within the Java. But for example, a mailbox is never inside a building and instead explicitly lists items with weights for chances of spawning.
In theory using custom container types and defining them and inserting them into the All sub-table we can spawn loot in containers outside of rooms, given that we list the items via items = { instead of procedural = true yadayada? I'm begging to the iDev gods this is the case 😨
yes, that works for the solar crates.
I'm so happy, any rough guidelines for how I should do the numbering for weights? I presumed it was relative to each list and we can go from 0-100 if we so wish but don't need to?
Every item is rolled separately. You can use bigger numbers than 100 as well.
Thanks for explaining, cheers for the help in general you give in this channel, god send 🙏
https://www.reddit.com/r/projectzomboid/comments/17e3s6h/game_night_board_games_card_games_and_more_out_now/
Finally feels good enough to release.
Now make it craftable with a jar


How can we see the source code? Decompiling does not show names of functions and variables?
function names are maintained
do the zombies have boid-like movement?
Anyone can explain to me the paramaters of character:Say?
Anyone can help setting height on clock top right when wearing a watch. setY() works just fine, but setX() seems to do nothing. What am I missing? (apologies I dont know how to embed code in discord)
What would the process be of making a tile into an item. Like one that could be picked up, interacted with, etc.
Example:
I know base game has a bear trap tile. Now what would I need to do to be able to make the bear trap interactable and able to pick up?
Like let's say I wanted to make the bear trap an item. Something that can be grabbed from item list viewer and interacted with. Now I want to use that item in a recipe. Is it as simple as using the asset from the pack and making a new item?
Those are totally radical, great job!
Where can i find the lua code that initiates the little light that appears when you fire a gun?
Or for thunderstorms as well, the light flashing
I'm just trying to find where you can see the tiles like this 👀
Can't find where the base game tiles are located to be able to view them like that.
Oh maah gooodd I'm hyped for this
I've been studying this to get a better idea of zombie behavior. But how does it work in multiplayer?
https://www.youtube.com/watch?v=hglrA6FrxOw&ab_channel=Retanaru
In this video I explain and show off the zombie migration mechanics. The sandbox mode lets us modify many of the main mechanics of the game and allows me to show off what does what. The redistribution hours and in game sound events are the primary movers of zombies while the rally group system and others help to smooth the rest out.
https://ko-...
You’d need to make it a movable a la bed or couch
Thank you!!! i honestly love your pony mod
🫡 I'm going for period-accuracy for mine
(i'll probably have to make g2's as well)
New Mod ! Adding 29 Skins to VFE !
https://steamcommunity.com/sharedfiles/filedetails/?id=3058658670
I don't know but I found this, maybe helpful?
https://projectzomboid.com/modding/zombie/characters/IsoGameCharacter.html#startMuzzleFlash()
declaration: package: zombie.characters, class: IsoGameCharacter
Knox Country
Hello I'm new to making mods for games, and I could use some help. I want to create a mod where the player can tie the sleeves of their jumpsuit around their waist. I tried using the code from Spongie's open jackets mod because I don't have much experience in modding. I also put together the Blender file by combining the fbx file of the boilersuit with the jumperTied file. It sort of worked, but the sleeves doesn't render in game.
This is probably an extremely stupid question, but is it possible to use tags to limit what items can go inside a bag for example
you can set the bag's AcceptItemFunction and check for the tag in that function
Never posted a mod here before but I'm proud of this one. Took so much effort!
It wouldn't have been possible without help from @bronze yoke and poor @sour island who had to go through the pain of finding out how to kill a zombie in MP and I just dug it up in this channel 😂
Sorry to be a bother, what would be the file path for finding acceptitemfunction to override it and create a new one
Found it ignore me 💀
https://steamcommunity.com/sharedfiles/filedetails/?id=3058731011
Question lads,
I release this mod to make simple change to the weapons in Gunshop Kendo to use the lever action animations to lever action rifles, as I run VFE as my main weapon mod.
Next step I was trying to make the guns show a muzzle flash when fired since gunshop kendo doesnt have.
Is this something that can be achieve via script?
how do i make a function last for 2 in-game hours? i cant seem to figure it out
How can I upload a mod to Steam if I have the Gog version of the game? Haven't used Steam since 2012


Figure muzzle flash work like attachments, but lol
afaik you can wrap the Events.Event.Add() line inside an if statement, the only thing you need is to make the game understand from when to when the two hours you want should be. I'm pretty sure javadocs has something for it.
I can download them just fine but for some reason Steam doesn't want free contributions... Not about to buy the game a second time just to be able to put mods I made for myself online
Just means my mods won't be on steam, instead gonna end up on GitHub. Steam's loss not mine. Basically the same reason I didn't buy the game through them, why should I need to launch a game through their app when there's an option to actually own it permanently?
you can still use zomboid without going via steam services wiith a simple command, plus you can also use mods outside of steam in steam servers you will just have download manually. the workshop is just a perk that will help you keep everything up to date. idk why you are mad, if you dont have the game via steam idk why the complain about wanting to use their service lol
I'm talking about uploading
I made the mods in question
All I'm trying to do is release my mods on Steam's platform so other people can use them.
chat
how would i
in theory
make it so that a custom recipe only uses up a bit of an ingredient instead of the whole item
like if i have a custom recipe that uses salt but i dont want it to use up the entire salt shaker
If I recall it's a semicolon (;) and afterwards a number, so for example:
Butter/Lard/Margarine;6,
alright great thanks
what about if the result of a recipe is liquid so i'd want it to be like that too, would i just e.g. put result:<resultname>;100,
I've personally never done that sort of thing before. I'd presume that'd work
alr
one last thing
lets say a recipe has 2 or more results
would it just be
result:<result1>,
result:<result2>,
or
I believe you need OnCreate recipes to have multiple items
alr
RemoveResultItem:True,
OnCreate:YourFunc
ladies and gentlemen, i dont know one single droplet of Lua
gonna have to learn now
ahh... okey
also
last question while you're here
what does Packaged = TRUE do for food items
Packaged
If this parameter is true, then the tooltip of the item will display the number of calories, lipids, proteins and carbohydrates.
this
ok cool thanks
couldnt find that site before
jeez thats gonna be useful
with lua script for predetermine parameters
alr
do i need the functions in a separate text file and then import them into the recipe file
should be in .lua on server folder
function Recipe.OnCreate.YourUnicName()
code stuff
end
alr cool
i know function shit just not the file location coz this is gonna be my first time coding in lua
im already pretty good in vb tho it cant be that hard
So... I made the bear trap an item. How would it make it to be able to be picked up and rotated? Also what would I need to do to make it solid like a wall
find it func by name in lua folder
u can use notebook++ for fast search into folder (and into every file)
yeah ik
I guess you have to make it a "Moveable" item
its an item type, similar to posters and mannequins
i know that stuff i just needed to know the file location
actually any furniture in the game i think
but its work with tiles
Right, I figure I need make it like.... say for example:
{
DisplayCategory = Furniture,
Type = Moveable,
Icon = default,
Weight = 0.5,
DisplayName = Modern Oven,
WorldObjectSprite = appliances_cooking_01_13,
}```
Where it has the moveable type. My question is where does it grab the ways it can be rotated from?
not 3d model items in world
but no furniture in the game is 3d ?
they are just sprites ?
or am i wrong
yep
i don't understand what do you mean im sorry
all moveables items - its tiles
tiles - its 2d sprite
item with 3d models dropped into floor look like 3d, but not have geometry
cant collide
etc
another items, not moveables
ohh i think now I understand.
when u try drop on floor moveable items it set u into placament state
where u place 2d sprite (tile) in world
tile has parameters like collide, etc
Does anyone know roughly how much it costs/how I'd go about commissioning a mod?
how much harder work 😆
I feel like it'd be pretty straightforward, but with no modding experience its hard for me to say
what special u want to create?
Essentially a mod that add 'favourites' to your character - either picked during creation or selected randomly. Things like fruit, snack foods, booze etc would have 1 or 2 selected 'favourites' that provide a much larger boost to happiness and drop in bordem when consumed than as standard, providing a cool midgame goal and fleshing out your character a bit.
@verbal yew does my function file need any of this copied into it?
coz my function and end things dont light up in blue (current function is there only as placeholder)
because your file is a .txt
good spot
drainable bottle?
what about if the result of a recipe is liquid so i'd want it to be like that too, would i just e.g. put result:<resultname>;100,
yeah but im thinking not in a bottle, just a standalone item like milk where if you drink milk you don't keep the carton
well i don't really want one coz the "liquid" item created doesnt need its own container
coz you'd just use it for the next recipe
Maybe im wrong understood
not sure
u want recipe, when result item not be full
this item contain liquid +-
the result item itself is a liquid, not a container of liquid
So Question, how does the game handle Mods spawning on firearms? Where is that code located?
Quick question, but is it in any way or shape possible to make a map/mod that procedurally builds itself using pre-made “building blocks”?
The basements in B42 will be semi-randomly placed, so I was thinking if it was possible to do something like that, but in a grid pattern, and on the whole map. This can be done either as you move (making it technically infinite?) or by loading the map once (making it finite, but still random every playthrough).
Has anyone successfully found a method to determine if a zombie attacks a player?
Seems like a weird question, but it also seems impossible. We use to have OnBeingHitByZombie but it was depredacated.
The mod "dangerous zombies" might have code for that.
Quite a few changes since this mods last update in 2020
Ill check it out though, thanks
What do you mean?
At least I think
If you haven't uploaded your mod to the steam workshop then it doesn't do anything and you can change it to whatever
Will uploading it give it a new ID?
Otherwise, it must be the same as the ID for the steam workshop item
Ah, gotcha.
Steam give you one, you change yours to the one steam give
Next question, is there a way to code in a set hotkey to perform a specific series of actions?
You can use on key pressed
@verbal yew for the custom function, what kind of filepath should i have for the function file
I have it as mods\ <modname>\media\lua\server
Is there anywhere I can see an example of that? I'm working with very limited java experience.
Errrrm I'm not fully familiar with pz I'm only doing factorio mods rn but I'll have a look at my pz code
I appreciate it.
yep
ping about result please
alr cool
rn i have a problem where if i try launching the game with the mod it just doesnt work so i cant even test my icons
gotta fix that now 
@verbal yew is this function missing any important syntax
every time i try loading the mod it reloads lua but never finishes, and then i can't relaunch the game unless i delete the mod from my game files
I managed to search for items in the player's bag containerplayer:getClothingItem_Back() but I can't find how I can search the player's other container like the Fanny Pack.
I tried to use getClothingItem_Torso():getInventory() But it seems it's not working
first line of PKCheeseExpandedrecipecode.lua has the word PKCheeseExpandedrecipecode with no '=' sign
why do you have that word?
i don't
it's the name of my lua file
tho maybe
just had an idea
i realise now
my lua file
has a module block
and an imports block
but now i think it might not even need it
so i got rid of those two
different now
crafting menu still doesnt exist
im deleting functions
If I set the type = Drainable how do I set the number of uses per item?
Isnt UseDelta for that?
functions have been deleted
think so yeah
Is that per each use, or total number of uses before the item is empty?
Or am I over thinking this, and as soon as it adds up to 1 it's used up?
To be honest im not so sure, youre doing food item or?
I'm doing a light source.
for example UseDelta = 0.003,
oil lamp shit or light bulb shit
its for Candle
So i assume its this amount from one per tic or whatever its called?
I want to make it five uses before depletion, so would that just be UseDelta = 0.2?
Uses?
Hm. I guess I should look at the code for food and aid items then.
oh nvm
it is uses
https://pzwiki.net/wiki/Scripts_guide/Item_Script_Parameters#Drainable @jolly niche use this as well, contains all available parameters for the drainable type too
i suggest this too
I keep forgetting the wiki has modding info on it, and spend thirty minutes searching the internet.
same
I don't want it to tick, I am trying to make it use the item on key press.
ok then probs use OnKeyPressed
Is there item like that either in vanila or modded?
The only item close to it doesn't do it the same at all, that's why I'm trying to make it how I think it would be used.
might be worth looking at this too
doesnt seem to have OnKeyPressed but if you look further on the wiki you'll probs find it
About it, wasnt it better to use addExtraItem instead?
is that a thing
https://zomboid-javadoc.com/41.65/zombie/inventory/InventoryItem.html#addExtraItem(java.lang.String)
Javadoc Project Zomboid Modding API declaration: package: zombie.inventory, class: InventoryItem
kERHUS told me to use the OnCreate function instead
Yes, use that function but instead of Add items just get AddExtraItem, i think it was used in some mod that made jars reusable, and recipe gave jar and a lid
but its fine i'll just use two separate recipes and have them just use 50% of the base ingredient instead of all of it
and one of those were added by OnCreate with AddExtraItem i think
if i get it to work in the future i'll update the mod
Can anyone help with restoring Hordes Alpha 0.5 (B41) ?
If I'm reading this right, using cantBeConsolided = false would allow me to take two similar items like Alcohol Wipes that have been used and combine them to make one fuller item. Or would I have to use the parameter ConsolidateOption to make the items combinable?
I'm trying to make a crafting recipe and zomboid keeps using:
{
DisplayCategory = Weapon,
MaxRange = 1.2,
WeaponSprite = Chainsaw,
MinAngle = 0.72,
Type = Weapon,
MinimumSwingTime = 3,
KnockBackOnNoDeath = TRUE,
SwingAmountBeforeImpact = 0.02,
Categories = Blunt,
Weight = 3,
ConditionLowerChanceOneIn = 70,
PushBackMod = 0.5,
SubCategory = Swinging,
ConditionMax = 15,
MaxHitCount = 1,
DoorDamage = 8,
SwingAnim = Bat,
CriticalChance = 35,
CritDmgMultiplier = 6,
DisplayName = Chainsaw,
MinRange = 0.61,
SwingTime = 3,
HitAngleMod = -30,
KnockdownMod = 0,
Icon = Crowbar,
RunAnim = Run_Weapon2,
BreakSound = BreakMetalItem,
TreeDamage = 0,
MetalValue = 150,
CriticalChance = 25,
CritDmgMultiplier = 3,
MinDamage = 0.6,
MaxDamage = 1.1,
BaseSpeed = 1,
TwoHandWeapon = TRUE,
WeaponLength = 0.4,
}```
When I want it to use
``` item Chainsaw
{
DisplayCategory = ToolWeapon,
MaxRange = 1.2,
WeaponSprite = Chainsaw,
MinAngle = 0.72,
Type = Weapon,
MinimumSwingTime = 3,
KnockBackOnNoDeath = True,
SwingAmountBeforeImpact = 0.02,
Categories = Axe,
Weight = 3,
ConditionLowerChanceOneIn = 70,
PushBackMod = 0.5,
SubCategory = Swinging,
ConditionMax = 15,
MaxHitCount = 1,
DoorDamage = 8,
SwingAnim = Bat,
CriticalChance = 35,
CritDmgMultiplier = 6,
DisplayName = Chainsaw,
MinRange = 0.61,
SwingTime = 3,
HitAngleMod = -30,
KnockdownMod = 0,
SplatBloodOnNoDeath = TRUE,
Icon = Chainsaw,
RunAnim = Run_Weapon2,
BreakSound = BreakMetalItem,
TreeDamage = 35,
MetalValue = 150,
CriticalChance = 25,
CritDmgMultiplier = 3,
MinDamage = 0.6,
MaxDamage = 1.1,
BaseSpeed = 1,
TwoHandWeapon = TRUE,
WeaponLength = 0.4,
DamageMakeHole = TRUE,
AttachmentType = BigBlade,
Tags = ChopTree;CutPlant,
WorldStaticModel = WorldItem_Chainsaw,
}```
___
```recipe Make a Chainsaw
{
Motor,
Chain=2,
PetrolCan,
SheetMetal,
MetalBar,
BlowTorch;5,
keep WeldingMask,
keep File,
keep MetalWorkbench,
Result: Chainsaw,
Time:500.0,
Category:Smithing,
Sound:Hammering,
SkillRequired:MetalWelding=9,
AllowDestroyedItem:false,
}```
Is what I have and the recipe is defaulting to the top one.
I tried the result as AuthenticZ.Chainsaw but that didn't work. Anyone have suggestions?
Im looking for the house alarm audio files but the ones used in game are not in the media sound folder, any ideas as to where they are ?
they're in the fmod soundbanks
the loose files in the sound folder are almost entirely unused
How do i open bank files ?
Probably need some speical software
Thanks anyways
i was able to adjust the watch alarm and the alarm clock alarm though
Just couldnt find the house alarm file
Thanks i was able to modify the file!
if i were looking to make an item mirror some vanilla item functions, where would i look to find how to implement those, and can a single tool act as multiple? think lug and screwdriver and wrench combined. i'm trying to make a multi-tool item from a show i like, and am using it to learn my way around the workflow.
I want to make additional attachment point at belt. Just visual adjustment, like AttachmentType Nightstick, Hammer, Meat Cleaver, etx.
Is there any good mods which I can look for?
Is ModData stored permanently only on server-side?
UPD No its stored permanently anywhere.
What exactly does changing the MinAngle stat of a weapon do exactly?
Based on the name I would expect it affects how wide I can swing my weapon to hit a zombie, but to what extent would say, if I were able to swing my weapon and hit a zombie even behind me, what value? That would be maximum usable value, anyhow.
Based on anecdotal observation and most weapon stats being under 1, hovering around 0.7,
I stopped here because I found a forum post from 2015 that seems to answer my question
Well, the answer isn't fully verified, but doesn't seem hard to test
yeah I'm not sure how exactly changing the MinAngle affects the weapon
The closer to 1 the lesser the angle you can hit player/zombie and same with green outline
So you have to be more precise with mouse in terms of aiming
Any ideas why OnFillWorldObjectContextMenu is listing the same tile multiple times in its worldobjects ?
Anyone know why there are two different addhole functions? Both used in PvP.
addHoleFromZombieAttacks & addHole
hi, im just getting into learning how to mod pz so i'm sorry about the possibly newbie question but how can i add a blacksmithing skill to make the vanilla smithing recipes tab useable?
I think there is already mod like that, you could take a look tho and implement your ideas
👀 i'll try to find it thank you
I set up some code for containers and created some objects that drain but neither is updating to other players on multiplayer servers. Is there something I am missing?
even on my test server if I load the box up with equipment and leave it all disappears when I return.
I verified in solo that it is not replacing it again but in multiplayer I see no errors
thank you for any feedback 🙂
Does anyone know roughly how much/how I would go about commissioning a mod?
At the bottom of mod page you will in most cases find Workshop ID : numbers
you copy those numbers, and go to your steam folder>steamapps>workshop and just Search fir those numbers in search bar

From Java:
if (this.ParentChar instanceof IsoPlayer && GameClient.bClient && ((IsoPlayer)this.ParentChar).isLocalPlayer())
A player can be both a client and local player?
Would be something like this in LUA:
if instanceof(player, "IsoPlayer") and player:getGameClient() and instanceof(player, "IsoPlayer"):isLocalPlayer() then
Does anyone know a mod that adds like currency and shops and lets you access it anywhere in the world?
bClient means 'is the current instance of the game a client process'
isLocalPlayer means 'is this IsoPlayer a player who is playing from this process'
Appreciate the clarity.
Trying to test a sound right now what would this section of code look like?
dude i was asking a question
and this was 3 months ago
I checked your activity before pinging. I don't see the harm in asking but no worries
Tried running this as a test and am getting no success, what am I missing
local function onKeyPressed(key)
--the says "Hello world" when pressing the Q key.
if key == 16 then
getPlayer():Say("Hello world")
end
end
Events.OnKeyPressed.Add(onKeyPressed)
This is being run in ProjectZomboid\mods\Test\media\lua\client\TestScript.lua the mod is on in game
Maybe it's overlapping with the yell? or 16 isn't Q?
I don't know how to check the keycode/ what keycode chart it is using to reference. I also don't know how to debug the code to see where it's failing. Any help would be appreciated.
Hello, good afternoon. I don't know if this thing that I'm going to mention exists or if someone is already working on it, but I would like to investigate and make a mod that allows you to use the fog shovel, to be able to remove or collect it. If it is not in development, and someone wants to work with me on this idea, we get to work. If it exists, and you can share the mod with me, I would appreciate it. I suppose it would be a similar mechanic to what happens with grass/dirt, which allows you to collect it in a bag. I don't know if that would be the idea, it is more than anything, to allow, in the winter, to clear the path a little. Thank you. https://pzwiki.net/wiki/Snow_Shovel
Ok a really important one.
How do you properly translate and return world coordinate to screen coordinate? Bunch of things I found in utils does not seem to work outside of mapAPI in the map itself and sometimes not even used anywhere, so probably not implemented.
Anyone?
screenToIsoX(playerNum, x, y, z)
screenToIsoY(playerNum, x, y, z)
oh the other way around, isoToScreenX/Y
Hello ! Can I use a lua mod to run code in C?
no

there are a couple languages that can be transpiled into lua but to actually run non-lua code would require hacking the game itself
can other players/zombies hear sounds played in character:getEmitter():playSound(sound)?
alright so, im planning to play a sound for all online players, so logically i don't want the player to hear the sound played for him and played for other nearby players, it'll create a very "unnice" duplicate effect, any way to do that?
playerNum is...? I might wildly guess something returned from IsoPlayer?
playSoundImpl is clientside, don't have specific information on whether character emitters are normally networked but other emitters are unless you use that one
yeah, if your mod doesn't support splitscreen you can just put zero
otherwise IsoPlayer:getPlayerNum() for the player whose screen you are trying to get world coordinates from
ok thanks
if you're using this for mouse input then the mouse player is always player zero anyway
Anyone have a way to legit duplicate/clone an item? I have tried a ton of things less manually going through every possible get/set function for all the possible item types.
If I could get an instance of a ByteBuffer in lua.. I could use the save/load methods.. but alas I dont seem to be able to get an instance of a ByteBuffer
that would be bad, they'd both have the same id
Thats easy to work around
function DuplicateItem(item)
local tempItem = InventoryItemFactory.CreateItem(item:getFullType())
local b = tempItem:getByteData()
item:save(b, false)
local newItem = InventoryItemFactory.CreateItem(item:getFullType())
local id = newItem:getId()
newItem:load(b, IsoWorld.getWorldVersion())
newItem:setId(id)
return newItem
end
This doesn't work
But it "feeeeeels close" lol
could just be an error
print(key) --then check a log file
-- or
getPlayer():Say(tostring(key))
How do remove a bandage from a character? The problem is that even with the bandage on, bleeding is applied, instead of removing the bandage and applying bleeding
local bodyDamage = player:getBodyDamage()
local bodyParts = bodyDamage:getBodyParts()
for i=bodyParts:size()-1, 0, -1 do
local bodyPart = bodyParts:get(i)
if tostring(bodyPart:getType()) == "Head" then
if tostring(bodyPart:getType()) == "Head" and tostring(bodyPart:bandaged())then
bodyPart:setBandaged(false)
bodyPart:setBleeding(true)
bodyPart:setBleedingTime(40)
else
bodyPart:setBleeding(true)
bodyPart:setBleedingTime(40)
end
end
end
Is exclusively modding serverside possible? Say I wanted to intercept text and only send to certain players etc. Can I do this without sending the client files, or having them uploaded to the workshop?
I'm using the OnCooked attribute on an item. The function so far is called correctly and my code is running.
My new item which I add to the container however disappears when I try to take it out of the container.
I use the following code to add the new item to the container:
container:AddItem(resultItem)
--container:addItemOnServer(resultItem)
container:DoRemoveItem(item)
--container:removeItemOnServer(item)
I experimented with the ...OnServer functions but I had no luck so far. I assume it's a client/server problem because the item is added on the server (at least thats how I understood it). The lua file is also in the /lua/server/ directory.
Can someone tell me how to do this correctly?
Edit: I forgot to mention that this happends when I Host a server. In solo it seems to work this way.
Do you guys see anything wrong with this?
I'm trying to replace sounds, but the sounds don't seem to be working
What am I doing wrong?
Maybe the --sounds_item.txt bit is breaking it. -- us used for comments in lua but that bit might need something like /*sounds_item.txt*/
Tried removing all the comments. That didn't work
Nerd
You could add tags to the items if the game checks item tags to decide if they can do the thing. Or you could do some Lua coding involving finding the Lua code about the things.
Maybe having media/sound in the file path is bad? (about sound)
"if" the game checks tags? So you're not a 100% on it?
it's supposed to, but sometimes it doesn't
you're safe for anything more recent, and most things have been updated to use them
I was looking at this mod as reference
It has media/sound/
But it also has the filetype 🤔 now that I look at it again
I noticed that farming mods don't work well on servers. In the sandbox, when you hover over a plant, the correct text is displayed, the sprites change correctly, but on the server everything does not work as expected. Has anyone had a similar situation and how did you solve it?
But I remember reading somewhere that with .ogg files I don't need to add the file extension?
Yep, adding the file extensions did the job
At the moment I'm out of ideas for my problem.
#mod_development message
Does anyone have a hint or know a mod/source which I can check?
I remember tags are used for some things.
Got my customizable RP skill levels trait released for some compatibility testing:
https://steamcommunity.com/sharedfiles/filedetails/?id=3061017102
you need to give more data: at least the whole OnCook function you made including its signature and tell in what folder you put it.
closest thing I found was https://steamcommunity.com/sharedfiles/filedetails/?id=2895419952 even though it does not do all the work for my own farming mod.
tags are a generic tool. the use of each vanilla tag is specific. and obviously if your add your own tag in a mod, you'll have to handle the consequences in the mod too.
Thanks a lot, However, can I ask one more question? It’s normal that in a single player game the mod works without problems, but when I launch it on the server problems begin
This is my current function:
function PotWithFishGuts_OnCooked(item)
print("OnCookedTest: " .. item:getFullType())
local itemModData = item:getModData()
itemModData.CurrentCookingTicks = itemModData.CurrentCookingTicks + 1
if itemModData.CurrentCookingTicks < itemModData.CookingTicksToGetFishOil then
item:setCooked(false)
-- Resetting the heat is needed because drainable items stop updating after the container temperature is reached
item:setHeat(1.61)
return
end
--local character = item:getPreviousOwner()
local resultItem = InventoryItemFactory.CreateItem(item:getModData().SoulModReplaceOnCooked);
--if not resultItem or not instanceof(resultItem, "DrainableComboItem") then return end
resultItem:setUsedDelta(item:getUsedDelta() / 5)
resultItem:copyConditionModData(item)
--resultItem:setPreviousOwner(character)
local container = item:getContainer()
container:AddItem(resultItem)
--container:addItemOnServer(resultItem)
container:DoRemoveItem(item)
--container:removeItemOnServer(item)
end
The file is located in the /lua/server/ folder.
your question is so abstract, I can only answer: yes.
Well, I can describe the problem in detail, but as I understand it, you have not encountered this, and I would not like to take up your time.
Are you sure of your use of setUsedDelta and getUsedDelta ? those are Drainable item only interfaces not InventoryItem's. also on discord, you can use '''lua<RETURN> --this formatting<RETURN>''' lua --this formatting by replacing ' by `
also the behavior you describe corresponds to item:getModData().SoulModReplaceOnCooked not being a full valid type
at your place I would print everything I can and check nil everywhere in the function
server is the place ! 🙂
the item that im cooking is a drainable item. And this part seems to work. The only problem I have is that on a Hosted Server the item that ist createn in the oven disappers in the client inventory on transfer. I also found out that I can directly "Place" the item outside of the container and it stays. When I pick it up afterwards it remains in the inventory.
I must be doing something horribly wrong. I added this to onKeyPressed and my player isn't saying anything for any key presses and nothing is being printed to the log in debug mode
You could print something outside of the function definition to see if the lua file is loading?
I want to make an item that's both a Screwdriver and a Wrench. So I'm hoping I can just tag the item as both and it'll work?
Nada. What could be causing my lua file to not load? The mod is enabled, and the lua file is in steamapps\common\ProjectZomboid\mods\modname\media\lua\client
the mods folder in ProjectZomboid is not usually loaded
mod not loaded, game not reloaded, semantic or execution error in the related files
use the one in %userprofile%/Zomboid/
That's the ticket, thanks. I was trying to figure out what I was doing wrong in the code all last night and it wasn't in the code. So frustrating.
Screwdriver, yes. but I do not recognise Wrench as a vanilla tag.
Well, whatever tag the wrench item has
there is no such thing