#mod_development
1 messages ยท Page 182 of 1
yay
I will warn you I don't deal with textures and stuff
so I might not be too much of help
I will still see what I can do tho
Here's the file if you want to take a look
I put together a resource based on whatever I picked up. Maybe you'd like to check it out, it's specifically for adding items to pz.
Thanks I will try again
i want an item to spawn on a certain group of zombies, where should I start?
Which item?
I have the outift already written in the zombiezonesdefinition, and the item is of my own
Checkout procedural distribution file, it has all the lists for different zeds and what to spawn on em
isn't that just for containers?
You add your item to whatever list you want
Nope, it's a different system groups items based on certain categories such as male zeds, female zeds, room types etc etc
Im looking at other mods, that have loot on zeds
says something abt suburbsdistributions
-- Zombie
table.insert(SuburbsDistributions["all"]["inventorymale"].items, "MoksFoods.MoksSkittles");
table.insert(SuburbsDistributions["all"]["inventorymale"].items, 0.02);
suburbsdistributions is proceduraldistributions, the table is registered under both names
I have designed some outfits for the player and zeds, but strangely, there's an item that doesnt appear when choosing the outfit on the character creation page, so I'm wondering if I can have this clothing item spawn on zeds another way
can someone explain what's going on here? I know it has to do with the context menu, but Im not sure what I did to break it. Context, I added recipes for a trade mod so I can have more trades/the trades that I want. and now it's giving me this error every time I right click on a radio or cash. anyone able to tell me what I need to do to fix it?
function: addDynamicalContextMenu -- file: ISInventoryPaneContextMenu.lua line # 2781 | Vanilla
function: createMenu -- file: ISInventoryPaneContextMenu.lua line # 699 | Vanilla
function: onRightMouseUp -- file: ISInventoryPane.lua line # 1444 | Vanilla.
[18-07-23 15:32:28.350] ERROR: General , 1689719548350> ExceptionLogger.logException> Exception thrown java.lang.RuntimeException: attempted index: getTexture of non-table: null at KahluaThread.tableget line:1689..
[18-07-23 15:32:28.350] ERROR: General , 1689719548350> DebugLogStream.printException> Stack trace:.
[18-07-23 15:32:28.351] LOG : General , 1689719548351> -----------------------------------------
therefore, should I add my outfit(which has its own GUID) somewhere? and then add the loot to that zombie type?
question
is it possible to mod the intro screen to play a sound when "These are the end times" pops up?
Please ping me for responses
this is from distribution file
i think this is the only way how they are spawning items on zeds, it's a nested inside all category
on clothing yes but to spawn an item on zed that's possible
Hey :) do you know how to use "burntTile" from https://zomboid-javadoc.com/41.78/zombie/iso/sprite/IsoSprite.html#burntTile
to ensure that it has the same name of the tile to avoid that it is burned ,
it is not an isoFlagType so impossible to do: ```lua
debug = {}
debug.OnObjectLeftMouseButtonDown = function(object, x, y)
print(object:getSprite():getName()) -- tyl_pnj_0 for example
print(object:getProperties())
print(object:getProperties():Set("PickUpLevel",tostring(1),false))
local sprite = IsoSpriteManager.instance:getSprite(object:getSprite():getName())
local props = sprite:getProperties()
print(sprite:getName())
print(props)
props:Set("burntTile","tyl_pnj_0") -- doesn't work not isoFlagType
-- or
props:Set("burntTile",tostring(object:getSprite():getName()))
end
Events.OnObjectLeftMouseButtonDown.Add(debug.OnObjectLeftMouseButtonDown)
if there's no setter it's not possible
fields can be read directly with some weird code but writing to them isn't possible outside of debug mode
Ah :( thank you... well we will have to overwrite the file newtiledefinitions.tiles
Sorry but what is lootzed?
it's something you can turn on in the debug cheats menu, while it's active you can right click on a container's icon to open a menu that'll show you its distribution tables and true item spawn chances
Anyone?
I noticed the evolved recipe bit and wanted to see if I could poke at that so I stole these two from scripts/evolvedrecipes.txt
What does the :4 mean on the evolved recipe line in the cocacola item?
(it's a copy from popbottle)
it uses 4 hunger from the item
Oh ๐
How do other mods keep their sandbox options formatted nicely? I'm attempting to add them to one of my mods, and I've got them showing, but they always format to "Sandbox_ComfySleeping" instead of just "ComfySleeping"
Format in sandbox-options.txt seems to be the exact same as other mods with sandbox options..?
you need a translation file
Thx, I'll take a peek at some translation files from other mods and take another crack at it
Thanks, had a try but it doesn't seem to do anything no matter what I click over the container icon (unless I am clicking in the wrong spot?)
It is
You just have yo replace the ui start audio
Can you share what you wrote so we can help?
you're right clicking right? oh and i don't think it enables until you close the cheat menu after ticking it
I can't fully grasp what isogamecharacter is or what it does. Could somebody explain it for me?
here it is, I put everything I added at the end, all I did was copy one of the previous recipes and just edit the relevant values and names.
I think its your module
Inside ISInventoryTransferAction:transferItem does anyone know if there is a way to see if the item was moved inside a tile container?
Like, I know I can check if it's a vehicle by doing this instanceof(self.destContainer:getParent(), "BaseVehicle") but how do I check if it is a tile?
Items are
Base.Apple
CustomMod.CustomItem
Yours is
Game Buddies.Item
Theres a space
okay, so to fix it, I would just get rid of the space then?
Ye
cool

yeah Im just editing dingo's trade mod (revised) so Im working off of someone else's work lol
Is there anything special to how I put an evolved recipe in? I can't seem to make my cocacola able to be poured into a cup
EvolvedRecipe = CokeCup:4;CokeCup2:4,** already made that change
Alright found it self.destContainer:getSourceGrid()
where and how
Iโm sorry, but can I ask you to show me which space I need to remove in the code? I have a feeling I have to do this multiple times across all the files from the original mod Iโm editing but Iโm not entirely sure which space or spaces I need to remove
Sure
Module
Ah okay, so it should look like, Trade.guns, or something along that line then?
So just replace module with a trade and remove the spaces then. Got it. Thanks for the help!
Which is this, the encircled thing
I mean you made it
Buddies Guns
You can just
BuddiesGun
Ah okay got it
Or you can keep that base
Cuz you only wrote recipes
using base is bad practice
Iโm just editing the work of two previous people for my own entertainment. So im just winging it lol
recipes don't suffer from conflicts as badly as items but they still do
Does anyone have a reference to a good way to connect a timed action to an object so that you can 1) right click on it in your inventory and then 2) click a context menu item and 3) call a function from that click? I was trying out the Events.OnFillInventoryObjectContextMenu.Add() event but it seems to trigger on any right click in the inventory (when the context populates), I would like to have it only trigger on a certain item, but I don't have a reference to what was clicked on when using that event. I also am not quite sure how to actually fire a function from the click on the context menu. - Any guides or anything out there?
the event passes a table of selected items, you want to check if your item is in that table (or if it's the first entry, depending on how exactly you want it to be have)
is that table the second variable called "context"?
it should be the third, 'items'
if you're looking at the wiki it might not be named the same way
but only the order matters anyway
ok cool, they are calling it worldObjects, I will give that a shot
local player = getPlayer()
local chancetodie = ZombRand(6)
if chancetodie == 5 then
local bodydamage = player:getBodyDamage();
local b = bodydamage.getBodyPart(Head);
b:setDeepWounded(true);
end
end```
It says that the line with ```local b = bodydamage.getBodyPart(Head);``` made an error. "Expected a method but got a function" any ideas?
So what, I should just get rid of the
Imports
{
Base
Bits then?
call it with : not .
how about actually clicking on the button that was added? Do you know how to call a function from that selection choice after it has been added to the context?
you should keep the import, what glytch3r is suggesting is to put your recipes into the base module directly which is really bad practice
It's me again, I managed to fix the icon but it has weird colors. How can I fix that ?
is your item configured to have different colours? it's probably tinting the icon because of that
Hello name-brother
in your screenshot, even the 'missing icon' icon is tinted red
so i think that's probably it
Ok I will try to fix that but I have an other issue
There is still no item description
i think that means the clothing xml is missing or has an error
that's not really my area unfortunately
Oh ok I tought it was only to show it on the caracter/on the ground
still giving me this error
function: addDynamicalContextMenu -- file: ISInventoryPaneContextMenu.lua line # 2781 | Vanilla
function: createMenu -- file: ISInventoryPaneContextMenu.lua line # 699 | Vanilla
function: onRightMouseUp -- file: ISInventoryPane.lua line # 1444 | Vanilla.
[18-07-23 18:06:07.264] ERROR: General , 1689728767264> ExceptionLogger.logException> Exception thrown java.lang.RuntimeException: attempted index: getTexture of non-table: null at KahluaThread.tableget line:1689..
[18-07-23 18:06:07.264] ERROR: General , 1689728767264> DebugLogStream.printException> Stack trace:.
[18-07-23 18:06:07.265] LOG : General , 1689728767265> -----------------------------------------
STACK TRACE
i'm not sure it is the module's fault, iirc the game doesn't really do any checking of module names and anything is technically valid (if bad practice)
usually when that happens it means an item that doesn't exist is being referenced by a recipe
usually a typo
Sweet got it, I just had some parameters switched around on the item there that was causing me trouble. I learned something from the fact it did not throw an error so thats a win.
sometimes it's an error in the item script but your mod doesn't have any custom items right?
nope, I know it's referencing from Brita's weapon and armor mods, but I don't remember it adding anything
Ye
Maybe one of his item isnt base
And he didnt wrote the module
oh great so now I have to go dig up both brita mods' item lists and check all the recipes the mod adds lmao
have you imported the brita module? or used the full type in the reference?
as far as I can tell brita just uses Base lol
oh yeah...
If I need a UUID for my item, do I just choose randomly ?
yeah, you can generate one online
Ok thanks
setBulletLodged(true);
So I know that BulletLodged isnt the correct term, but what is? For example
setDeepWounded(true);
would work
setHaveBullet(boolean haveBullet, int doctorLevel)
I think I found the broken entry, the original mod adds in a recipe to trade money for a glock 17, but as far as I can tell from the two item lists Brita included with their mod, the G17 is not an actual item.
you can find the methods listed here https://projectzomboid.com/modding/zombie/characters/BodyDamage/BodyPart.html
ugh i retract my statement, I found an entry for it in Arsenal(26)
if you're in debug mode you might be able to see the name of the erroring item in the debugger
ill give it a shot
Anyone have a math brain? I need some help with a problem that's been haunting me for a while
i've been writing some weird algorithms recently, hit me
it might have the name of an item in the locals
the website says this is how you set up "setHaveBullet"
public void setHaveBullet(boolean haveBullet, int doctorLevel)
b:setHaveBullet(haveBullet(true), 0)
Would this work?
it would just be b:setHaveBullet(true, 0)
I found it, it's this Bag_Smersh_Vest, this is not an item. the item it's referencing is actually, Rig_Smersh
my head hurts now
okay. My tooltip rewrite for food is almost done. However, adding a gui for my changes to food has exposed an issue:
These are two seperate tooltips: both are affected by the same trait.
The problem here is, the boredom and happiness isn't getting worse when the food is worse for a player. it gets better
it gets better in both cases
local newFoodHungerChange = (foodHungerChange + (foodHungerChange * statModifier));
local newFoodThirstChange = (foodThirstChange + (foodThirstChange * statModifier));
local newFoodEndChange = (foodEndChange + (foodEndChange * statModifier));
local newFoodStressChange = (foodStressChange + (foodStressChange * statModifier));
local newFoodBoredomChange = (foodBoredomChange + (foodBoredomChange * statModifier));
local newFoodUnhappyChange = (foodUnhappyChange + (foodUnhappyChange * statModifier));
local newFoodCalories = (foodCalories + (foodCalories * statModifier));
``` here's how I calculate these new values
"good" stat modifiers are positive decimals, "bad" stat modifiers are negatives
(sorry, just wanted to get my explanation in as few messages as possible)
when the unhappy change is already negative, you're multiplying it by e.g. -0.2, which makes it positive again
Yay my gloves are working ๐ฅณ
does lua have math.absolute?
it do
you can multiply the stat modifier by -1 when the base value is less than zero
I know what it is. Britaโs Armor pack updated this year and this mod was written last year. So it has a lot of items with old names
a caution about the math library: it's ridiculously slow
e.g. i reimplemented math.min and found it to be ~11 times faster
since most of the common ones are very simple i recommend just writing the logic yourself
in the statsapi repo there's a file that reimplements the ones i've had to use so far, it might be nice to reimplement the whole math library like that
this freakin file is the issue, its referencing the old version of Brita's Armor pack. im not gonna fix it, I don't even care about these recipes, so guess who's just gonna delete it and see if that fixes the error Im having
is it possible to overwrite a mod's modoptions? you can't 'replace the file', as new options will just get stacked under the previous set of ints, bools, strings, etc
do you mean sandbox options or the mod options mod?
sorry, sandbox options
hmm, honestly unsure, it'd probably have to be done through lua rather than something more elegant
So my code works and it makes my character both get shot and bleed, but they got shot in their left hand rather than the head.
local player = getPlayer()
local chancetodie = ZombRand(6)
if chancetodie == 5 then
local bodydamage = player:getBodyDamage();
local b = bodydamage:getBodyPart(Head);
b:setHaveBullet(true, 0);
b:generateBleeding();
print ("You should be shot in the head now")
end
end```
try local b = bodydamage:getBodyPart(BodyPartType.Head);
thx
player:setOverallBodyHealth(5) I feel like im missing something
well I am bc the game says its an error
that method is on BodyDamage
but it doesn't matter, that setter doesn't actually work
the overallbodyhealth gets recalculated every frame by the java, so changing it from lua doesn't really do anything
so. What am I supposed to do to make my health go down?
you can do something like
local bodyDamage = player:getBodyDamage()
bodyDamage:ReduceGeneralHealth(95)
im using this website for information. https://projectzomboid.com/modding/zombie/characters/BodyDamage/BodyDamage.html#setOverallBodyHealth(float)
declaration: package: zombie.characters.BodyDamage, class: BodyDamage
I am confused on the purpose of floats and booleans, what do they do?
I've probably used them in the past and just don't know it
booleans are true/false, floats are decimal numbers (as opposed to integers which are numbers without decimals)
it's a bit weird to use since lua doesn't have types in the same way java does but kahlua generally converts things forgivingly
Yo albion, I gave up on the idea of using VSCode after taking a peek on IntelliJ.
Oh boy I fell in love with it
i'm with a bit of trouble in setting up my environment,
and was thinking if maybe you could help ๐
sure, what issue are you facing?
well, a few...
ruh roh
I've noted them here
So, my questions are:
- The PZEventStubs typings are not working at all. I've set Umbrella as a Global Library on my project. Candle and PZLuaStubs are working fine, just the events are not.
- I have a utils file that stores some functions I use through out the mod, is there a way I can set these functions to auto-complete (ctrl+space) on other files too?
- Can IntelliJ identify what object is in a variable to get it's methods? eg.
getPlayer(): <-- shows only methods available in IsoPlayer
forgot to say, some questions are related to umbrella
hmm you're not the first person to face that first issue, but we never worked it out before either
3 implies to me that candle isn't working either
yeah, when I do IsoPlayer. it only shows it's variables, not it's methods
atributes*
yeah, in that case you'd be accessing the static
but getPlayer() isn't suggesting the instance methods? that's weird
nope
@bronze yoke , thank you. This has been frustrating me for.... months now lol
Only these are suggested
are you using the emmylua plugin?
what I did was open my media folder as a project andUmbrella folder as a External Library (or Global)
tried a lot of different things but none of them worked =/
i'll try to get that version
yeah, that should be perfect
i wonder why mine seems to be older, it's not offering me to update or anything
Maybe the IntelliJ version?
I use the community edition
donwloaded it yesterday
I'll try a reinstall in emmylua
hmm yeah, i do use the professional version or whatever they call it
well, reinstalled it and didn't work ๐ฆ
I don't know if there is a way to get that older version is it?
Which attachment corresponds to holding items?
i'll see if it lets me install the community edition at the same time and i'll see if i see the same problems
uh okay
I don't want to give you any extra work 
I've broke my head a lot last night with this, was about to accept it
well if it turns out umbrella doesn't work on community edition that's a pretty huge issue to me, nobody involved wants it to be paywalled
Oh...
but that is very weird isn't it?
after all isn't emmylua that is working behind the scenes
honestly your screenshots don't even look like my ide so maybe the difference is larger than i think
Well, when I oppened it, I got asked if I wanted to change to the "New UI"
I enabled it to see if it changes something
Before enabling, was not working either
I need an opinion on my russian roulette game. I have it set to where if the person shoots themself, they have a few seconds of life before their lodged bullet wound kills them. However, if they have a high enough first aid skill, and they have all proper medical supplies on them, they can heal themselfs a split second before they die. Should I keep it like this or should losing the russian roulette game be a guarunteed death for all?
it seems like my version of ultimate is fairly outdated actually, i thought it had an auto update
but umbrella has worked for a lot of people so i'm not sure that should be causing it
yeah, it doesn't work for me in community either
yeah. very weird
maybe their version also is outdated?
Did you manage to get the Community edition installed and also not worked?
yeah
so yeah that relieves me
I didn't do something stupid
but makes me kinda sad ๐ฆ
Hope it's not something very hard or difficult to solve
10% of people who sustain a gunshot to the head live. also maybe it should take lucky/unlucky into account
Looks like it took a lot of work to get it going, just to get randomly stopped by a update
Good point.
does this version of emmylua even have autocomplete for standard lib?
what do you mean? like, Lua's own functions?
yeah, i'm not getting any
it seems to give up after one 'layer'
it can point me to math/table/even stuff like Events etc but it won't point me to the functions inside them
me neither
Uhhh I see where you are getting
like, it can find a table, but not what is INSIDE it, right?
makes sense
Also makes sense with the autocomplete with my own functions is not working
as far as i can tell newer emmylua versions literally just do not function properly
it might be caused by some big idea changes or something
yeah, tried a lot here and got nothing
it seems like a newer idea version redid how the intellisense works and they're struggling to catch up
So, even if I got your version of emmylua, will probably not work too
because my idea is too new
yeah, you'd need a 2022 build it seems like
hmmm, I'll try to get around with it
maybe I can download that version somewhere
will this I have a utils file that stores some functions I use through out the mod, is there a way I can set these functions to auto-complete (ctrl+space) on other files too? also work if I have the working version?
or I have to do some trickery
that should work by default
okay
found a 2022.3 build, I'll try it and see if it works
i'll feedback here later
Thanks in advice anyway ๐
Was very helpful
sorry for all the work 
as much as it pains me i'll have to start recommending people to use vscodium instead 
Good day to you people :)
I'm using OnFillWorldObjectContextMenu event to check for a certain world object in case it was right clicked, and I set some of its moddata accordingly. I just found out this moddata isn't saved, so once you restart the game, said moddata are gone. Any idea what's causing it and what other approach should I use?
well im storing an inventory item in the moddata if that's any relevant
oh, it is
you can't store objects in moddata, objects are inherently not persistent
no objects or functions
sooo what's a good way to temporarily remove an object from a user's inventory and "add it to the worlditem stored info", and be able to retrieve it later?
i'm not sure if there is one, maybe you could create an inaccessible container for the item...?
otherwise you'd be stuck serialising every field of the object and then reconstructing it
Ugh seems like a lot of extra unnecessary work. Will try to think of another approach to do what I am trying to do
237 votes and 16 comments so far on Reddit
Well shucks
Every map mod will need to be reexported
@bronze yoke IT"S WORKING YEAAAAHHH
really thanks for the help
I installed build 2022.3
let's gooo
noice
Now you can recommend it again to people instead of VSCode 
Got it from here: https://www.jetbrains.com/idea/download/other.html
If other people want
i'll note that down
I actually just had to switch a "=" to a "==" and delete a space
we ballin
what are the major benefits of intellij over vscode?
what is vscode and intellij?
I'll try installing the older version + emmylua to get the typings goings but
they are ides
i just find jetbrains ides a lot more comfortable and powerful
it also helps being in a java ide when you're going through the java
the tradeoff is that emmylua is not nearly as good as vscode's lua extension
do I seperate my numbers with "or" or do I use ","
if deathroutes == 0,1,2,3,4,5,6,7,8,9 then
or
if deathroutes == 0 or 1 or 2 or 3 or 4 or 5 or 6 or 7 or 8 or 9 then
if deathroutes == 0 or deathroutes == 1 or deathroutes == 2 etc 

you can simplify it a bit with a lookup table```lua
local allowedDeathroutes = {[0] = true, [1] = true, [2] = true, [3] = true, [4] = true, [5] = true, [6] = true, [7] = true, [8] = true, [9] = true}
if allowedDeathroutes[deathroutes] then
it also runs a bit faster
Im still confused on the timed action only popping up for when you right click certain items
I have ISInventoryPaneContextMenu.lua opened
I skimmed over it and I am trying to make it work but the code confuses me
soo did more testing. It doesn't seem like even a simple bool can be saved in the moddata of a world item
that can't be right
function Frogshire.addFrog(player, frog, frogshire)
local playerObj = getSpecificPlayer(player)
local invent = playerObj:getInventory()
if Frogshire.getSex(frog) == "Male" then
local maleFrogIsTamed = Frogshire.isTamed(frog)
local maleFrogName = frog:getName()
local maleFrogSex = Frogshire.getSex(frog)
local maleFrogDateFound = Frogshire.getDateFound(frog)
local maleFrogLastFed = frog:getModData().Frogshire_lastFed
local maleFrogLastTameAttempt = frog:getModData().Frogshire_lastTameAttempt
frogshire:getModData().Frogshire_maleFrogExists = true
frogshire:getModData().Frogshire_maleFrogIsTamed = maleFrogIsTamed
frogshire:getModData().Frogshire_maleFrogName = maleFrogName
frogshire:getModData().Frogshire_maleFrogSex = maleFrogSex
frogshire:getModData().Frogshire_maleFrogDateFound = maleFrogDateFound
frogshire:getModData().Frogshire_maleFrogLastFed = maleFrogLastFed
frogshire:getModData().Frogshire_maleFrogLastTameAttempt = maleFrogLastTameAttempt
else
--Same snippet but for females. Removed due to character limit
end
invent:Remove(frog)
end```
if frogshire:getModData().Frogshire_maleFrogExists then
removeMaleFrogOption = subMenu:addOption("Remove Male Frog", player, Frogshire.removeMaleFrog, frogshire)
else
addMaleFrogOption = subMenu:addOption("Add Male Frog", player, Frogshire.addFrog, maleFrog, frogshire)
if not canAddMaleFrog then
addMaleFrogOption.notAvailable = true
end
end```
so, I add male frog, go to main menu and load the world again, I don't have the prompt to remove the frog, and instead a prompt to add a new one
So would I have to copy the entire ISInventoryPaneContextMenu.lua file to make my context menu only work for specific items?
no, you can just use the OnFillInventoryObjectContextMenu event
alright that finishes most of the coding
how do you make animations for zomboid?
I actually have experience in animation and editing so this should hopefully be good for me
i guess if no one here knows, #modeling ?
I'm still trying to nail down the OnFillInventoryObjectContextMenu
Somehow my file just got deleted
nvm I got it back
roulettecontext
end```
So that is my script
and zomboid says it expects a "=" near the "end"
any idea why?
require 'ISUI/ISWorldObjectContextMenu'
ISWorldObjectContextMenu.fetchSquares = {} --Add or remove this line depending on your need
myMod.myFunction = function(player, context, items)
print("hello!")
end
Events.OnFillInventoryObjectContextMenu.Add(myMod.myFunction);```
That should be an easier way to do it
thank you
you can name your function whatever, doesn't have to be in same exact way as I provided
My pleasure :)
yes. In my function I name it Frogshire.InventoryContextMenu = function(player, context, items)
but it can be anything, like just myFunction
I just prefer the first approach because it gives me more freedom in case I need to use the function somewhere else, and I kinda got used to it. Just, in case you decide to use it, make sure to initialise the table
So could it look like this
ISWorldObjectContextMenu.fetchSquares = {}
RussianRoulette.inventoryfulfilled = function(player, context, items)
print("hello!")
end
Events.OnFillInventoryObjectContextMenu.Add(RussianRoulette.inventoryfulfilled);```
Yes, but you'll have to initialise the RussianRoulette table
require 'ISUI/ISWorldObjectContextMenu'
RussianRoulette = RussianRoulette or {}
ISWorldObjectContextMenu.fetchSquares = {}
RussianRoulette.inventoryfulfilled = function(player, context, items)
print("hello!")
end
Events.OnFillInventoryObjectContextMenu.Add(RussianRoulette.inventoryfulfilled);```
so assume your mod contains a lot of functions, and you may or may not want to use those functions across different files, or different variables, etc
in this case, you'd do a RussianRoulette = RussianRoulette or {} at the top of each file that your mod uses (and needs such functionality), and whenever you're adding a function, you define it as RussianRoulette.functionName, that way its saved in that table and can be easily called from elsewhere. You probably wouldn't need that with your event function but its a personal preference for me that I got used to it
That's actually pretty cool
may as well use modules at that point
true
they run faster and pollute less
But the issue is still there. I don't understand the proper way to use OnFillWorldObjectContextMenu
OnFillWorldObjectContextMenu is basically an event that is called when the world right clicks somewhere in the world. When we want something to happen at that event, we define a function for it and add it to the event. So, suppose I want to print a test statement when a player right clicks on the world
RussianRoulette.myFunction = function(player, context, worldobjects, test)
print("test)
end
Events.OnFillWorldObjectContextMenu.Add(RussianRoulette.myFunction);```
honestly speaking I am not sure what the test parameter does but its there in some vanilla code, and used in the function as if test then return ISWorldObjectContextMenu.setTest() end
but its irrelevant here so might as well just remove it
Oh wait a minute
I am talking about OnFillInventoryObjectContextMenu
I am sorry
I am trying to make it to where you right click an item you have and it gives you a context menu option
haha its the same logic here, just replace the naming of event and parameters
I already have the context menu set up, I just want it to only appear when you click the proper item
Frogshire.InventoryContextMenu = function(player, context, items)
-- Iterate over the items and add a context menu option for each one
for i, v in ipairs(items) do
local item = v
if not instanceof(v, "InventoryItem") then
item = v.items[1]
end
-- Only add context menu options for Frogs
if item:getType() == "Frog" then
--rest of your code
that's a snippet from a mod im working on
just edit as needed
what do I fill the "context" parameter with? do I fill it with the context menu I set up?
you can use context:addOption() function to add the menu you set up
how would i put multiple items in the "items" parameter
do you have an example of how it's done through modules?
for example
firstOption = context:addOption("First Option", parameterToPass1, functionToExecute, parameterToPass2)
secondOption = context:addOption("Second Option", parameterToPass1, functionToExecute, parameterToPass2)```
is that " ` " purposefully at the end of the first line?
nope was a mistake, removed haha
-- shared/MyMod/MyModule.lua
local MyModule = {}
-- add stuff to the table as usual
return MyModule
-- in another file
local MyModule = require("MyMod/MyModule")
-- use the stuff in the table
imma try out my own script rq
Hmm I see, that runs faster because it don't mess with the global environment right?
yeah!
so like this @hollow current
local secondOption = context:addOption(player, roulettecontext, Revolver_Long)```
Cool!
I'll try to implement it on my files
I don't need to specify if it is in the client/server/shared folder?
hmm not quite. You failed to define the text that'll show on the buttons
if I want a button that has a text of "Button 1", and when clicked, it calls "myFunction", and passes to it the parameters "player" and "frog", the code would be:
local firstOption = context:addOption("Button 1", player, myFunction, frog)```
local secondOption = context:addOption("Play Russian Roulette",player, roulettecontext, Revolver_Long)```
yes looks alright, assuming the roulettecontext is a defined function that takes two parameters
how would I make it take two
function roulettecontext(player, revolver)
print(player)
print(revolver)
end```
okay
what exactly are you trying to do? Maybe I can assist you better
Im making a russian roulette mod. I have suceeded in making a context menu and a timed action that caused a person to die. My issue now is that I want the context menu option to only appear when right clicking on a revolver
just edit the item:getType() accordingly to check the item that is being right clicked here, and add your context options
what is "i" and "v" in that code
would this work
-- Iterate over the items and add a context menu option for each one
for i, v in ipairs(items) do
local item = v
if not instanceof(v, Revolver_Short) then
item = v.items[1]
end
-- Only add context menu options for Frogs
if item:getType() == Revolver_Short then
--rest of your code```
the i represents the numeric index of the item (since we're looping over the items table)
v represents the actual item
so would my code work?
and no this most likely won't work cause first:
if not instanceof(v, Revolver_Short) then
You should be checking for InventoryItem instance (or whatever instance the object you're looking for is, but most likely will be InventoryItem). It's not something unique for each item
albion can I ask something rq
sooo what's a better approach?
just using a for loop
btw its getting late so im going to bed after this question
for i = 1, #t do
v = t[i]
end
```is the exact same as ipairs
but runs faster
with how slow kahlua stdlib is it can be more significant than you'd think
I see. Idk why i got used to the ipairs practice, maybe some initial copy-pasting when i first started modding lol
earlier, you had said to use OnFillInventoryObjectContextMenu for what I wanted to do. I do not get how it works. I looked at it on the main site.
-- Your code here
end
Events.OnFillInventoryObjectContextMenu.Add(OnFillInventoryObjectContextMenu)```
this is the example it gave
I do not understand the example
yeah, the wiki is really just showing what an event looks like and not how to use this specific one
So how would I use OnFillInventoryObjectContextMenu to make my context menu appear when I right click a specific item
the usual method is to check if your item is in items, then add your option to the context menu which they seem to have called table
Do you have an example of this I could use?
i do but i can't get it right now unfortunately
๐ฆ
understandable
I wont bug you about it lol
but quick question
am I required to use the parameters in OnFillInventoryObjectContextMenu?
Or can I just leave it as ()
Late reply, but feel free to message me with any questions that you may still have.
you're not required
by the way, I solved this by, instead of getting/setting moddata of the worldobject, i used worldobject:getItem():getModData() first
my assumption is that worldobjects' "unique identifiers" are dynamic between each world restart
ohh, is the world object a dropped inventory item??
i didn't know those behaved differently but i wouldn't've been so adamant that it should work if i knew that
erm yes
my bad, should've probably clarified further haha
thanks for your attempt to help though. Much appreciated :)
I need a piece of code executed with a delay, for example 10 seconds. It's related to networking, and I want to avoid a race condition with the required data arriving after the trigger(sandbox options, patching a method that sends them to server and want to make sure I update my lua table with those AFTER they arrive at the server, not before)
If I can ask, what background do you have in coding various things? I'm trying to just be aware of how to work all the lua stuff because I'm aiming for a small server but I'm legit on the edge of my seat watching the russian roulette stuff shake out. I've got some crappy HTML experience and a close friend that's talked java into my ear for a few years, but nothing else
Core of my first mod is done, thanks for the helpp
Time to make it pretty
that was it lol, closed it and it worked
Reason: Bad word usage
I am still not really getting how it determines where an item should spawn tho ๐ฆ
Is there a function to check how much rounds are in magazine?
No, i mean like code so i can get ammo count from magazine and use that for something i work on. My goal is to create recipe that as a result has magazine that is fully loaded already - for flamethrower so i dont have fire"bullets" in my inventory and have to reload that flamethrower tank each "fire bullet" at a time.
Definitely, check around player coords and look for the tile/isoObject, check if its a door and there you go.
Ty
IsoObject:
https://projectzomboid.com/modding/zombie/iso/IsoObject.html
it has a method of getType(), which is one of:
https://projectzomboid.com/modding/zombie/iso/SpriteDetails/IsoObjectType.html#doorW
declaration: package: zombie.iso, class: IsoObject
declaration: package: zombie.iso.SpriteDetails, enum: IsoObjectType
And theres IsoDoor for further methods, https://projectzomboid.com/modding/zombie/iso/objects/IsoDoor.html
declaration: package: zombie.iso.objects, class: IsoDoor
But what exactly is object? Is it anything above tile or cell?
or using XYZ with IsoGridSquare (https://projectzomboid.com/modding/zombie/iso/IsoGridSquare.html)
declaration: package: zombie.iso, class: IsoGridSquare
^ wrong link, corrected it
Ty for the resources
IsoObject is like the base class for everything, furniture, containers, windows, doors ...
yeah, and if you want just the door then you can do IsoDoor and pass IsoCell into it
I'm assuming I can grab cell once I have the player.
not sure what you will get by getCell on player but worth trying
you can get player X,Y,Z then iterate in X-5, X-4, ...,X+4, X+5, same with Y and Z checking cells if they are doors
maybe there is a smarter way to do this
aight
https://steamcommunity.com/sharedfiles/filedetails/?id=3006716277 Added Features to a mod
your FPS ^ if misused
Probably should have asked this way earlier but how do I know what should be written where
those sure are words
Like, if I run door:setLocked(false) for a vehicle, should it be for the server, or client, or should i just throw it in shared
I guess it should be serverside
because you'll need the server to know "that car" is locked
if you run it on client i'm not sure it will be locked for other ppl
Not always, because the door:toggleDoor() syncs with server on the java-side code
I use it on client for example
The best way to figure things out really is testing 
lack of proper documentation really sucks lol
Yeah 
Asked albion that same question a few days ago, and she told me that there is even client side code on the server folder ๐คทโโ๏ธ
I'm going to be 100% with you. This mod is my first ever real try to code. I have coded small scrips in the past with basic variables but coding with zomboid is my start.
I know that makes it hard to explain stuff to me but so far I would say i've come a long way with my code especially since it's my first time.
Looks like we are in the same situation
I did have an html class before and had to code a website but the class was crappy
Me jumping from a project that has libraries with stellar docs to this feels like stumbling around in the dark w
What are ipairs?
Would this code work in checking my inventory for a revolver?
if Revolver.isInPlayerInventory() then
Add(roulettecontext)
end
end```
@covert carbon i found a Russian roulette mod on the zomboid steam workshop, it might be worth subscribing, and taking a peek at, to see how it was done over there
I would but at that point it feels like im copying the mod
Im fine with looking at other mods unrelated to russian roulette
nah you'd probably want
function inventoryCheck(IsoPlayer, weapon)
-- inv check
if (IsoPlayer:HasItem(weapon:getStringFullType())) then
-- code to add item
local inventory = IsoPlayer:getInventory();
inventory.AddItem(weapon:getStringFullType());
end
end
or something like this (edited .add -> .AddItem(...))
What is isoplayer? I never fully understood it
its like indie stones contanier for a player
its what they pass around for most of their events and functions related to player characters
https://projectzomboid.com/modding/zombie/characters/IsoGameCharacter.html#HasItem(java.lang.String)
declaration: package: zombie.characters, class: IsoGameCharacter
you can call those methods using the : operator
alright thank you
There's something in programming called 'inheritance'.
for example, Animal -> Mammal -> Dog
It's the same for player. IsoObject -> IsoMovingObject -> IsoGameCharacter -> IsoLivingCharacter -> IsoPlayer
you may need to mess with the code a bit to get it to work but that example should work otherwise lol
how could i make a teleportation system to items like this
It is done in Battle Royale mod
how could i
quick questions how are all the different functions for any action are called? I see the function definition but not sure how it's being called upon
IsoGameCharacter update ticks and calls them through the java action object.
One is called from AnimEvents
a few from the action queue, but those are mostly inherited and never changed.
this section should tell you what the room name is and what distributions can spawn in that container
im trying to make an addon to true music, but the youtube video im following is out of date, since then the link on the true music steam page has changed from a google drive to a yandisk, anyone know if theres a way to find the original google drive?
What is the simplest and mod-compatible way to add text to an item's tooltip?
oh oki i just saw those class files, btw then the only way i interact with anything in-game is through events then?
would if Revolver:isInPlayerInventory() then work?
Greetings! When editing the spawnpoint.lua files, do I have to specify occupation spawn points? I'd like the pool to be the same no matter what without having to copy and paste the list for each occupation
could try and print in console
i think it falls back to unemployed?
not exactly sure but the vanilla spawnpoints files don't list every occupation
so it must fallback to something
i was asking if events is the only way to interact with game?
good observation, i'll give that a try. ty albion!
you can call the java api in any function, doesn't have to be attached to an event
events are just triggers
so if there was a function to build doors i can call it from say my lua function, is that what you mean?
sure
wait nvm thats a stupid question
I see, is it possible to see where kitchen spawns on the map, like the x and y coordinates?
?
-- Add a context cption
local option = context:addOption(getText("ContextMenu_Play_Russian_Roulette"), player, russianroulettegame)
end
function inventorycheckupx()
if Revolver:isInPlayerInventory() then
Add(roulettecontext)
end
end``` Could someone tell me if I made a mistake with this?
That would be a mapping question. Pretty sure almost all houses have a kitchen.
The context menu option will no longer pop up even when my inventory does have a revolver
https://www.reddit.com/r/projectzomboid/comments/sxyfzs/pzmapcom_interactive_map_and_loot_visualiser/
This doesn't seem to work anymore. ๐ฆ
Yeah that site was really useful that's why I am trying to figure it out myself, the owner seems inactive
you dont pass Revolver to your second function
what do you mean?
how does your second function know what Revolver is?
You can make a map but you will still need something to read it?
I thought that it was defined as Revolver in the item_weapons file
Revolver is a variable here
or atleast will be treated as such
a variable which has no value will cause you errors
right, i didn't think about it that way game also depends on events to trigger anything apart from something that happen regardless of input
so how would I define Revolver as the revolver weapon?
i dont know if this ok but smth like this could work
local Revolver = InventoryItemFactory.CreateItem("Base.Revolver")
if Revolver:isInPlayerInvenory() then
--here your code
given it will only check for the base game revolver
would local Revolver = Base.Revolver work?
I thought the question was about actions at first? Timed actions and UI don't exactly use events, they have a lua table from which specific functions are called from java side.
no
Also scripts in multiple places have global functions that are called by name.
why wouldnt it?
lua cant access stuff that is defined in the .txt script files
you'd need to pass it through certain constructors to get a reference to those items but not those items themselves
hence the InventoryItemFactory
Where can I find a doc for InventoryItemFactory? I know pz has a site for lot of its code, is it in there?
Javadoc Project Zomboid Modding API declaration: package: zombie.inventory, class: InventoryItemFactory
another bookmark in the endless series of bookmarks
i was looking at actions when i asked that questions as most files were only declaration of all sorts of function and because i wanted to see if there's any file or whatever exactly calling these functions. Idk much about how stuff works so mostly just exploring to get somewhat idea of what moves what.
How hard would a mod that makes you get knocked out from car crashes be
how can I mod the startup audio?
It wouldnโt be for long
where do I look and how do I start
i don't think they're aiming to create an item
Looking thru pins
It seems like being knocked out for too long would result in zombies just killing you
But it would be funny to get knocked out long enough to get a near death experience
So again, how hard would it be to make players that experience car crashes get knocked out for an in game 5-10 minutes
Honestly if someone were to do that, it would be suitable for other injuries too
Does Add(roulettecontext) work when I want to execute my rouletteconext function?
Like when someone experiences a lot of pain, they can go into shock and, ultimately, pass out
sound fun
injuries that make you "knocked out" and status effects that make you dizzy.
Dizzy would walk in wrong direction, fall and perform weird actions ๐ค
Are there still no mod yet to add npcs on MP? Really like the Superb Survivor but me and my brother plays together
I canโt really develop mods but how long would something like that take you
npcs can't be rendered in multiplayer
I wanna commission someone to make 2 mods I had ideas for
it just can't be done right now
Yeah. I notice that qhen I added the mod in MP. You can see the name but the model doesn't render. I guess it all goes down to PZ Team if we will be able to have it in MP
@fast galleon do you take commissions
you could ask on that server https://discord.com/channels/136501320340209664/1125248330595848192
It's been three days of coding I might give up if this doesnt work
This look good? ```local function OnFillInventoryObjectContextMenu(playerIndex, Play_Russian_Roulette, items)
local roulettecontext = function(player, context, worldobjects, test)
-- Add a context cption
local option = context:addOption(getText("ContextMenu_Play_Russian_Roulette"), player, russianroulettegame)
end
end
Events.OnFillInventoryObjectContextMenu.Add(OnFillInventoryObjectContextMenu)
Events.OnFillInventoryObjectContextMenu.Add(roulettecontext)
Is there an event for when the server fills a player owned container after a server restart?
you should read about scopes, etc
https://www.lua.org/pil/contents.html
Alright I will. Thank you
Honestly there is a lot of lua stuff I haven't learned yet. Probably good to start there
Does anybody reccomend anywhere I could learn java that would help with modding?
Java is not needed for modding pz
some functions you need here: getSpecificPlayer(playerIndex):getInventory() then you'll need to check if you have the specific item you want.
So all of this I wrote is all lua?
https://github.com/FWolfe/Zomboid-Modding-Guide
it's Kahlua with PZ API
Thank you for all of this help
I'm probably going to take a break with modding so I can focus on actually learning some stuff from coding I missed
Probably return in a few days
{
recipe Make a Frogshire Pond
{
Stone=15,
BucketWaterFull=2,
Result:Frogshire,
time:50.0,
Sound:EmptyPan,
}
}```
Any idea why this Recipe is created immediately?
also why isn't the BucketWaterFull being "used up" when the recipe is created, i didn't add the "keep" keyword o-o
@covert carbon is that a Russian roulette mod in the making?
Taking a break. I realized I am super underprepared to do coding so I am taking some lessons before I continue
Should be ready to come back to the mod in a week. Sorry to disappoint
Is this a personal idea or did someone ask you to make it
It sounds like a cool idea
Always wanted a way to bet in Project Zomboid
And this would be to ensure that no one โcheatsโ
It was a personal idea of mine
I liked to use zomboid mods and one day I was just "lets try it out"
oki solved the buckets issue but still idk what's causing it to be created immediately
quicker as in a second irl? or just instantly
instantly
I double checked my cheats, and I have them turned off
that happened with me when i set time to 5 units but doesnt seem to be like that in your case
@hollow current
Capitalization
it was at 10 first, bumped to 50 and same result so idk
oh.
righttt
lol thanks
recipes are the only case sensitive script format 
? anyone know this
New WIP mod!
Storage upgrades!
is IsoCell representing complete map? or just a small portion on it?
does anyone know what the isRemoteZombie property in IsoZombie is referring to when it says "remote"? does that mean out of the rendered chunks or am I misintepreting it?
declaration: package: zombie.characters, class: IsoZombie
it means it belongs to another client
zomboid's networking distributes control of the zombies between the clients to save server performance and to reduce perceived lag
zombies usually belong to the client they're currently targeting
thank you!
I have a context menu that comes from OnFillInventoryObjectContextMenu.Add that I have been able to get to behave how I want. When I click it I would like to run a function or a timed action (I am doing both for different things). Does anyone know the mechanics of connecting something like this to a context menu? It seems to me that the context menu itself is a table that might have somewhere to put that in the table itself, but I am unsure where. Any ideas or reference docs?
OHH this makes a lot of sense now, that's why me and my friends always think that zombies are in different places
Thought that was a lag issue 
How can I add an item as loot from a zombie ? Are zombies in the ProceduralDistributions file ? I can't find them
When exactly do you want the option to show?
the event you said is triggered when the user right-click something in the inventory panel
You just create a new timed action instance and then add it to the queue
Simple as that
I have that part working just fine, but I am unsure how to actually have something happen when I then click on the option.
I see that using ISTimedActionQueue.add but I am not sure how to trigger this when someone clicks on the context menu option that was added.
well, you set that up when you create the option in the first place
function ISContextMenu:addOption(name, target, onSelect, param1, param2, param3, param4, param5, param6, param7, param8, param9, param10)
this is from the ISContextMenu.lua file
Nice! Thanks, that is what I was looking for
onSelect then is the function you want to pass?
Ohh wait, no
Yes it is
when addind a option, the onSelect param is the function you want to execute
BE CAREFUL when setting up the function
Okay, let me double check here
you wanna add item on zeds?
because the first param that the function receive is the target param
then after is param1, param2 and so on
(I made that mistake myself
)
Yeah I want to add more loots to some of them
i think its in procedural distribution file inside all{} table
should be something like "malezombieinventory"
try male
no results for male and inventory
Okay so am I understanding right that you need to pass this 4 parameters instead of 3? name, target, function, firstParameter - I had been passing three, and the function is firing on the right click before clicking on the added option, is that because I am missing the parameter?
let me check
So this should fire when I then click on the button, but not when I right click in the inventory menu right?
the only real param you NEED to pass is target
yes
I probably misunderstood the part about the "all" table I guess
but I don't find it
I've never seem a option trigger instantly when you rightclick
Okay I will need to revisit my code. Right now the function passed into onSelect is firing on my right click in the inventory menu. Then when I click on the option in the context menu, nothing happens. There must be some issue with how I am calling it.
mb it was in distributions file
Events.OnFillInventoryObjectContextMenu.Add(functionHere) - is what I am using, then in that function I am running local option = tbl:addOption(getText("Action Name"), player, functionHere(player))
What is the difference between the 2 files ?
tbl:addOption(getText("Action Name"), player, functionHere(player)) here is the problem
you're passing functionHere(player)
should be functionHere
ahh yep thank you
well procedural one prepares different sorts of list, distribtuion ones actually spawns items in these lists
got it, yeah I have run into this one before in LUA I forget about that sometimes
when you put the () there, you are calling it
thats why it's running when you rightclick
probably on events, I did that on the first time too 
So then the param1 param2 param3 is the send parameters to taht function since you cant (call it in here) right?
yes
In roblox actually haha
If I want to add something to this tables, do I just use this ?
table.insert(Distributions.list["Place"].items, "NewItem");
table.insert(Distributions.list["Place"].items, Probability);
if your function is
funtion something(player, door)
end
you need to do addOption(optionName, player, something, door)
i havent tried it but should work yes, dont forget to do require WorldItems/Distributions at top
ok thank you
also try not to name your file same as vanilla
uuh was not expecting that 
okay got it, I understand the flow now I think. I am going to spent some time on this. Thank you @cobalt fiber @neon bronze
you're welcome 
Yeah I know I added a prefix to all my files
haha me either... but If you know some LUA it is where to make the $$ 
Not sure if anyone would be willing, I need someone to look over my lua script and help me figure out what's wrong with it ๐ญ I've been STRUGGLING XD
I have to use the item name in the spawning option not the "clothingItem" thing right ?
Is there a reason you don't use Notepad++?
I use it actually but it's not set as defaut so rip
aahh okay, lol
and I think you should send your LUA code so someone can look at it even if you're not there
Yeah, I was making sure there were no similar threads.
hello. It's me, the lurker.
So I've got a question: Is it possible to lock certain vehicle skins behind a sandbox option?
Events.OnInitGlobalModData.Add(function()
if SandboxVars.STEV.VCars == true then
ScriptManager.instance:getVehicle('CarNormal'):Load('CarNormal', '{skin {texture = vehicles/vehicle_rosewoodpolice,}}')
end
end)
This seems to return a big fat "Texture not found!" in the log when I change the vehicle's skin to the added one (it gives me the option), but doesn't tell any info on what the unfound texture is.
Is there a reason why putting the tag FishingSpear on a non spear weapon turns it into a regular fishing rod?
So, I'm attempting to make a mod that, among other things, adds in several items in order to perform blood transfusions and blood draws that give/take health.
I would like to be able to give/take blood from other players and/or myself.
The main thing I'm struggling with at this time is getting my custom UI menu options to show up.
I'm brand new to modding, so I've gotten some help from a friend named ChatGPT to use as reference, but it seems like the advice it's giving me is straying further and further away from a success.
What do you guys use for texturing UV Maps?
there's GIMP
If you're just doing basic painting you can do it in blender itself
in order for me to get square, i need x and y coords. Is there a way to grab em maybe something related to player can help?
How do I run a script in notepad++ without using zomboid? I am testing out code but it isnt for zomboid
you'll need a lua interpreter installed on your machine
Would it be any bad if I were to use an online IDE?
Any IDEs will work
alright thank you 
I'm having issues creating a drainable item from a bag that has more than one texture choice. I have the bags as written below. When I add both in debug the dirt bag is missing an icon and when I try to drop it on the ground it throws an error: ISDropWorldItemAction.lua line # 62 (and # 67) attempted index: getWorldItem of non-table: null I think the game is struggling with my dirt bag having IconsForTexture Does anyone have ideas why this item fails but other new items without IconsForTexture work?
item Bag_Schoolbag
{
DisplayCategory = Bag,
WeightReduction = 60,
Weight = 1,
Type = Container,
Capacity = 15,
DisplayName = School Bag,
IconsForTexture = Backpack_Black;Backpack_Blue;Backpack_Spiffo,
CanBeEquipped = Back,
OpenSound = OpenBag,
CloseSound = CloseBag,
PutInSound = PutItemInBag,
ClothingItem = Bag_SchoolBag,
BloodLocation = Bag,
RunSpeedModifier = 0.97,
AttachmentReplacement = Bag,
ReplaceInSecondHand = Bag_Schoolbag_LHand holdingbagleft,
ReplaceInPrimaryHand = Bag_Schoolbag_RHand holdingbagright,
WorldStaticModel = SchoolBag_Ground,
SoundParameter = EquippedBaggageContainer SchoolBag,
ReplaceTypes = "DirtSource Bag_Schoolbag_Dirt"
Tags = _EmptySolidContainer,
}
item Bag_Schoolbag_Dirt
{
DisplayCategory = Bag,
Weight = 1,
Type = Drainable,
UseDelta = 0.26667,
DisplayName = School Bag of Dirt,
IconsForTexture = Backpack_Black;Backpack_Blue;Backpack_Spiffo,
RunSpeedModifier = 0.97,
ReplaceOnDeplete = Bag_Schoolbag,
ReplaceInSecondHand = Bag_Schoolbag_LHand holdingbagleft,
ReplaceInPrimaryHand = Bag_Schoolbag_RHand holdingbagright,
WorldStaticModel = SchoolBag_Ground,
SoundParameter = EquippedBaggageContainer SchoolBag,
Tags = _DirtContainer,
}```
Aah yes yes seรฑor Gravestench Oppenheimer yes yes it making sense yes yes
getWorldItem of non-table: null usually means it's failing to find an item at some point
yeah. ๐ฆ I'm just not sure what I'm missing because the game clearly knows it exists. I know if I remove the IconsForTexture and just assign a standard Icon value it works.
But I can't figure out how the default multitextured bags work to replicate the behavior such as hiking bags, tinted duffle bags, and obviously this school bag.
What?
Also, idk why this comes up as blood_transfusion.lua.txt but itโs definitely just xxxxx.lua maybe itโs just my phone ๐คท๐ผโโ๏ธ
I made a function and added it to the OnFillWorldObjectContextMenu event. Apparently, it works only in debug mode. Any idea why so or what may cause such behavior?
if instanceof(object, 'IsoWorldInventoryObject') then returns true in debug mode but not in "none debug mode"
Edit:
When right clicking the item in debug mode (an item dropped on ground), its detected as IsoWorldInventoryObject, however, when debug mode isn't enabled, its detected as just IsoObject. This is causing errors in my code logic
Edit2: as a matter of fact I don't think the item is being detected at all. IsoObject is being printed regardless of where I click
Any idea how to fix that?
Can you share your code here?
ah right mb
Frogshire = Frogshire or {}
Frogshire.Pond = function(player, context, worldobjects)
local frogshire
local playerObj = getSpecificPlayer(player)
local invent = playerObj:getInventory()
for _, object in ipairs(worldobjects) do
if instanceof(object, 'IsoWorldInventoryObject') then
--rest of code
end
Events.OnFillWorldObjectContextMenu.Add(Frogshire.Pond);
yes if I make it a simple print statement it gets printed in the console
the issue is that IsoWorldInventoryObject gets detected when im in debug mode
but if i login without debug mode and do exact same thing, its not detected
And player is an number?
should be, but its irrelevant here. Both local playerObj and local invent were added for testing the issue but you can consider them not in the snippet of the code
What exactly are you trying to achieve with that snippet?
I am trying to check if the player right clicks on a specific object that is dropped on the ground
the object is an item that is added by the mod
Cant really help you with that but it would maybe better to check their item type instead of checking whether they are an IsoWorldInventoryOnject
Almost all items on the floor are that so it would be redundant to check for that
yes well, after I check for IsoWorldInventoryObject I check for its type, the issue is its not even being detected in worldobjects
if I loop through worldobjects and print each object, its not there
Maybe try right clicking around it? I know the cursor is a bit sensitive about it
Tried that too
the game is just apparently not detecting any kind of IsoWorldInventoryObject-s at all
anyone know how to fix massive muzzle flash? search topic has something but instructions hugely unclear
and or move the damn muzzle flash?
which coord changes y Level?
Iโm still looking for help if anyone has any advice โบ๏ธ
Should this remove all spawns of those items?
RemoveItemFromDistribution(ProceduralDistributions.list, "308Clip", nil, true);
RemoveItemFromDistribution(ProceduralDistributions.list, "44Clip", nil, true);
RemoveItemFromDistribution(ProceduralDistributions.list, "45Clip", nil, true);
RemoveItemFromDistribution(ProceduralDistributions.list, "9mmClip", nil, true);
Has anyone found a solution for when you spawn a custom zombie on a server and they are deleted with the "removing stale zombie 5000 id=" log? I'm trying to fix Soul's Turning Time mod. In SP it works but on the server they are deleted.
I do not know the mod so I may be mistaking, but the problem looks like the zombies are spawned client side. if so then spawning them server side could solve the problem. (please note the many conditional)
They are spawned server-side, only that the mod is compatible with 41.73, and should be completely rewritten.
PZ has not changed that much between 41.73 and 41.78.16
If anyone knows how to grab x and y coords of player? I wanna grab square grid in order to get hold of door or if there's any other way to grab nearest door?
:getX() and :getY()
ty for some reasons it didnt work earlier
finally i was able to figure out player tile, might need to play with it further in order to grab a door if its there
Does anyone know diff b/w IsoChunk and IsoGridSquare?
Special infected?
does anyone know of a mod that increases the max level beyond 10 for any given skill?
Hey. Whenever build 42 comes out can someone make a black powder firearms mod? That would be super sick to craft and use.
is this correct way to check if an object is not an instance of a class?
You need to put ~ infront of iinstanceof
ah oki, ty
jsut to be clear ~ means not right?
Yes its the not operator in kahlua
the list of detected items is different in debug mode
never found out why
doesn't seem to be any checks for it or anything, likely a bug
i solved it by getting the square from the first object that was found, and then looping through that square's object list
function ContextMenu.OnFillWorldObjectContextMenu(player, context, worldObjects, test)
local objects = worldObjects[1] and worldObjects[1]:getSquare():getObjects()
for i=0, objects:size()-1 do
local object = objects:get(i)
```etc
im trying to work with squares as well, is there a way to grab a group of squares surrounding say a current square(IsoGridSquare) or do i have to get hold of next square in the direction i want?
you have to grab the squares manually
Is there a distribution list or something indicating what zombies can be wearing ? Cause I know where their inventory is, but it doesn't include their clothing.
that's in the clothing xml
this is incorrect, not is the not operator
~ doesn't have any meaning outside of ~=
I am actually stupid
for functions we use functionName:methodName() but how do we get properties/fields of any objects? is there dot operator here as well
Hello. Could someone help with sandbox settings? I've made that If sandboxsetting box is checked , it removes vanila guns spawns
RemoveItemFromDistribution(Distributions[1], "Pistol", nil, true);
and all other guns this way aswell
end
And it does work when creating save and playing untill you restart game, then it uses default setting (which is: sandboxsetting unchecked). Using mod to change sandbox settings they still are what they're supposed to, but as said above, they do use default settings, and turning them back on and off does nothing. Its my first time trying to those settings and im not sure what to do.
the syntax is absolutely insane and requires multiple function calls and some loops
i made an api that lets you use them in the intuitive way (object.field) https://steamcommunity.com/sharedfiles/filedetails/?id=3001901955
keep in mind fields cannot be written to outside of debug mode
my api doesn't support it anyway but keep that in mind
sweet, thanks
Yea additionally you can store that in a variable to access some functions from that file
Im not 100% certain how exactly that works but you can do that
ah oki got it
that should be correct
in the case of my mod you don't need to store it since it doesn't return anything
it just needs to be required to ensure that it runs before your file does
makes sense
for some reasons it's not updating the northEastSquare even tho you can see in the object stack it's there and on the right hand side is how i tried to access it.
if there is a file named AccessibleFields.lua under media/lua/client (or shared or server) then yes.
oh wait might have to restart then i think
unless you use Albions' mod you should not be able to access directly java classes parameters
yes im using their mod called AccessibleFields
Not sure on that, but you can just use:
local northEastSquare = square:getAdjacentSquare(IsoDirections.NE)
declaration: package: zombie.iso, class: IsoGridSquare
wow that should work, let me try
it works, today has been very productive. And yall been a lot of help, without any insight it almost feels like you're in the dark. Appreciate it๐
Does this look correct for creating a custom context menu option? Or am I v dumb.
*the indentation on this is messed up, but itโs correct on my pc. This is just how my phone decided to indent it.
i would suggest copying the code and paste it here if you can. it's hard to read it like this.
Also if you do paste try to wrap it inside a pair of three backticks(`),makes it nice and easy to look at ๐
Lmao itโs still all indented wrong ๐
I sent the actual file last night, but itโs the full code.
How do I change zombie clothing ? I know I need to use both clothing.xml and fileGuidTable.xml but that's about it
calling functions without brackets works fine in lua right?
without brackets?
like functionName() or functionName both works?
functionName() calls the function, functionName passes the reference to the function
there is a niche case where functions that take one string argument and nothing else can be called as functionName "foo"
ah oki so not cool unless there's one arg
and it has to be a string
and it can't be a variable either... it's very niche
print "bar" -- this works
local bar = "bar"
print bar -- this doesn't
best to avoid it then until im comfortable with lua
yeah, probably best practice overall to not randomly have different syntax
i like using it for requires but that's it
Okay, I'm home from work and on my pc now. Also, it still requires ISUI/IScontextMenu, it's just up at the very top of the full script
if not targetPlayer or not targetPlayer:isPlayer() then
print("Invalid target player")
return
end
if not transfuserInv:contains("FBGEmptyBloodBag")
or not transfuserInv:contains("FBGiv")
or not transfuserInv:contains("FBGivTubing") then
-- print("You need an empty blood pack, a 20g IV needle, and IV tubing to perform the blood draw")
return
end
local option = contextMenu:addOption("Perform blood draw", transfuser, function()
PerformBloodDraw(targetPlayer)
end)
end
-- Function to show the context menu option for the blood transfusion action
function ShowTransfuseBloodContextMenu(targetPlayer)
if not targetPlayer or not targetPlayer:isPlayer() then
print("Invalid target player")
return
end
if not transfuserInv:contains("FBGFullBloodBag")
or not transfuserInv:contains("FBGiv")
or not transfuserInv:contains("FBGivTubing") then
-- print("You need a full blood pack, a 20g IV needle, and IV tubing to perform the blood draw")
return
end
local option = contextMenu:addOption("Perform transfusion", transfuser, function()
PerformTransfusion(targetPlayer)
end)
end
Events.OnFillWorldObjectContextMenu.Add(function(_player, context, worldobjects)
if instanceof(worldobjects, "IsoPlayer") then
local player = getSpecificPlayer(worldobjects);
if player and player:isAlive() then
ShowBloodDrawContextMenu(player)
ShowTransfuseBloodContextMenu(player)
end
end
end)
local player = getSpecificPlayer(_player)
if player and player:isAlive() then
AddContextMenuOptions(player)
end```
omg idk why my file that was supposed to load along iwth client files has disappeared, didnt change much folder is still there and mod is active. Except some changes inside the lua file.
How would I go about making custom double doors? Would it be along the same guide line as dirk's tutorials or is there a certain way to do it?
it's all under control now
might be too exhausted to see what i changed, worked earlier but not anymore.
where does Player come from?
didnt change anything in this one
maybe the save is corrupted or something, ill load another one.
yep
loaded another save and it worked
ripped apart all of the functions i wrote, it's always the restart no sometimes you just have to press the button and pray to lord xd
Doors built by players don't fall into isoDoor? im able to destroy already exisitng doors but not much luck with the ones i built
Maybe IsoThumpable ?
For "Gate" doors built by the player it is at least
like this?
oh i forgot to call it properly i think
ill take a break and work on this later
@frail violet
You're Senor mister Gravestench Oppenheimer right? aka senor Fring, aka Senor Salamanca, aka senor taco, aka senor burrito, ...
How do you get the player index? would this not work?
local playerIndex = player:getPlayerIndex()
player:getPlayerNum()
it says "attempted index: getPlayerNum of non-table: null"
how would I do that
Negative
is there a way to find out what object is this? it's just throwing bunch of errors in my code
i think they mean is your player variable visible to where you calling it or is it local to specific function
The function gets called before my player spawns in the game. Good catch, I will fix that
Does PZ care if a localization is declared but is never used?
no
Cool ty
Follow up, is there anything like https://pzwiki.net/wiki/Scripts_guide that goes into more detail about what the translation system supports? Or do you think I'd have to crack open the game's jar to figure that out? All I know is that it supports <br> , I don't know if the modules can have any logic or other markdowns.
i'm not sure if i've seen anything like that, maybe there'd be more information on the translation github repo or in the translation channel in this discord
Thanks, I'll check those out!
i think <BR> creates a bigger newline, and there's also <LINE> which i think literally creates a line...?
and then you can use %1, %2, etc if you need something to be inserted into the string
https://pzwiki.net/wiki/Modding#Localization has a section on localization but its only encoding and character sets
this will probably be all I need, it already seems to answer a lot of the questions I have. Thank you!
Oh wait, never mind.
ye its not much loool
as to actual mark down, you may have to experiment or look at base translations
i don't think i'd've ever worked out <BR> and <br> did different things
I tried looking at a few mods that were translation key pair heavy, like More Descript Traits, but seems like they only utilize br
I'm hoping I can color the font somehow. Its gotta be possible because the text renders blue for mod names.
oh yeah i've done that before, let me check how that's done
<RED>
i'll try and find where these are defined
trying to work out what colours are supported would be a nightmare
yeah
I wouldn't mind whipping up a wiki page and passing it over to Aiteron to add to their guides. Already so much useful information there.
do you think its the colors listed here? https://projectzomboid.com/modding/zombie/core/Colors.html
Red is listed
try some other wierder ones, like <LIME> or <Lime>
theres some lua code called ISUI/ISColorPicker but idk if that is relevant
yeah dead end
i honestly don't even know where to start to look for this
i was hoping it'd be hardcoded literals since they're easy to find
it doesn't seem like the Colors class is involved
unless all ui goes through the chat code since that's the only place it's used
I wonder if Badonn knows
weren't they trying to add custom colors on world init, and also doing stuff with tool tips?
that... actually seems less crazy than it sounds?
i found a whole bunch of clearly related literals in there
and nowhere else
oh
actually it seems to be working backwards, this can generate those tags
i see
it implies the existence of a <SIZE:num> and an <RGB:r,g,b> (i think i've seen this one before)
I have been summoned
Hey Badonn, weren't you trying to do stuff with tooltips and custom colors? we're trying to figure out some localization tag stuff, have you delved into that at all?
tho maybe it might've been solved by albion
I was trying to do stuff with tooltips and custom colors! Dunno about localization tags though, i've not heard that term
its for different languages/translations
I actually completed and finished that tooltip rewrite. Thanks @bronze yoke @sour island
noice
Just a couple of examples with different traits and some vanilla thrown in
<LINE>, <BR>, <H1>, <H2>, <TEXT>, <CENTRE>, <LEFT>, <RIGHT>, <PUSHRGB:r,g,b>, <POPRGB>, <RGB:r,g,b>, <RED>, <ORANGE>, <GREEN>, <SIZE:small/medium/large>, <IMAGE:? this one looks complicated>, <IMAGECENTRE:? also complicated>, <INDENT:num>, <JOYPAD:complicated :(>, <SETX:num>, <SPACE>
when i have a bit more energy to research the specifics i'll write them up as a guide on github
Iโve realized my fatal flawโฆ I could be wrong, but this isnโt working because you cannot right click on yourself, so no context menu will populate at all, much less one with my custom options.
Iโll test with another player tomorrow ๐ญ๐ญ
i didn't have this issue when i did something similar
one issue i did find was that you have to click on the square the player is on, but about half of the player model is going to be hovering over another square because of how tall it is, which doesn't work, so i think i had it search multiple squares
I need to use a server host to do some beta testing of my mod--anyone know of cheap and quality hosts?
oh I'm so sorry I got distracted by zomboid.
check out albions post there\
<IMAGE:texture_path> or <IMAGE:texture_path,width,height>. Same for IMAGECENTRE. <JOYPAD:button> also accepts width and height, but instead of a texture path it accepts a button name (as defined in Joypad.Texture). There is also <KEY:binding_name>, which is replaced with the key set for a binding (+ surrounded by colors with push/pop rgb)
I imagine Joypad:button is for like "Press ๐ฆ to eat"
So that localization will pull the emojis for the controllers in translating
Yeah, shows an image just like the IMAGE one (but of buttons)
I'm curious what the difference between <PUSHRGB:r,g,b>, and <RGB:r,g,b> is
PUSHRGB pushes a color onto a stack, which can be popped with POPRGB
oh i see, key is handled separately from the others
So it'll only apply to the text between those commands
I became unfortunately very familiar with that file while doing chat stuff
Thank you all, this is super helpful.
Mods going to be literally 1 line of code but hey, gotta start somewhere.
Greetings guys, do you have any idea on how to make a script that only allows you to enter a vehicle only if you have a specific item in your inventory? And where should I put this script?
You will need 2 things
A checker function
That just checks your inventory for that item
And to hook on how vanilla handles the vehicle enter action
@ancient grailAnd the lua file would go in the client folder,right?
Yes
thanks!
You cant click yourself
But you can click on other player
That's how I solved it as well, thanks :)
any idea what the test parameter is here?
myFunction = function(player, context, worldobjects, test)
if test then return ISWorldObjectContextMenu.setTest() end
end```
and what is setTest()
Is it possible to give vehicles custom animations? (not asking how to animate or model, just if it's possible and how i'd go about coding it
Tto get the seat the player is sitting on,should I use onSwitchVehicleSeat?
Hi, quick question.
I want to view .pack file, make changes and repack as mod.
TileZed 32 / 64 is not responding when i am trying to view ui2 pack.
There is any another way to do that nowdays?
You are probably using the wrong version
Not sure if thats the correct one, thats the lates I have downloaded and it works
@worthy sparrow thank u so much. I was using latest version from forum https://theindiestone.com/forums/index.php?/topic/35239-latest-tilezed-worlded-and-tilesets-april-7-2021/ that i found from og post about tile editing
Tiles Tileset images For Windows TileZed + WorldEd 32-bit TileZed + WorldEd 64-bit The 32-bit version of WorldEd seems unable to load all the tilesets due to high memory usage, displaying ??? for some tiles. Linux TileZed + WorldEd 64-bit This was built on Ubuntu 20. TileZed changes: BuildingEd: ...
hmm i also thought that I will be able to edit default items icons from this app but it looks like nah.
no problem, I found that this one is the latest: https://theindiestone.com/forums/index.php?/topic/50425-latest-tilezed-worlded-and-tilesets-march-14-2022/, anyway i was struggling like you when i wanted to get all the item icons
Tiles Tileset images These are the same tilesets released on February 16. For Windows TileZed + WorldEd 32-bit TileZed + WorldEd 64-bit The 32-bit version of WorldEd seems unable to load all the tilesets due to high memory usage, displaying ??? for some tiles. Linux TileZed + WorldEd 64-bit This ...
You would have to edit them in some external program, export them from the UI.pack and just modify individual ones, then .pack them together
I am trying to play an animation in a timed action, like so:
self:setActionAnim("Bob_IdleLowSneak")
I think I might be doing something wrong cause it shows the "surrender" animation instead, any idea why's that?
@worthy sparrow ah yeah. Do you know maybe that I can use bigger images than 32x32 for items images to achive bigger resolution?
Anyone down to help me make a mod for a tiktok. Itโs a animation mod and Iโm new to making mods for PZ but I need tiktok content. We can chat and maybe do like a virtual smoke sesh while making it I had to call off work and have time to use later
Yo @mellow frigate no way ur here I love ur mods G if youโre the dude Iโm thinking of
it defaults to surrender because Bob_IdleLowSneak is not an ActionAnim keyword, it is an animation. you need to use the PerformingAction trigger associated to the ActionAnim instead. look in the according xml file for what is in the place of 'TheValueYouAreLookingFor' <m_Conditions> <m_Name>PerformingAction</m_Name> <m_Type>STRING</m_Type> <m_StringValue>TheValueYouAreLookingFor</m_StringValue> </m_Conditions>
thx mate have fun
Thanks!!
how to check players inventory for a welding torch?
What if the file doesn't have the "m_StringValue"?
<?xml version="1.0" encoding="utf-8"?>
<animNode x_extends="sneakidle.xml">
<m_Name>sneakIdleLow</m_Name>
<m_AnimName>Bob_IdleLowSneak</m_AnimName>
<m_BlendTime>0.40</m_BlendTime>
<m_Conditions />
<m_Conditions>
<m_Name>nearWallCrouching</m_Name>
<m_Type>BOOL</m_Type>
<m_BoolValue>true</m_BoolValue>
</m_Conditions>
<m_2DBlends>
<m_AnimName>Bob_IdleLowSneak</m_AnimName>
</m_2DBlends>
<m_2DBlends>
<m_AnimName>Bob_IdleSneakLow_HBreathing</m_AnimName>
</m_2DBlends>
<m_2DBlends>
<m_AnimName>Bob_IdleLowSneak</m_AnimName>
</m_2DBlends>
<m_Transitions>
<m_Target>sneakWalkLow</m_Target>
</m_Transitions>
<m_Transitions />
<m_Transitions>
<m_blendInTime>0.3</m_blendInTime>
<m_speedScale>1.3</m_speedScale>
</m_Transitions>
<m_Transitions />
<m_Transitions />
<m_Transitions />
<m_Transitions />
</animNode>```
You are trying to use a vanilla movement anim file. This is not possible, those are not available to AnimAction. You need to create a dedicated file under the action subfolder.
aaah I see. Thanks. Any guide that shows it? Never worked with anims before
not that I am aware of. I started one but realised there is more things I do not understand than things I do understand ๐
And how to check if player wants to enter the vehicle?
Alright. Thanks so much. Appreciate your time!
Note that there are 2 layers of animations (that I am aware of): layer 0 is used by java states code and modifies movements/lowerbody, layer 1 is used by AnimAction (~=TimedActions) and modifies the upperbody. You can use a trick for AnimAction to modify the movement/lowerbody, add the following lines at the end of the actions/file.xml: <m_SubStateBoneWeights> <boneName>Dummy01</boneName> </m_SubStateBoneWeights> <m_SubStateBoneWeights> <boneName>Translation_Data</boneName> </m_SubStateBoneWeights>
if you want your character to really sneak though, you may wanna use the java state machine instead of TimedActions.
I am honestly just trying to activate the sneak idle animation during a timed action
and the player wouldn't even be expected to be moving through the action, he'd just be idle on that animation till the timed action is over and he'll revert back to normal
For context, this is the result I am trying to achieve during a timed action, to give the implication that the player is interaction with that "pond"
although in the pic I am crouched using normal crouch method, C
There is already an vanilla AnimAction for low interaction, reuse it
hmm which one is that?
look for all 'Loot' anim actions
one has a low parameter
Thanks for many fun mods :3
self:setActionAnim("Loot")
self.character:SetVariable("LootPosition", "Low")```
There are no bigger icons than 32x32
Thank you!! any idea where I can check list of valid action anims to use?
Any idea how i can attach 3d object into UI element? like when you see your character in the Info panel
I got the item but i have no idea how to put it in the UI
For the exact same need I parsed all lua code for setActionAnim. but you can also parse all media\AnimSets\player\actions xml files for [m_Conditions PerformingAction] node
look at how character info panel / character creation panel do it.
Alright, thanks once again for your help. Really appreciate it :)
is this part of code good for checking the inventory?
Right, I could reverse engineer it but I made things harder for me since im using Typescript lol. Will try anyway, thanks for the tip
for recurse (includes bags) use : ```lua
--I presume player is set to your expected IsoPlayer instance
local inv = player:getInventory();
local invItem = inv:getFirstTypeRecurse('Base.BlowTorch')--for no recurse (not looking into bags), use getFirstType instead