#mod_development
1 messages ยท Page 247 of 1
@thick karma
Show me line 36
Looks like you must not have ProjectGurashi module declared anymore
Function name should be ProjectGurashi.addBook
Above that you need local ProjectGurashi = {}
but if the module wasn't declared the error should happen further up when you try to add to it right?
I think maybe they changed that
how can i just go from the debug error screen straight back to the main menu
Not really possible unless you're accessing it from Main Menu
guh
anyone know what sound "event" corresponds to zombies idling around? the audio works with MaleZombieCombined, but it seems to also play when zombies are idling around, which I've found slightly annoying. Here's the script I'm using for context:
module Base
{
sound MaleZombieCombined
{
category = Zombie,
is3D = true,
clip
{
file = media/sound/this_is_lemonade.wav,
distanceMax = 13,
distanceMin = 0,
volume = 0.5,
}
clip
{
file = media/sound/oh_no.wav,
distanceMax = 13,
distanceMin = 0,
volume = 0.5,
}
}
}
@drifting ore no more error, but its still not in loot pools
oh, i tried to use lootzed on the classroom desk and got this
is your file missing local ProjectGurashi = ProjectGurashi or {} at the beginning?
apparently
why do people do that btw
the whole MyMod = MyMod or {}
it's a simple way to create a table IF it's not already created
as for why MyMod - it's a common practice to put all your mod's belongings into its own little table, though it's not necesasry
but it's not like the file gets ran multiple times so how would MyMod = MyMod and not equal {} always?
o
same thing happened again
that's exactly it, when you run the file a second time, the MyMod table already exists, so you don't necessarily want to reset it
Lua files don't normally run more than once, but PZ's internal code does quite frankly abuse the dofile equivalent so the same file can run many times in principle.
the classroomshelves dont show that the books are in the loot pools and the desks just show an error screen
oh I always assumed it shouldn't ever load twice unless its a reload but even then it wouldnt exist
can you send a ss of the errors pane again?
but scroll down to the bottom of the errors scrolling text thing
Has anyone here added custom sounds to their mods? I have a custom first aid item I am trying to add a custom sound to but I can't get it to work. The item works fine and spawns normally, but I can't seem to get the sound to work.
do you include the sound in the itemscript?
and where is the file path of the sound in the context of your mod
although I am not quite sure if that would work just on it's own
I tried adding it to the script, but since it isn't a food item I didn't think that the custom eat sound would work. I have a "TakePill.lua" file that I've been trying to add the sound to.
also do you have a sound script for the actual sound?
the "takepill.lua" file is where the player stats gets changed.
a sound script?
https://pzwiki.net/wiki/Scripts_guide/Sound_Script_Guide
if you dont have a sound script
yes, you need one to tell the game a multitude of things, one being the file path of the sound it needs to play
can you show your addBook func in lua?
in the ProjectGurashiDistributions.lua
local books = {
"ProjectGurashi.TheDancingGirl",
"ProjectGurashi.Kokoro",
"ProjectGurashi.Yoakemae",
"ProjectGurashi.TheCrabCanneryShip",
"ProjectGurashi.NatsunoHana",
"ProjectGurashi.NoLongerHuman",
"ProjectGurashi.FiresonthePlain",
"ProjectGurashi.TheSilentCry",
"ProjectGurashi.TheLegendofTono",
"ProjectGurashi.JidaiheisokunoGenjo",
"ProjectGurashi.AnAutobiography",
"ProjectGurashi.ListentotheVoicesoftheSea",
"ProjectGurashi.ParadiseintheSeaofSorrow",
"ProjectGurashi.RedLightsShakko",
"ProjectGurashi.ACollectionofHagiwaraSakutaro",
"ProjectGurashi.ACollectionofNakanoShigeharu",
"ProjectGurashi.ACollectionofKanekoMitsuharu"
}
ProjectGurashi.addBook = function()
-- Base Rate
local rate = 4
for _, bookItemName in pairs(books) do
table.insert(ProceduralDistributions.list["ClassroomDesk"].items, bookItemName )
table.insert(ProceduralDistributions.list["ClassroomDesk"].items, ProjectGurashi.truncate(10 * rate))
table.insert(ProceduralDistributions.list["ClassroomShelves"].items, bookItemName )
table.insert(ProceduralDistributions.list["ClassroomShelves"].items, ProjectGurashi.truncate(10 * rate))
end
ItemPickerJava.Parse()
end
Events.OnInitGlobalModData.Add(ProjectGurashi.addBook)```
thats the entire lua file
just an FYI, make sure your distributions on server side
its in lua\server
ok that is fine
well the game is complaining that your distribution's chance is fucked somehow
the truncate function is not in the file
I think in this case, the truncate function
well yes that, I assumed it was left out(?)
if it does exist, it's somehow not able to refer to it (its nil)
no thats the whole file
;-;
i just copy pated what cs typed earlier
you're trying to call truncate function that doesn't exist
ill go grab it again
i probably clipped it out without looking
don't copy paste, kids!!!!!!!!!!!!!!!!!!!!!!!!!!!
don't replace the entire file, just relevant bits
How to I tie the sound to the item? Do you want me to post my script?
one you have the sound script, you can add the sound like you would any other in the item script like Sound:MySound
so long as the sound script defines the sound as MySound in the above example
Am I doing something wrong?
module Melatonin_Gummies
{
imports {
Base
}
sound EatMelatoninGummies {
category = Effect,
loop = FALSE,
is3D = true,
maxInstancesPerEmitter = 2,
clip {
file = media/sound/EatMelatoninGummies.ogg,
distanceMax = 10,
reverbFactor = 0.1,
volume = 0.7,
}
}
item PillsMelatonin_Gummies
{
DisplayCategory = FirstAid,
Weight = 0.3,
Type = Drainable,
UseDelta = 0.05,
UseWhileEquipped = FALSE,
DisplayName = Melatonin Gummies,
Icon = MelatoninGummies,
Tooltip = Tooltip_Melatonin_Gummies,
StaticModel = PillBottle,
WorldStaticModel = PillBottleGround,
Medical = TRUE,
Sound:EatMelatoninGummies
}
}
is it possible it's because sound doesn't have an ending comma?
you can try it
otherwise that should work from just looking at it
oh wait
do you paly the sound when you perform the action? such as eat
It's the take pill action
ok nvm
trailing commas are optional
pretty important feature over a lot of "classic" languages where trailing comma is forbidden
o
Does anyoen know how to/if you can remove a multiplier? i know addXpMultiplier is to give someone a multiplier and that using another addXpMultiplier will overwrite the last one. but i cant figure out how to remove a multiplier after its set. Basically trying to write a mod for exp boosters that adds a multiplier for X ammount of experience but cant figure out how to remvoe that multiplier
Not for most PZ scripts, unfortunately
Unsure whether it's the case for that one, but plenty of script handling code is done by reading until a comma
maybe change sound category to Item
I just add them for uniformity idk why
or until a closing bracket if I understood the code correctly
Depends on the code since there's some duplicative parsing code, but iirc most require it
It's been a common answer to script confusion here in the past
if changing category to Item doesn't help (idk if it does or not), vanilla items do specify a clip event like:
event = Character/Survival/Farming/Crops/Water,
That tells it when to trigger the sound, but the wiki says that's only for vanilla sounds in the soundbank
that whole system looks almost like a MIDI font
Looking at it this way, it feels like devs should've enabled java modding instead of adding Lua.
It's a steeper learning curve but it automatically deletes this kind of issues.
Plenty of other pros and cons that could be discussed with that approach, but I think Lua made it significantly easier for them to limit access where appropriate
Eh. If it's good enough for Minecraft, it's good enough for you.
Like yeah, through a Java mod anything can be done but they require manual installation so they're less โsafeโ anyhow
Besides. With that kind of logic you run afoul of the whole idea of modding, by restricting what people can and cannot mod.
Not really, since there's an alternative that allows for more control
With the tradeoff of ease-of-installation and safety
And just not really generally, since idt sandboxing is anti-modding
IDK. Minecraft mods are installed by simply dropping the jars into the runtime folder. And as for safety, for a videogame mod that's redundant. It's not like it's even your place to play the internet police.
Making malicious mods is already not allowed on Steam, and is generally illegal.
It's their game so I think it is their place a bit lol, and idt it's really fair to compare mod loaders with a built-in modding API
Yeah well. Minecraft modloaders mainly just hook into the game to provide events to which mods can latch, since the game didn't originally had them.
Nonetheless the simplicity of dropping mods into a folder is due to the loaders, not the game
Allright fair enough.
Sorry, I did something that messed up the icon so I had to revert to an earlier backup of my mod. I'm trying to mess around with the categories.
I'm gonna go snuggle with my pug and come back to this issue in a little bit.
Hello, I am making a mod but for some reason it is using 2D texture for the item that I drop on the ground. I have a custom-ish model but it is not working at all. Could you please help me out? I've tried copying the other mods and how they do it, but had no success.
mod folder:
media
>lua
>server
>items
Distributions.lua
scripts
mod_item.txt
mod_modelstextures.txt (this file should attach my texture to the model, but it is not working. I've tried putting my custom model to the folder models_X > static to no avail, nothing works)
textures
mod_icon.png [35x35]
>WorldItems
mod_texture.png [256x256]
mod.info
poster.png
Please elp :(
anyone know how to remove a multiplier? im using addXpMultiplier to add one but then i need to remove it, and i cant seem to figure it out
the way that vhs dialogue gives or removes moodles i set up wrong when i wanted to do 2 moodles
Nice, glad you were able to fix it!
you want to apply your mesh to thet mod_models.txt script as well
something like this:
``model Smoker
{
mesh = WorldItems/BigSmoker,
texture = WorldItems/Smoker,
scale = 1.5,
}``
obviously replace it with your model name and file path for your files.
and then you call on it using the world static model in the item script. like so:
item Smoker { DisplayCategory = Tool, Weight = 20, Type = Normal, DisplayName = Smoker, Icon = smoker, WorldStaticModel = Smoker, }
it is case sensitive though
Do I put my model (mesh) to the WorldItems folder or to models_X? I understand that I need to put the code you've sent above to the mod_models.txt that is located at the moment in my scripts folder, thank you very much.
the worlditems folder should be within the models_X folder. but if you just drop it in the models_X folder then your would do like so:
model Smoker { mesh = BigSmoker, texture = WorldItems/Smoker, scale = 1.5, }
same for texture.
Negative value?
hmmm maybe, i did try setting it to just 1 but it still gives that visual arrows like reading boost does. but i think i can do it with getPerkBoost and setPerkBoost so im trying that way might be easier
ah, setPerkBoost is the xp boost you see on perks, from like professions where it gives +100% exp to certain perks. i maybe be able to use that
Does anyone know what can it be? It says I don't have enough propane units, but I have many.
likley one of those old mods that were made when propane torches had more than 10 uses. pretty sure they no longer work. i tend to use this mod for that purpose: https://steamcommunity.com/sharedfiles/filedetails/?id=2757712197&searchtext=vehicle+repair+overhaul
yeah, you're probably using this mod: https://steamcommunity.com/sharedfiles/filedetails/?id=2289429759&searchtext=vehicle
dont
yes I am
So is this mod giving the error?
Oh, it was working when I unlinked the .fbx file (it is located in media\models_X\WorldItems\ and placed the base game one instead (texture is off since the meshes are not meshing). But once I linked my model to the item, it stopped working and stayed as 2D sprite when you drop the item. Could you please tell me if I am wrong here?
This is my modelstxtures file:
`module model
{
model MODmodel
{
mesh = models_X/WorldItems/NEWmodel, [it is a .fbx file, located in media\models_X\WorldItems]
texture = WorldItems/modeltexture, [the texture is located in the media\textures\WorldItems\ folder]
}
}`
I am very thankful for your help. ๐
correct
module Base
{
model MODmodel
{
mesh = WorldItems/NEWmodel, [it is a .fbx file, located in media\models_X\WorldItems\]
texture = WorldItems/modeltexture, [the texture is located in the media\textures\WorldItems\ folder]
}
}```
make it like that
testing now
notice how i took out models_x from the path and i changed the module to Base
do that
Yes, trying it out currently.
You can't see it, but I'm giving you a standing ovation, I would never find out it was that mod.๐ซก
comes with a lot of practice/experience with mods. that standing ovation is for me not having a life, lol.
Tried it out in many ways, but in the end it worked. Removed the path. Thank you. But now it seems that I have to fix the scaling. Oops. The textures were too big it seems. ๐
no no, not the textures.
you can add a
scale = (decimal value) to the model script and it will scale that way
or you can just scale the model in blender if you want
@unreal dust
It is just re-meshed vanilla model, I don't know what is causing this.
was it a .x file that you converted to .fbx?
It was .x file that I converted to .blend to edit it in blender. Then, I used in-built converter to convert the .blend to .fbx.
that is why its big then. changing from .x to another format resets any and all transforms
sometimes it even inverts the uv mapping
massive pain to deal with
Got it, thank you. I'll just scale it down XD
would scale it in blender. just scale all x,y,z to something like 0.01 i think?
and make sure to save a backup and apply transformations before saving the file you want to test
Bravo, thank you, it all worked out well. I now only have three hours for sleep before job, so might as well. Thank you.
lol im dumb. i didnt try just setting the multiplier to 0.... which works XD
i was just looking for something like removeXpMultiplier without thinking it through
So the whole mod seems alright now?
Had to tune out for awhile
yeah, it works perfectly
im now able to add new items by myself pretty easily
i just .. need to learn how to make art for icons and models
ill need more help eventually learning some more complicated things that i have no clue how i could possibly do (or if theyre even possible) but for now im set
I've got 5 minutes on my PC; can I see current state of Lua? Had suggestions but no time to show you. Unsure if you got to them.
uh well im in the middle of editing some stuff ubt sure
ProjectGurashi.truncate = function(number)
return math.floor(number * 100) / 100
end
-- Lists of Items
-- List of books
local books = {
"ProjectGurashi.TheDancingGirl",
"ProjectGurashi.Kokoro",
"ProjectGurashi.Yoakemae",
"ProjectGurashi.TheCrabCanneryShip",
"ProjectGurashi.NatsunoHana",
"ProjectGurashi.NoLongerHuman",
"ProjectGurashi.FiresonthePlain",
"ProjectGurashi.TheSilentCry",
"ProjectGurashi.TheLegendofTono",
"ProjectGurashi.JidaiheisokunoGenjo",
"ProjectGurashi.AnAutobiography",
"ProjectGurashi.ListentotheVoicesoftheSea",
"ProjectGurashi.ParadiseintheSeaofSorrow",
"ProjectGurashi.RedLightsShakko",
"ProjectGurashi.ACollectionofHagiwaraSakutaro",
"ProjectGurashi.ACollectionofNakanoShigeharu",
"ProjectGurashi.ACollectionofKanekoMitsuharu"
}
-- Lists of Locations
-- Add to Distributions
--BentoBox Distribution
function ProjectGurashi.addBentoBoxToClassroomDesk()
table.insert(ProceduralDistributions.list["ClassroomDesk"].items, "ProjectGurashi.BentoBox")
table.insert(ProceduralDistributions.list["ClassroomDesk"].items, ProjectGurashi.truncate(15))
-- Function to add books to distributions
ProjectGurashi.addBook = function()
for _, bookItemName in pairs(books) do
table.insert(ProceduralDistributions.list["ClassroomDesk"].items, bookItemName )
table.insert(ProceduralDistributions.list["ClassroomDesk"].items, ProjectGurashi.truncate(rate))
table.insert(ProceduralDistributions.list["ClassroomShelves"].items, bookItemName )
table.insert(ProceduralDistributions.list["ClassroomShelves"].items, ProjectGurashi.truncate(rate))
end
ItemPickerJava.Parse()
end
Events.OnInitGlobalModData.Add(ProjectGurashi.addBook)```
oh also @thick karma if i wanna get rid of the rate variable is it just ProjectGurashi.truncate(4))
or is it a different format
yes
If it's gonna be constant then you ought to just use the value that it'll ultimately be
So have you not finished this? It doesn't quite look like it's in a working state at a glance... Copying it into another file it appears that you have an unclosed function called addBentoBoxToClassroomDesk?
im trying to figure out the most efficient way to organize this
yeah no im not done
currently trying to think of a good way to organize things and then im gonna finish adding a couple other items
well it appears a good way of organizing it
i guess ill just do a different function for each category of items i wanna do
that works. But also the function you have there doesn't care what kind of object it is, it should work the same for all of them.
It operates with just a piece of text. The game then deciphers what the text actually means.
yeah i could put it all in one function
but thats what i mean by organization
i guess i can comment in the middle of the function and nothings stopping me
ill just do that
well the purpose of making code like this is to reduce the amount of manual labor. You can always just manually insert each item into each container distribution individually, by calling the insert function individually for each of them
oh i just realized i can also make a list of locations to distribute to
table.insert(ProceduralDistributions.list["ClassroomDesk"].items, ProjectGurashi.Kokoro )
table.insert(ProceduralDistributions.list["ClassroomDesk"].items, ProjectGurashi.Yoakemae )```
etc
whats this?
an example how you can do all of this manually
oh, yeah
Okay:
local ProjectGurashi = ProjectGurashi or {}should just belocal ProjectGurashi = {}. If you're working with a local table that cannot be modded in a global way, there is no point in worrying about your table being initialized before you initialize it.- You don't need
truncateif you're not doing any kind of math with rate. - Encapsulating
booksasProjectGurashi.booksand returningProjectGurashiat the end of your file will create the opportunity for other modders to theoretically prevent specific books from spawning, or spawn new books everywhere you spawn yours, by editing the list before the event that adds it. - Adding
endto any scope that needs it as soon as you open that scope will prevent you from forgetting to close it after writing a long function. - It is good practice to indicate the scope of variables (the area of your code in which they exist) by tabbing things in based on their scope; this is why e.g. virtually everyone tabs in the contents of functions. I would recommend you do so for the function
addBookabove. - Since
addBookin fact adds a list of books, I'd rename it. - If
ratewere also module-encapsulated, you would make it easy for other modders to patch.
When all of the above advice is applied, your code looks like this:
local ProjectGurashi = {}
ProjectGurashi.rate = 4
-- List of books
ProjectGurashi.books = {
"ProjectGurashi.TheDancingGirl",
"ProjectGurashi.Kokoro",
"ProjectGurashi.Yoakemae",
"ProjectGurashi.TheCrabCanneryShip",
"ProjectGurashi.NatsunoHana",
"ProjectGurashi.NoLongerHuman",
"ProjectGurashi.FiresonthePlain",
"ProjectGurashi.TheSilentCry",
"ProjectGurashi.TheLegendofTono",
"ProjectGurashi.JidaiheisokunoGenjo",
"ProjectGurashi.AnAutobiography",
"ProjectGurashi.ListentotheVoicesoftheSea",
"ProjectGurashi.ParadiseintheSeaofSorrow",
"ProjectGurashi.RedLightsShakko",
"ProjectGurashi.ACollectionofHagiwaraSakutaro",
"ProjectGurashi.ACollectionofNakanoShigeharu",
"ProjectGurashi.ACollectionofKanekoMitsuharu"
}
-- Add to Distributions
--BentoBox Distribution
function ProjectGurashi.addBentoBoxToClassroomDesk()
table.insert(ProceduralDistributions.list["ClassroomDesk"].items, "ProjectGurashi.BentoBox")
table.insert(ProceduralDistributions.list["ClassroomDesk"].items, 15)
end
-- Function to add books to distributions
ProjectGurashi.addBooks = function()
for _, bookItemName in pairs(ProjectGurashi.books) do
table.insert(ProceduralDistributions.list["ClassroomDesk"].items, bookItemName)
table.insert(ProceduralDistributions.list["ClassroomDesk"].items, ProjectGurashi.rate)
table.insert(ProceduralDistributions.list["ClassroomShelves"].items, bookItemName)
table.insert(ProceduralDistributions.list["ClassroomShelves"].items, ProjectGurashi.rate)
end
ItemPickerJava.Parse()
end
Events.OnInitGlobalModData.Add(ProjectGurashi.addBooks)
return ProjectGurashi
thats what i was gonna default to at first
Anyhoo good luck
ill get to that in a sec, thakn you !
does anyone know the full function of the event OnContainerUpdate? im trying to log times for items in a container and this event only seems to do things when opening doors. is there a better option?
You can keep track of which containers you want to update and then loop over them in OnEveryMinutes callback. But it's not exactly "better".
Anyway is there a reason you must actively check the time values? Most time-related applications work completely fine off of just recording the starting time and comparing it to current time.
thats what i wanted to do. i was planning on logging the time when the player checks the container and updating the item when the container is checked again
Well there's an addon for inventory tetris which hides container contents for a few moments when you open it, you might be able to borrow some code from it.
how could I make it so when an item spawns in a container a certain amount will spawn?
one method could be making an item like "pack of items" put it in distributions and make a recipe that unpacks into the number. im sure theres a way to make it spawn directly in distributions but im not very knowledgeable on it
you can specify a procedural item data and it has min and max fields
well i think in the table.insert thing you can also list an amount but i might be wrong
oh also i got rid of the truncate thing and it no longer works (yay)
im gonna try some more stuff but this is the right format, right?
table.insert(ProceduralDistributions.list["OfficeDesk"].items, ProjectGurashi.15)```
for the rate being 15
make it just 15
i see
youre trying to call the position of ProjectGurashi at 15 which doesnt exist
yes
alright cool
why do you need to end the loop though?
im only using the loop for the books
im putting every item im adding into this same function and the book loop only needs to loop in the part of the function that adds book loot
i don't get it but it sounds like the program doesn't needs to be this complicated
Can you elaborate?
and you don't exactly have a lot of leeway with getting fancy with code so keeping it simple for now would be the easiest route
well
anyway you can just have multiple separate lists of objects for multiple separate loops
i can get rid of it
items are no longer spawning anyways
-- Lists of Items
-- List of books
local books = {
"ProjectGurashi.TheDancingGirl",
"ProjectGurashi.Kokoro",
"ProjectGurashi.Yoakemae",
"ProjectGurashi.TheCrabCanneryShip",
"ProjectGurashi.NatsunoHana",
"ProjectGurashi.NoLongerHuman",
"ProjectGurashi.FiresonthePlain",
"ProjectGurashi.TheSilentCry",
"ProjectGurashi.TheLegendofTono",
"ProjectGurashi.JidaiheisokunoGenjo",
"ProjectGurashi.AnAutobiography",
"ProjectGurashi.ListentotheVoicesoftheSea",
"ProjectGurashi.ParadiseintheSeaofSorrow",
"ProjectGurashi.RedLightsShakko",
"ProjectGurashi.ACollectionofHagiwaraSakutaro",
"ProjectGurashi.ACollectionofNakanoShigeharu",
"ProjectGurashi.ACollectionofKanekoMitsuharu"
}
-- Lists of Locations
-- Add to Distribution
ProjectGurashi.Distribution = function()
-- Book Distribution
for _, bookItemName in pairs(books) do
table.insert(ProceduralDistributions.list["ClassroomDesk"].items, bookItemName )
table.insert(ProceduralDistributions.list["ClassroomDesk"].items, 4)
table.insert(ProceduralDistributions.list["ClassroomShelves"].items, bookItemName )
table.insert(ProceduralDistributions.list["ClassroomShelves"].items, 4)
break
-- Bento Box Distribution
table.insert(ProceduralDistributions.list["ClassroomDesk"].items, "ProjectGurashi.BentoBox")
table.insert(ProceduralDistributions.list["ClassroomDesk"].items, 25)
table.insert(ProceduralDistributions.list["OfficeDesk"].items, "ProjectGurashi.BentoBox")
table.insert(ProceduralDistributions.list["OfficeDesk"].items, 15)
table.insert(ProceduralDistributions.list["BreakRoomCounter"].items, "ProjectGurashi.BentoBox")
table.insert(ProceduralDistributions.list["BreakRoomCounter"].items, 15)
table.insert(ProceduralDistributions.list["KitchenFridge"].items, "ProjectGurashi.BentoBox")
table.insert(ProceduralDistributions.list["KitchenFridge"].items, 5)
table.insert(ProceduralDistributions.list["SchoolLockers"].items, "ProjectGurashi.BentoBox")
table.insert(ProceduralDistributions.list["SchoolLockers"].items, 10)
-- PackagedBentoBox Distribution
table.insert(ProceduralDistributions.list["ConvenienceStoreShelves"].items, "ProjectGurashi.PackagedBentoBox")
table.insert(ProceduralDistributions.list["ConvenienceStoreShelves"].items, ProjectGurashi.5)
ItemPickerJava.Parse()
end
Events.OnInitGlobalModData.Add(ProjectGurashi.Distribution)
return ProjectGurashi```
this is what ive done
why not?
Lua will terminate the loop as soon as it sees the break statement, so what will happen is that it will add TheDancingGirl to ClassroomDesk and to ClassroomShelves, and then exit the loop entirely
also you seem to be missing an end to close the loop code block, right before the Parse call
Ahh so you want to move partway through one round of a loop?
And then move to next round?
Just to clarify intention?
Anyway it looks like the bento box code doesn't even needs to be inside that loop, so you can just take it out and put outside the loop, either before or after.
i might be thinking about how this works wrong so just forget it
ill just get rid of the return
thats what i was trying to do with the break
i thought break would end the loop but not the function
so i could put it after the loop
well yes that's what it does
but you need to loop over all the books
and it stops on the 1st book
so how do i make it not do that
for key, value in pairs(values) do repeat
until true end```
in this case, you just don't need it
does until true end go before or after the loop
can I have what you're smoking? thanks
If you use break here it will only break 1 round of the loop @unreal pewter
whar
It's a one-round loop in a loop
yeah exactly, that whole thing doesn't makes sense. Well repeat X until true is the same as do X end
Therefore break breaks the inner loop
Using break as continue might work with do X end as well
Never tried it with that
@unreal pewter you simply don't need break in the loop
so how do i do this
Sec, I'm on a phone
it was a bizarre example and do not do this
oh i see
Ignore CS
so should i just leave it how it was
He is a fool
And has been combative for hours
And provided wrong answers repeatedly
woah so true
And the answer I gave is the correct way to solve your stated goal in this game
If you want to learn it, it is a useful skill and I will share it
actually i will kindly pass this time
for key, value in pairs(values) do repeat
thisHappensEveryLoop()
if youNeedToBreak then break end
thisOnlyHappensIfYouDoNotBreak()
until true end```
This is all you need
you're missing another end
You don't put another end
Repeat doesn't have another end
Again, you're not helping
It's one thing to give bad advice
For loop, while loop, do while if you understand these three loop styles this all makes sense.
It's another to tell others not to follow good advice
for loop do loop until end
No
sticking to simple methods while it's your 1st or so day programming is a sound advice
but for key, value in pairs(values) do repeat i'm not so sure
It's a simple loop...
for indexVariable = start, limit do
end```
why would you put repeat there?
for is already a loop there doesn't needs to be another loop
i mean it's not bad. But it's redundant and frankly bizarre.
Then inside the loop you put repeat followed by all the things you want to do followed by until true which creates a loop that only happens once. And then break will break that loop instead of your for loop, which effectively skips to the next iteration
That said you would only break conditionally, of course. Breaking every loop is not the usual usage of this technique.
Not know Lua very well, this explanation seems weird, could you not just use an if statement
That's what people normally do. Or goto continue but I think this version of kahlua doesn't support it.
for key, value in pairs(values) do
thisHappensEveryLoop()
if NOT youNeedToBreak then
thisOnlyHappensIfYouDoNotBreak()
end
end```
oh I get it. The whole for X do repeat until true end is a way to generate behavior of continue in absence of this functionality. But then break doesn't work, and you will need if clauses and flags. Which is effectively the same as ^ code, but with a weird looking repeat block jammed into it.
Yes this just creates more nesting. It's a tradeoff
Totally fair alternative of course
Eh I don't feel it. It makes break become continue depending on whether or not the loop code is also wrapped in repeat. It works but it's probably not ideal for code readability.
I would propose that it is less nesting as you replace the if statement but remove the inner loop.
Technically it's the same nesting, but not visually. Using repeat until true in the header and end line just gives you a clean way to continue without tabbing one more time
Yes it may require 2 or 3 more brain cells and a couple more seconds to understand than a normal for loop
If the nested loop, at some point ran more than once I could see this as a use case.
No idea about lua tabbing or anything like that
Once you get into those realms it's kinda really preferences based. And each to thier own.
Lua is one of those "there are many ways to do it" languages. I've been using it since about 2010 and it's the first time I've seen anything like this.
Most of PZ modding code doesn't even make Lua classes and ho boy is there a lot of ways to make a Lua class.
I mean, I don't think that really is an issue tho
It's not. I just don't find it's appropriate to aggressively offer what amounts to a parlor trick to someone who's probably using Lua for the first time. They're having hard time using break as it is.
Lol
I'm pretty sure all programing is basically magic.
Honestly there are very few cases for break
Or should be, atleast
99% of the time I use it is to aid in optimization. Instead of creating a 100% solid table of items to go through, which will never need to deviate from the full code of the loop, I put in a condition to skip certain elements and use the original table. Depending on the size of the table, avoiding generating a whole new one is a huge time save.
Well, that's for continue which is not a thing in Lua. But break has a similar purpose - when you're already done with your calculations, and you can break the loop to save CPU cycles.
this construct gives me the same vibes as regex, but lite. Sure, writing regex isn't hard. But how often you can read it without mistake? If you had a penny each time you come back to a 2 years old regex and can read it the first time, you'd have 2 pennies. Saying only a dingus couldn't always ace this, IDK.
I don't think that pattern is difficult to read and understand for anyone familiar with Lua
That said, I'm not a fan of it either
Well if you stick to very simple patterns, yeah, there's a good chance that you can read it and understand its function exactly and without mistake. When your regex is 300 columns, the odds are getting close to nil.
I'm referring to the pattern of a repeat within a for loop that Burryaga sent
I disagree entirely with the regex thing but that's neither here nor there
ah. Well, hence "lite".
I think any processing burden (visual processing, I mean) from the for/repeat thing comes from not indenting it "properly," i.e., the repeat immediately follows the for loop's do
if you do indent it properly, I think there's greater odds that you'd miss it while scanning.
stuff directly following the standard for construct is usually conspicuous
I disagree, considering it'd more clearly be a block
But ultimately all of this comes down to preference
The fact that this switches the function of a standard keyword makes it pretty hard to justify IMO. To grossly exagerrate, imagine if true and false were swapped every odd indent level. One can very easily keep track of indent levels, but still.
Anyway this should be taken in context of trying to coach a brand new Lua user.
so in an attempt to get some items to spawn in-game, ive got this, and the books spawn correctly, but the bento box and packaged bento box dont work. i made them two separate functions because whenever i add the bento box code to the first function, the books dont spawn either, and im not sure what else to do, any opinions or thoughts would help
-- Lists of Items
-- List of books
local books = {
"ProjectGurashi.TheDancingGirl",
"ProjectGurashi.Kokoro",
"ProjectGurashi.Yoakemae",
"ProjectGurashi.TheCrabCanneryShip",
"ProjectGurashi.NatsunoHana",
"ProjectGurashi.NoLongerHuman",
"ProjectGurashi.FiresonthePlain",
"ProjectGurashi.TheSilentCry",
"ProjectGurashi.TheLegendofTono",
"ProjectGurashi.JidaiheisokunoGenjo",
"ProjectGurashi.AnAutobiography",
"ProjectGurashi.ListentotheVoicesoftheSea",
"ProjectGurashi.ParadiseintheSeaofSorrow",
"ProjectGurashi.RedLightsShakko",
"ProjectGurashi.ACollectionofHagiwaraSakutaro",
"ProjectGurashi.ACollectionofNakanoShigeharu",
"ProjectGurashi.ACollectionofKanekoMitsuharu"
}
-- Lists of Locations
-- Add to Distribution
ProjectGurashi.BookDistribution = function()
-- Book Distribution
for _, bookItemName in pairs(books) do
table.insert(ProceduralDistributions.list["ClassroomDesk"].items, bookItemName)
table.insert(ProceduralDistributions.list["ClassroomDesk"].items, 4)
table.insert(ProceduralDistributions.list["ClassroomShelves"].items, bookItemName)
table.insert(ProceduralDistributions.list["ClassroomShelves"].items, 4)
table.insert(ProceduralDistributions.list["BookstoreBooks"].items, bookItemName)
table.insert(ProceduralDistributions.list["BookstoreBooks"].items, 2)
table.insert(ProceduralDistributions.list["LibraryBooks"].items, bookItemName )
table.insert(ProceduralDistributions.list["LibraryBooks"].items, 2)
table.insert(ProceduralDistributions.list["LivingRoomShelf"].items, bookItemName)
table.insert(ProceduralDistributions.list["LivingRoomShelf"].items, 2)
table.insert(ProceduralDistributions.list["CrateBooks"].items, bookItemName)
table.insert(ProceduralDistributions.list["CrateBooks"].items, 2)
table.insert(ProceduralDistributions.list["OfficeDesk"].items, bookItemName)
table.insert(ProceduralDistributions.list["OfficeDesk"].items, 1)
table.insert(ProceduralDistributions.list["SchoolLockers"].items, bookItemName)
table.insert(ProceduralDistributions.list["SchoolLockers"].items, 1)
end
ItemPickerJava.Parse()
end
ProjectGurashi.Distribution = function()
table.insert(ProceduralDistributions.list["ClassroomDesk"].items, "ProjectGurashi.BentoBox")
table.insert(ProceduralDistributions.list["ClassroomDesk"].items, 25)
table.insert(ProceduralDistributions.list["OfficeDesk"].items, "ProjectGurashi.BentoBox")
table.insert(ProceduralDistributions.list["OfficeDesk"].items, 15)
table.insert(ProceduralDistributions.list["BreakRoomCounter"].items, "ProjectGurashi.BentoBox")
table.insert(ProceduralDistributions.list["BreakRoomCounter"].items, 15)
table.insert(ProceduralDistributions.list["KitchenFridge"].items, "ProjectGurashi.BentoBox")
table.insert(ProceduralDistributions.list["KitchenFridge"].items, 5)
table.insert(ProceduralDistributions.list["SchoolLockers"].items, "ProjectGurashi.BentoBox")
table.insert(ProceduralDistributions.list["SchoolLockers"].items, 10)
table.insert(ProceduralDistributions.list["ConvenienceStoreShelves"].items, "ProjectGurashi.PackagedBentoBox")
table.insert(ProceduralDistributions.list["ConvenienceStoreShelves"].items, 5)
ItemPickerJava.Parse()
end
Events.OnInitGlobalModData.Add(ProjectGurashi.BookDistribution)
Events.OnInitGlobalModData.Add(ProjectGurashi.Distribution)
return ProjectGurashi```
first double check that your item names have no typos in the item script and here, as well as check syntax in there if you made these items separately from the books . and you're checking this with lootzed?
yes, i think so, and yes
what do you mean by the second thing?
the bento exists in game and functions properly as an item
its just not spawning in containers
Can you show the item script for bento box?
{
Type = Normal,
DisplayName = Packaged Bento Box,
Icon = BentoBoxItem,
Weight = 0.6,
WorldStaticModel = BentoBoxPackaged,
ReplaceOnUse = ProjectGurashi.BentoBox,
Tooltip = "test",
}
item BentoBox
{
Type = Food,
DisplayName = Bento Box,
Icon = BentoBoxIcon,
Weight = 0.5,
HungerChange = -40,
UnhappyChange = -10,
BoredomChange = -10,
ThirstChange = -10,
Calories = 590,
Carbohydrates = 77,
Proteins = 10,
Fats = 31,
DaysFresh = 3,
DaysTotallyRotten = 5,
}```
module is ProjectGurashi right?
None.
For now I can only suggest a way to automate location and probablity coding, while this problem is awaiting solutions.
the weirdest thing is that its showing up in lootze
as if its in the distribution table but its not included in the roll or something? i dont konw
that means the distribution is done right
it was the same way earlier for books
but i fixed the issue by removing the bento distribution code from the same function as the book disribution code
ctrl+f through the original distributions file finds no instances of KitchenFridge or ConvenienceStoreShelves
have you been getting Lua errors?
i would think that would break it
related to how i dont have a model assigned to bentobox
which i dont thikn is an issue
comment those two lines out and try?
well either way, try replacing those two locations with something that you copy and paste from the ProceduralDistributions.lua file
what two lines?
am i insane
well 4 wherever you put KitchenFridge or ConvenienceStoreShelves in your distribution
lemme try some stuff
Well, see, the way this works, is that it looks for an exact match. If there's no match, then it doesn't work. Partial matches don't count.
with this i was talking about the errors
i swear to god i thought kitchenfridge existed i think im actually insane
there exist 17 varieties of kitchen fridge, but not KitchenFridge specifically
it's what I mean by "partial matches don't count"
i would suggest CafeKitchenFridge,DinerKitchenFridge,FridgeGeneric,FridgeRich,FridgeTrailerPark
your insanity will only increase with time. Lucky CS found it cause i think i thought about that earlier but completely didnt consider it
there was probably a directly related Lua error in the debug log. They can be easy to miss when there are a lot of various errors.
well, thank you
when you assign a weapon swing animation value to an item, say you set it to bat, where is the value for what constitutes the bat weapon swing animation stored in the vanilla game, and could you possibly make your own without overriding the ones used in the game already?
im not the guy for this but i know this should be possible and it is handled in xml. i found i short guide that has an example at the bottom for the xml https://steamcommunity.com/sharedfiles/filedetails/?id=3035712003
Thanks so much for this, Ill look at this rn.
i would also suggest looking in common\ProjectZomboid\media\AnimSets for more examples of the xml
Tysm for this, I just needed an idea on how to sort of get started, and this was awesome. Im assuming you can program the hit scan for an attack in the xml file itself, as Ive just seen that somewhere.
To make your own weapon swing you add a new copy of one of the existing XMLs, give it a unique condition that you will set, change its name, and then change the animation it points to.
thank you, I will do that
sorry I deleted my previous msg bc I thought it was stupid
Based on modding the bat's critical hit animation, I think this would get you started:
<?xml version="1.0" encoding="utf-8"?>
<animNode x_extends="2HDefault.xml">
<m_Name>YOUR_CUSTOM_NAME</m_Name>
<m_AnimName>YOUR_CUSTOM_ANIMATION_NAME_WITHOUT_FILE_EXTENSION</m_AnimName>
<m_Conditions />
<m_Conditions />
<m_Conditions>
<m_Name>YOUR_CUSTOM_PLAYER_VARIABLE</m_Name>
<m_Type>BOOL</m_Type>
<m_BoolValue>true</m_BoolValue>
</m_Conditions>
<m_2DBlends>
<m_AnimName>YOUR_CUSTOM_ANIMATION_NAME_WITHOUT_FILE_EXTENSION</m_AnimName>
</m_2DBlends>
</animNode>
Then you would set player:setVariable("YOUR_CUSTOM_PLAYER_VARIABLE", true) when you wanted to be overriding the default attack with yours.
Might be able to throw in
<m_Events>
<m_ParameterValue>ZombieHitReaction=HeadTop</m_ParameterValue>
</m_Events>
To aim at the head, based on 2HOverhead
and I'm guessing that the <animNode> tag thing refers to what the provided code will override?
Some of the files have stuff like this:
<m_2DBlends>
<m_AnimName>Bob_AttackBat02_Hit</m_AnimName>
</m_2DBlends>
<m_2DBlends>
<m_AnimName>Bob_AttackBat02_Hit</m_AnimName>
</m_2DBlends>
<m_2DBlends>
<m_AnimName>Bob_AttackBat02_Hit</m_AnimName>
</m_2DBlends>
<m_2DBlends>
<m_AnimName>Bob_AttackBat02_Hit</m_AnimName>
</m_2DBlends>
I honestly don't know if each copy does anything but my gut says I highly highly doubt it. I would bet on these being placeholders for future variants.
So likely you only need one
It inherits from 2HDefault. It doesn't override it
2HDefault will still behave normally when YOUR_CUSTOM_PLAYER_VARIABLE == false
that's so awesome, that's exactly what I need
Also you can probably throw your animation scripts in their own subdirectory of player/melee/2handed
I threw all my custom ActUndead animations in an ActUndead subfolder of the corresponding player movement folders
And it works fine
so the placement of the scripts dont matter?
@chilly ermine Feel free to refer to and refactor anything useful Act Undead. I added custom player movement animations but the technique is largely the same
Although your animations will have to worry about where the props go ๐ญ
And those props are a headache lol
if I just wanted to rejig the Vanilla animations to use a specific sequence instead of being random when attacking, can I just point to them untill I make my own animations?
I think they may need to be in the right parent folder to be found but I'm unsure about that. Might purely be based on the variables in the scripts and prioritizing what was recently set. I did have issues trying certain things outside of their natural folders -- e.g. my idle animations started working when I moved them to player idle folder iirc -- but I could have made and fixed some other tiny error without noticing. I haven't extensively tested trying to get animations to work outside of their natural parent folders.
Yes you can point to vanilla animations in custom scripts
That's what AU does
It steals zombie animations for players
You can use them however other XMLs use them
Reading through various melee XMLs may give you an idea of what you're allowed to try
but as you've just mentioned, ensure that they are in the correct folder ig, if ur talking abt the actual .X file
"allowed"
What the game will handle well
Well the .X's go somewhere entirely different but yes I would put custom .X's in the right parent folders too
why are you guys so helpful lmfao
I can't remember the name, but essentially where you find them in the game directory, I'll just leave them there. I'll have a look at act undead when I get back
curiously, could I set a variable inside the XML file? and adjust the animation speed from the lua script?
Examples in Act Undead
Movement speeds when acting zed are sandbox optional
And scaled from base values in a table in the mod
I manually calculated each base value using a function that calculated player speed to get it as close to vanilla as I could and work from there.
so in Ur case the animation speed affects walking speed?
Yeah
zombieSpeed is for when players are acting like zombies
I set that whenever I set the player's movement animation
and for this example, sprint 3 replaces sprint towards.xml, which I'm assuming is a base game XML file. sorry I'm asking so many questions, I will have a look at the mod when I get back, I just wanna know for sure what I'm doing
"replaces sprintToward.xml" is not quite the right way to say it; it extends that XML, rather than replacing it, so I imagine it inherits the same conditions. But if you add new conditions and those are also met, your XML's animation will run in place of the default set by sprintToward. Which isn't quite the same as overriding or replacing an entire file.
sorry, but I think I understand the premises now. it's called "act undead" correct?
yeah
Act undead is a great mod iโve been hoping for something like this for awhile, the others similar are just not as good.
thank you Burryaga
length always returns 0, and i cannot access the attackAnims array whatsoever, even after removing the kumpt. tag on the front of it
kumpt.attackAnims = {kumpt1hUppercut, kumpt2hUppercut, kumpt2hOverhead}
length = #kumpt.attackAnims```
why is that so?
I hazard a guess that none of kumpt1hUppercut, kumpt2hUppercut, kumpt2hOverhead have a Lua value defined so they resolve as nil, and filling a table with those has no effect. So it works out to be an empty table with length 0.
If these exist as defined animation objects through scripts and xmls, then a probable solution is to enclose each of them in quotes, so it's a piece of text, not Lua variable.
im trying to make a recipe to unpackage a food item but ingame nothing is happening and the recipe doesnt exist, do i have something wrong here?
{
recipe Unpackage Bentou
{
PackagedBentou,
Result:Bentou,
Time:60,
Category:Cooking,
}
}```
im not sure if this is a factor but time usually (i've only ever seen it) is a float value (decimal like 60.0) and not an integer
the vanilla recipes do both
ok then I am unsure as that looks like it should work -_-
It might not make any difference but all recipes that I've looked at have a blank line between ingredients and the rest.
yeah i did that at first
true true
still didnt work
๐ญ
is it a chance that it's in the wrong directory?
tried that
oof
didnt work and the game says it automatically imports base anyways
is the mod enabled?
yes ??
it's a stupid question ik but sometimes I've been making a mod and the thing just randomly disables and enables itself whenever it feels like it
well
the mod is lumped in with a map mod that im making
and i am testing it on my map
so
fair
id be surprised if it wasnt on
i mean, this is the entire file
is there something i could be missing?
something at the end maybe?
I don't think so, you already specify result and all that
I have no idea, im not much help in this case as the file is literally as is and doesn't look wrong to me\
only if a trailing newline lmao. I'm sure it's already there and I don't htink it even matters.
though I will say that sometimes files encoded in UTF-8 with BOM mess up parsers
Anyway just to be sure you can put it in the same file as the bento box item definition.
ill try that
also completely unrelated, do any of you know how, with my mod, i could change the default sandbox settings or something? or (ideally) add a new playstyle like Apocalypse or Builder ?
and also, when the mod is enabled, disable the ability to spawn in knox county
still nothing
actually id like to be able to replace the playstyles
My last idea is to spell out the full name of the item, module and everything. Thought I doubt that would work.
tried that already

love this
i also just replaced spawn weights in my distribution file with a variable
so that i can easily just change the variable and itll change the spawn weights for everything
and now not a single thing in the entire distribution file works, despite only modifying a tiny part of it
and after undoing that
it still doesnt work
despite it being the same exact code that worked 5 minutes ago
Computers do what you said, not what you meant.
it worked 5 minutes ago
Then enough ctrl+z should fix it.
and so i reverted my code to what worked 5 minutes ago
thats
what im saying i did
i undid my edits back to the exact same thing that just worked
and it no longer works
Maybe it just needs more ctrl+z
i copy pasted a backup of the code
i think my computer is just cursed to never work
The endeavour was doomed to be extremely frustrating. Learning Lua by modding a game is like learning to swim by jumping into a shark tank.
And, well, this item/recipe scripting format isn't even Lua. PZ did some completely custom thing.
i guess so
im learning relatively quickly though
im not sure why but it works now
not the recipe, just the distribution i mentioned
ALSO is there a way i can remove an item from a distribution table?
you should be able to use table.remove similar to how you do table.insert
so just
table.remove(ProceduralDistributions.list["(the distribution target)"].items, "base.(item)")
and thats all?
No this actually wouldn't work.
The remove function takes numerical index of the data inside the table - so you need to find this index first.
Lua doesn't have built-in function for this but it looks like this:
for k, v in ipairs(table) do
if v == value then return k end
end
end```
Due to the way removing items from the table works, if you inserted twice then you can simply remove twice.
local list = ProceduralDistributions.list["(the distribution target)"].items
local target = "ItemName"
for i = #list-1, 1, -2 do
if list[i] == target then
table.remove(list, i+1)
table.remove(list, i)
end
end
btw is an joke what i said
thank you !
you get the reference?
I think it can be done like this
RemoveItemFromDistribution(ProceduralDistributions.list["(the distribution target)"].items, "Base.Item", nil, nil)
no?>?
reference from bandits mod
because it was an mod that i wished to come
how would i get that reference
idk
don't include the module for base items, they don't include the module when writing the distributions so they won't be the same string
good point, I was going by the example
vendingpop is a procedural generation list i can target, right?
its not showing up on a wiki list so i just wanna make sure
You can search in game files really fast and find that it exists in SuburbsDistributions.all.vendingpop.
well , it is NOT a target
but it can be one
tl;dr yes
so instead of
table.insert(ProceduralDistributions.list["BandPracticeFridge"].items, sodaVMrate)```
should i put
``` table.insert(Distributions.list["vendingpop"].items, sodaVMItemName)
table.insert(Distributions.list["vendingpop"].items, sodaVMrate)```
the answer is above
what
๐
they said it's under suburbsdistribution
right i dont understand what that means so im asking for clarification
but I can't find it in suburbs distribution
it only exist in base distribution table I can find
SuburbsDistributions = distributionTable;
o
so it inherits distribution table then modifies it
makes sense
youre speaking gibberish to me
tl;dr yes
but instead of Distributions use SuburbsDistributions
alright
though if suburbsdistributions inherits base distribution table why would you need to add it to suburbs distributions table specifically? @fast galleon
or would they only add it to suburbs table if they want it specifically in suburbs table
does anyone know how the game handles container overlays? how can i make a container have specified overlays when it has items in it?
I am not sure myself but I can refer you to how the vanilla game does it (look at the metal shelving thingy)
maybe you can find some of an answer there
i know it uses a table in java i just dont know what that contains exactly. thanks though maybe it will give an idea
let me check
so the (idk the name) wood shelves uses 2 different tiles obj for different state (full, not full)
furniture_shelving_01_26 and furniture_shelving_01_27
WorldFiller.lua#35 has this:
overlayMap["furniture_shelving_01_27"] = {{ name = "other", tiles = {"books&misc_01_27", "books&misc_01_31"} }, { name = "other", tiles = {"books&misc_02_27", "books&misc_02_31"} }}
idk if it's related at all but ๐คทโโ๏ธ
thanks dude ๐ this tells me that this is created in tilezed. idk how and also idk if i can make that happen in a mod but i think that overlay map may be the table im looking for, so i can atleast try to structure something and do addoverlays
also big find at the bottom i just saw confirms this! thanks a lot!
nice
im finding that because the missand the crit animation have their own conditional values, when either occur, they seem to take priority over my modded attacking animations. Can i attach something that would achieve the same effect as the following to the top of my xml files
<animNode x_extends="2HDefaulCrit.xml">
<animNode x_extends="2HMiss.xml">```
as the provided snippet doesnt allow me to load into the game
Gotta make multiple xmls to make extensions of all of those. Could also need to include the critical hit flag. I think the game prioritizes variables set recently because I know when I'm acting undead I can still jump or aim or whatever even though I have the acting variable set and no defined acting-and-aiming state
Adding the crit flag would at least increase number of recently set variables that align with that animation
just ont top of that, something like this wont work
xml:
<m_AnimName>kumpSwingAnimation</m_AnimName>
</m_2DBlends>```
lua:
kumpt.attackAnims = {"Bob_Attack1Hand03_Hit", "Bob_AttackBat02_Hit", "Bob_AttackBat03_Hit"}
if (i >= 3) then
i = 0;
player:setVariable("isKumpExtends", "false")
else
i = i + 1;
player:setVariable("kumpSwingAnimation", kumpt.attackAnims[i])```
so all conditions must be true for the animation to play right?
Yes but additional unrelated conditions can also be true
As long as their being false is not required
is there anything that prevents this from working? it simply just ignores everything and plays animations as normal
Nah the animation variable needs to be a condition not the AnimName referenced in a 2D blend
You're not setting animation variable in expected way
What is the name of the animation file?
there isnt one, its just the base animation=
Bob_Attack1Hand03_Hit
I havent added anything just yet, im just using the vanilla ones
So then for 2DBlends you would make the AnimName Bob_Attack1Hand03_Hit
Because that's the AnimName
That's what it means by AnimName
The filename of an animation file
okok, so 2DBlends corresponds to the animation file
Or it might also be able to blend into others. But that's not what determines the primary animation of the xml
No AnimName does
because previously i was changing both m_AnimName and the 2DBlends
2DBlends has other valid params too
AnimName is just one
AnimName often matches at top of xml and in 2D Blends in vanilla xmls
I refer to vanilla xmls for what will probably work and edit from there tbh
is there anyway to change <m_AnimName > with a var set in lua?
ie
<m_AnimName>VarName<m_AnimName>
then have a list of possible animation names in lua in a lsit
kumpt.attackAnims = {"Bob_Attack1Hand03_Hit", "Bob_AttackBat02_Hit", "Bob_AttackBat03_Hit"}
Ohhhhh now I see why you tried using that variable there
Hmmmm
I would try to get it to overwrite without a variable first. My recommendation for changing animation would be to just change the animation condition
In Act Undead the conditions for animations are strings so to switch from one to the next I would do something like :setVariable("attackAnimation", "attack1")
i just have 2 xml files, my file, and a modded defualt.xml with the condition
<m_Name>isKumpExtends</m_Name>
<m_Type>BOOL</m_Type>
<m_BoolValue>false</m_BoolValue>
</m_Conditions>```
up the top, to only enable it when my thing isnt being used
actually i lied, it takes a sec for the xml file to update
I dunno to switch animations I use different XMLs
I have not tried what you're trying tbh
Anim clip not found: kumpSwingAnimation
Interesting idea but would have to play with it and test
Sounds like it looked literally for kumpSwingAnimation.x or .fbx and found nada
Dunno if you can make it treat that as a player variable or not tbh
seems to treet this as just text
<m_AnimName>kumpSwingAnimation</m_AnimName>
Exactly
whats the best way to reload the game?
That may be fundamental to the system
istg it worked like 3 mins ago
Uhhh reloading game idk it sucks but animation files can be edited while game is running if they exist when you load in
They'll reload when you save em
is there another way to reffer to an animation file? insteaf of using animName?
Not to my knowledge
Idk how if so
That's how all the vanilla files I've seen do it
AnimName is always the string filename associated with a .X or .fbx
thats so annoying being so close, but being stopped by a slight setback
Well you can still do what you're thinking just differently
You need to use animation variable to set conditions to switch between XMLs
Instead of using a variable to change animation of a single XML
ill just have diff anim files, and pass a conditional string instead
i belive thats what you did correct?
Different animation XMLs
Animation "file" ambiguous
But presumably also different animations
sorry, yea. just the xml
For walking yes
And running and sprinting
when i player:say the follwoign
tostring(player:getVariableString("kumpSwingAnimation"))
it comes up with the correct attack animation names, like its reading it from the variable in the xml file correctly
Again I don't know all the things; maybe the 2D Blends can be used to accomplish what you're tryin, I'm not sure... But I haven't figured out that formatting mode
Not from the XML. From your player
Means you've set that variable on the player
Could not exist in any XML and still be set on player
so the right value, just isnt doing anything
Yeah sounds like that strategy is no good
Maybe skim the decompile for ways player anims are set during attacks to figure out how to trigger a blend into an alternate animation. I suspect it's possible but haven't solved how
Why do people change item params at runtime rather than just overriding the actual item script itself?
Apart from it being dynamic in lua
I mean I guess you don't have the "This item is overriden by Mod" message or whatever
tbh the message is kinda ugly
overriding an item script is a bad idea for a couple reasons
if the original item gets changed in some way your override will be out of date even if the changes would've been perfectly compatible
and if more than one mod overrides an item only one of their overrides will work
it's much much better to use code to change only the things you actually need to change than to replace the entire script
So... when I have a print command its showing up in the debug console window but not the in game chat window, any help?
Hi guys! Is there any mappers and modders who does stuff fit money?
Any idea if it's possible to accurately fetch a player's getLookVector on serverside? I was doing some debugging, and here's what I found:
Clientside
Player Position: (10905.0771484375, 10090.443359375)
Object Position: (10915.0771484375, 10100.443359375)
Object Vector (normalized): (0.7071067690849304, 0.7071067690849304)
Dot product: -5.9604644775390625E-8
Result: Player isn't looking at the Object```
**Severside**
```Running check for: Arendameth
Player Look Vector: (0.9087646007537842, 0.41730907559394836)
Player Position: (10905.0771484375, 10090.443359375)
Object Position: (10915.0771484375, 10100.443359375)
Object Vector (normalized): (0.7071067690849304, 0.7071067690849304)
Dot product: 0.9376757144927979
Result: Player is looking at the Object```
**Truth**
Player is, in fact, **not** looking at the object. The server-side ``player:getLookVector`` is not accurate
**Edit:**
Solved. Had to refer to a vectors approach.
You might wanna check the PZ Modding community for commissions
Oh, can I get some link or something?
Thanks!
Is there any standard way to extend in game items to hav additional variables ?
yes
moddata
item:getModData().yourvar =
Hello mates !
Quick question, do you have link or anything that explain how to create custom attributes on in game items ? For example, on my newly created glasses in my mod, I want to add a property to it like "eyes correction [X]"
Okay thanks, do in game items have unique ids per chance ?
The itemname in the scripts
I was asking basically the same as this
Yup haha I just saw !
Im going to Guess and say it works like this
item:GetModData().eyesCorrection = 8
Yep but this is to get the item value right ?
Before getting its value, I need to set it, and would like to print it on mouseover on the item
mmh oh I didnt read right, ok gonna try
But do you know the way to print this value on the mouseover on the item ?
var data = item:getModData().eyesCorrection
print( item:getModData().eyesCorrection) ????
gonna try this getModData() method, never used it yet
I suppose it will do the job ^^
I also have never let me know how you go
I am trying something like this for the tooltip on mouseover in the inventory, nothing great yet, keep you updated :p
hey did you figure out what reffrence id reffers to?
<m_2DBlends referenceID="1">
Hello~ I'm trying to reduce the chance of getting useful materials you get from disassembling furniture. Specifically, to reduce number of pipes I get from disassembling toilets, bathtubs, sinks etc. I hoped it'd be something as simple as editing recipes.txt, but it looks like MovableRecipes are in .class file :( I'm new to modding and was wondering if there would be an alternative way to achieve what I'm trying to do, or if there is a way to use the MovableRecipes.class file and code therein. Any help would be greatly appreciated!
Aye. Already reported this
Ty โก
@coarse sinew Since you're the master of building, are you aware if he could maybe override the destroy of furniture with its own or maybe another way if you know any ?
you can
1:
overwrite the tile property of the object you want l remove
2:
not sure if possible but maybe use OnObjectDestroy event(not sure about the proper syntax)
check if it has square parameter and just delete the objects from there
3:
hook on the dismantle function
its the pointer for the child animation
heres an example from the Idle.xml
<m_AnimName>Bob_Idle</m_AnimName>
<m_XPos>0.00</m_XPos>
<m_YPos>0.00</m_YPos>
<m_SpeedScale>0.80</m_SpeedScale>
</m_2DBlends>
<m_2DBlends referenceID="2">
<m_AnimName>Bob_Idle_HeavyBreathing</m_AnimName>
<m_XPos>0.00</m_XPos>
<m_YPos>1.00</m_YPos>
<m_SpeedScale>0.80</m_SpeedScale>
</m_2DBlends>
<m_2DBlends referenceID="3">
<m_AnimName>Bob_Idle</m_AnimName>
<m_XPos>0.00</m_XPos>
<m_YPos>0.04</m_YPos>
<m_SpeedScale>0.80</m_SpeedScale>
</m_2DBlends>```
in this case referenceID="2" is Bob_Idle_HeavyBreathing_Bat
tho i haven't actually used referenceID yet but thats just what i think it is
so if you see <animNode x_extends="Idle.xml">
then thats the child animation
also saying child is just my way of describing it i dont know the exact term for this
can you edit the reference ID with a variable? and if so, could you have a list of animations in a separate file that x_extends to said file file. that way you could call the animations by just changing the reference id and having only like 2 files, right?
mby i dont understand, but im just curious
<@&671452400221159444>
How do you set guys the zombie loot table ? is it with distribution with same methods as for the containers etc ?
Check ISMoveableDefinitions.lua for the tool and materials of those objects that are set in the properties of those tiles.
The entries where the tools and materials are added have difficulty and chance of drop.
nice words?
any info on how b42 will affect mods i.e. what kind of updates will mod authors need to do
Every mod will need at least a small update since they are changing the mod ID and stuff like that and how they are handled
Some mods will require massive rework but I think most mods will actually survive okay with the need for one or two changes here and there
People wanted cards to appear as loot - quick neat mod. I enjoyed making the artwork more lol.
They didn't appear as loot ?
not sure thats possible, but you can specify the blend without using the reference so you can still blend on a new anim
what relevance does the reference id have? like what does it reffer to? the n'th animation listed in a xml file or something?
you dont even need to add blends. aslong as the new variable requirements are met it will transition to the other xml
for making it shorter to type maybe?
not really sure.
cuz if you look at vanilla you will see thats how they did it
are you modding player or zombie anim?
I have a ready-made fbx zombie model. How can I add him to the game, assign him speed, strength. Also, how can I create unique abilities for him: ramming, jumping, throwing various objects, spitting acid, explosion after death. I know that some of these mechanics are present in other addons, then the question is - how can I take the mechanics of these addons and adapt them to my own?
try @bright fog 's framework
player
todo what exctly
Like Glytcher mentioned, my framework helps handling anything related to stats of zombies
I'm still writing the guide for it however, let me send you the WIP
(I explain the framework and basic stuff)
yep , @tribal moth you wont need to do the sync and manually making the stats etc.
if this existed before i did my zeds i would have used this too tbh
@bright fog
a guide would be nice btw
Read the github
I sent here
I'm writing it but it's stil WIP
oh havent checked the git. only the workshop lol
ayt
oh wow didnt know there was a guide lol
Still got a bunch to write down. I'm currently reworking something in the framework before continuying writing it
So you can extremely esily define weights for clothings, and for males and females
I realized that the guide is not finished. But it will tell you how to make a zombie have a unique ability that is not in the vanilla game? Will it be possible for him to change his appearance like in OccultZombies, not limited to just clothes?
Yes my framework allows you to change the visuals of zombies easily
For abilities you'll have to code them however
With customBehavior
Once I write the guide on this it'll help understanding it but it's basically triggering functions within customBehavior only for this specific zombie
OnZombieUpdate
Then I have other tags for specific timings
Like onThump when a zombie thumps a structure
Or when attacking a player, or when agro on a player
When dying
I donโt think that with a regular tag I can add the zombieโs ability to jump, explode, throw objects, etc.
first step is to turn your zed into "special zed"
or "modded zed"
then add the necessary functions and animations for those feature
also research hitreact
"then add the necessary functions and animations for those feature" - How?
Tags are not what you think
It's a tag for the zombie type to run specific code
Bcs you need to differentiate your zombie with other zombies
And my mod does that
That is, tags are some kind of presets, and if I write a certain tag, then I am writing a zombie whose abilities and behavior are not provided for by the vanilla game
You still need to code the zombie ability that's for sure
To clarify as zombie loot
Okay, I'll start delving into this topic later. I hope the guide will be finalized and detailed, but in any case it is not enough to have models for the zombies that I want, their behavior requires codes and animations, which is not enough for moth skills.
But my mod allows you to not have to make any code to handle zombies and zombie differentiation AND allows your mod to run alongside other custom zombie mods easily
Models are done by creating a clothing
And applying it on the zombie
I do it with my bloater by making it an outfit
What Mystery did for her Occult Zombie mod is every zombies has an outfit applied to them
The outfit having the model as a clothing
queue animations for the player, using lua
pre much
I've been going at this for hours now and I still don't understand why my custom outfit doesn't get recognized by the game (it doesn't show up in horde manager). I've read every single thread on here about outfits, I've crossed referenced like five mods, and I've done pretty much all the usual suggestions (i.e. random/unique guid for the outfit, defining all the clothing used in fileGuidTable.xml, etc) and still, somehow, the game won't consider it a proper outfit, need some pointers on how to actually get the outfit to at least be spawnable
here's the clothing.xml in case I did it wrong: https://pastebin.com/2PZq7J8v
and fileGuidTable.xml: https://pastebin.com/FHkAiZt5
also you fine, pinged them few days ago for same thing 

Shameless self-ad 
https://steamcommunity.com/sharedfiles/filedetails/?id=2914075159
Big thanks to @mellow frigate @sour island and few others who I bullied in here with questions 
Getting initial thing to work was the hardest part
then it's jsut filling up the page
So update out ? ๐
Nice
Nice update! ๐ฎ
I removed the message, can't time out or ban people lol
His last message was from exactly last year this time
can admin target specific player moddata?
say I want getPlayer():getModData().EvolvingTraitsWorld.AsthmaticCounter = -getPlayer():getModData().EvolvingTraitsWorld.AsthmaticCounter this command to be ran by admin for specific player
I don't think players have a transmit - but you could try sending the command using the intended player's ID but the command would need to hit all clients
You could check how the admin's edit player stats is handled
I know you can send IsoPlayer and Inventory items though commands as their objects - but I ran into an issue showing it has the same "ID" but isn't the same object
hm
is there a way i can make a custom playstyle, like Apocalypse or Builder?
Oooh! Exactly what I was looking for tyvm!
or does anyone know of any mods that do this so i can reference how they do it?
also this ended up not working
even using normal distributions table?
?
well there's Distributions table which is like the base of the distributions
Sending chat messages with LUA? How would I go about doing that? Just a general /all chat message.
then there's SuburbsDistributions which is a subset of distributions that inherits Distributions table
` <--- that thing 3 times at the beginning and end of what you wanna type
wait i might misunderstand
why the difference?
Just want to put a string into the chat window basically and unsure what function/methods to use
I think suburbsdistributions only applies to certain areas
it's not a subset, they are the same table
not fully sure, just guessing
o
I thought SuburbsDistributions adds to the table after it inherits the base one
they're just two different variables pointing to the same table
this is what i have for testing
-- Soda Vending Machine Distribution
ProjectGurashi.BookDistribution = function()
for _, sodaVMItemName in pairs(sodasVM) do
table.insert(SuburbsDistribution.list["vendingpop"].items, sodaVMItemName)
table.insert(SuburbsDistribution.list["vendingpop"].items, sodaVMrate)
table.insert(ProceduralDistributions.list["BandPracticeFridge"].items, sodaVMItemName)
table.insert(ProceduralDistributions.list["BandPracticeFridge"].items,
end
ItemPickerJava.Parse()
end
why would SuburbsDistributions even exist then
It's SuburbsDistributions iirc not SuburbsDistribution
oh i see actually, Distributions is for the weird table merging thing they have
i misremembered, SuburbsDistributions is actually Distributions[1]
even more confusing...
iirc it's something like if you have a distribution table and insert it into Distributions it merges them all together before they get parsed
but from what i've seen nobody really does things that way anyway, they just insert into SuburbsDistributions
oh so it's basically just a table of tables that get merged
yep still nothing
btw I don't want to sound like a shill but you should use vscode with https://github.com/asledgehammer/Umbrella because with lua it will fix a lot of these small headaches like missing a letter on a global
when are you calling this function in the game btw
idk if you can change distributions at runtime (like mid-game) but I've always done and seen it done in OnGameBoot
Events.OnInitGlobalModData.Add(ProjectGurashi.Distribution)
this is what i do
i jsut go back to tile screen and reload lua and make a new save
you need to do it on OnInitGlobalModData to access sandbox options
oh true
the ItemPickerJava.Parse call forces the game to re-parse the distribution table since that would have already happened by then
still nothing..
;-;
btw
you called your func BookDistribution
oh ok
was that after or before you posted the ss above
local sodasVM = {
"ProjectGurashi.BossBlackCannedCoffee",
"ProjectGurashi.Ramune"
}```
```local sodaVMrate = 80
-- Soda Vending Machine Distribution
ProjectGurashi.SodaVMDistribution = function()
for _, sodaVMItemName in pairs(sodasVM) do
table.insert(SuburbsDistributions.list["vendingpop"].items, sodaVMItemName)
table.insert(SuburbsDistributions.list["vendingpop"].items, sodaVMrate)
table.insert(ProceduralDistributions.list["BandPracticeFridge"].items, sodaVMItemName)
table.insert(ProceduralDistributions.list["BandPracticeFridge"].items, sodaVMrate)
end
ItemPickerJava.Parse()
end```
```Events.OnInitGlobalModData.Add(ProjectGurashi.SodaVMDistribution)```
before
I honestly have no idea, I practically do the exact same thing in my code
im literally like side-by-side with my code and yours and I have no idea
im just having things not work recently for reasons i cant figure out
like this recipe
this is my entire script for recipes
{
recipe Unpackage Bentou
{
PackagedBentou,
Result:Bentou,
Time:60.0,
}
}```
i had more modifiers and stuff
but on it not working (despite me literally just copying and modifying stuff from the vanilla recipes) i just tried cutting it down as simple as possible
whats the file name of the file it's contained in
I am going off a whim here and I doubt it will work but try changing the file name to recipes.txt which will override the game's one
like this code and mine below are practically the same yet mine works and yours doesn't ;-;
for _, v in pairs(distributions.toothbrush.containers) do
for k2, v2 in pairs(distributions.toothbrush.items) do
if k2 == "item" then
v2 = (mod_constants.MOD_ID .. v2)
end
table.insert(ProceduralDistributions.list[v].items, v2)
end
end
like you even put .items at the end of the distribution table and everything
do you have an example of putting something in suburbsdistributions?
no, I am looking at suburbsdistributions rn
but it should practically be the same
like down to the T
wait
@unreal pewter
remove .list from suburbsdistirbutitesniyjhsig
hoowever you spell it
so
table.insert(SuburbsDistributions["vendingpop"].items, sodaVMItemName)
table.insert(SuburbsDistributions["vendingpop"].items, sodaVMrate)
so it's just table.insert(SuburbsDistributions["vendingpop"].items, item)
yes
I am like 99% sure SuburbsDistributions doesn't have a "list" member
because lua
vendingpop doesn't even exist for SuburbsDistributions
right it exists in just normal Distributions file right?
yes
should i try Distributions instead?
probably
the distributions file defines SuburbsDistributions
the actual SuburbsDistributions file is just a bunch of util functions and the merging code
im so confused and im not even making the mod and my vscode kicked the bin so I have to wait
most of my experience modding has been pure confusion
just do Distributions["vendingpop"]
try that, I don't think it has list member like ProceduralDistributions does
require("Items/Distributions") -- Is this even needed since it's a global?
table.insert(Distributions["vendingpop"].items, eeeeeeeee)
requiring vanilla files does nothing whatsoever
Did this not work for you? You need the all table
literally table.all.anotherTable
do i need the .items at the end?
yoo i just today started modding this is a pretty newbie question but how do i make sure that the game knows that my mod requires another mod for example Simple UI Library?
uhh so table.insertSuburbsDistributions.all.vendingpop.items, sodaVMItemName?
add brackets ()
add require= to your mod.info followed by the id(s) of the mods your mod requires, with commas to separate them
ok thank you!!
while i have you here, do you know if its possible to create a new playstyle like apocalypse or builder, or at least replace one already in the game?
i tried finding the game files where it defines these but i couldnt find them anywhere
A lot of this is in lua so yes, but adding a new one would require to patch a few UIs to show the new mode.
dam I must've missed it
which i think wouldnt require modifying the ui, or at least require it less
survivor.internal = "APOCALYPSE";
survivor.mode = "Apocalypse";
survivor.desc = getText("UI_NewGame_Apocalypse_desc");
survivor.thumb = "media/ui/spiffoSurvivor2.png"
survivor:initialise();
self.mainPanel:addChild(survivor);
survivor.onMouseDown = NewGameScreen.onMenuItemMouseDown;
survivor:setOnMouseDoubleClick(self, NewGameScreen.dblClickPlaystyle);
self.survival = survivor;
local survivorDesc = ISLabel:new(survivor:getRight(), y, mediumFontHgt, " - " .. getText("UI_NewGame_Apocalypse_desc"), 0.5, 0.5, 0.5, 1, UIFont.Small, true);
survivorDesc:initialise();
self.mainPanel:addChild(survivorDesc);
y = y + FONT_HGT_LARGE + 4;
MainScreen.instance:setSandboxPreset(MainScreen.instance.sandOptions:getApocalypsePreset());```
i found these two things in NewGameScreen.lua
thought cant really figure out where its referencing things like getApocalypsePreset from
i found GameMode.class but i cant open that file in a readable way
well sandOptions is a SandboxOptionsScreen
see:
function SandboxOptionsScreen:getBeginnerPreset()
local newPreset = {};
newPreset.name = "Beginner";
newPreset.options = SandboxOptions:new()
newPreset.options:loadGameFile(newPreset.name)
return newPreset;
end
function SandboxOptionsScreen:getApocalypsePreset()
local newPreset = {};
newPreset.name = "Apocalypse";
newPreset.options = SandboxOptions:new()
newPreset.options:loadGameFile(newPreset.name)
return newPreset;
end
function SandboxOptionsScreen:getSurvivorPreset()
local newPreset = {};
newPreset.name = "Survivor";
newPreset.options = SandboxOptions:new()
newPreset.options:loadGameFile(newPreset.name)
return newPreset;
end
function SandboxOptionsScreen:getBuilderPreset()
local newPreset = {};
newPreset.name = "Builder";
newPreset.options = SandboxOptions:new()
newPreset.options:loadGameFile(newPreset.name)
return newPreset;
end
and say for survivor preset
It calls loadGameFile with the preset name which loads media/lua/shared/Sandbox/<preset>.lua
like survivor media/lua/shared/Sandbox/Survivor.lua
And all that lua file returns is a massive list of all the sandbox options it wants to define
I am guessing it loads the default of a specific sandbox option if it isn't specified in that table but I can't know for sure rn
I hope that helps speed up your research a bit
oh wow thats incredibly helpful thank you
i wish i knew lua more so i could figure this out on my own
.
it gives you type defs on all the documented globals
it's super helpful for anything pz lua related, that's how I dug and found the stuff above
ill look into how to set it up, thakns
I use that and sometimes I open the pz media folder so I can just search all files for specific words or strings
i searched apocalypse and survivor and sandbox but nothing like this showed up
well I basically just saw that func getApocalypsePreset then just searched all the game's lua scripts for that same function and the above just showed up
hh i see
You can achieve this by modifying material definitions in Lua.:
local materialDefinitions = {
Wood = {
{ returnItem = "Base.Plank", maxAmount = 3, chancePerRoll = 20 },
{ returnItem = "Base.Nails", maxAmount = 1, chancePerRoll = 10 }
},
Log = {
{ returnItem = "Base.Log", maxAmount = 3, chancePerRoll = 15 }
},
Steel = {
{ returnItem = "Base.Screws", maxAmount = 3, chancePerRoll = 10 }
},
Plumbing = {
{ returnItem = "Base.Screws", maxAmount = 3, chancePerRoll = 10 }
},
Electric = {
{ returnItem = "Base.Screws", maxAmount = 3, chancePerRoll = 10 }
},
Fabric = {
{ returnItem = "Base.Thread", maxAmount = 1, chancePerRoll = 20 },
{ returnItem = "Base.RippedSheets", maxAmount = 3, chancePerRoll = 10 },
{ returnItem = "Base.Sheet", maxAmount = 1, chancePerRoll = 1 }
},
Leather = {
{ returnItem = "Base.Thread", maxAmount = 1, chancePerRoll = 20 },
{ returnItem = "Base.LeatherStrips", maxAmount = 3, chancePerRoll = 10 }
},
Natural = {
{ returnItem = "Base.Twigs", maxAmount = 3, chancePerRoll = 10 }
}
}
local function overrideMaterialDefinitions()
local moveableDefinitions = ISMoveableDefinitions:getInstance();
for material, definitions in pairs(materialDefinitions) do
-- clear existing material definitions
moveableDefinitions.removeMaterialDefinition(material);
-- add new material definitions
for _, def in ipairs(definitions) do
moveableDefinitions.addMaterialDefinition(material, def.returnItem, def.maxAmount, def.chancePerRoll);
end
end
end
Events.OnGameBoot.Add(overrideMaterialDefinitions)
This script clears the existing material definitions and sets new ones with your desired chances. Adjust the chancePerRoll and maxAmount to reduce the max amount and probability of getting specific items. The values in materialDefinitions are the default vanilla.
There are also built objects in which the items used to build are saved in modData, there are no standard values for this, each object has different materials, a solution could be to divide in halves/quarters/eighths the materials that can be dropped.
<@&671452400221159444> 
so i was able to modify the settings for Apocalypse but how does it work if i wanna provide settings for a mod?
do you mean you want to add changeable sandbox settings?
no
its complicated
im trying to change certain aspects of apocalypse difficulty for my standalone map
and i wanna make it so if you have certain mods enabled, specifically this one that adds clothing, apocalypse difficulty will ALSO set sandbox settings for that mod
if getActivatedMods():contains("the mod id here") then
what would cause sandbox options to just not show up in game?. 2 nights ago i made a mod with sandbox options. today i transfered it to its own test mod from my generic testing mod and now those sandbox settings dont work
Make sure there are no syntax errors in your sandbox options, like missing a comma, or a double comma, or wrong setting type, etc etc. In worst cases, you can delete all settings and add them one by one to find the issue
i didnt change anything when moving it over to the new mod. i basically draged the files over to the new mod all in the same paths. and it was working fine before i changed it into its own mod
Would you happen to be subscribed to the new mod on steam workshop and the changes done only locally?
ive unsubbed to both mods. rejoined the server and downloaded the mod from the server, and it has all the settings and everything.
i think im gonna try to reinstall my test server see what happens when it redownloads all the mods from scratch
Not quite sure what's going on there then honestly. Only two reasons I can think of ^
yeah im not sure either. it was in my TestingMod. worked fine. today i made a new mod for it by dragging the files over. deleted the files from my TestingMod added the new mod to the test server. no more sandbox settings
its making me think its trying to pull the sandbox settings from the testingmod still
Anyone know of any mods that allow custom zombie spawn zones? Essentially like Minecraft MobSpawners. You walk within the radius of a marker and it force spawns a pre set amount of zombies around the marker or something along those lines. I'm trying to find a workaround for an underground map, zombie spawns are a bit janky because essentially the entire map is a building and there are no true outdoor areas.
I know there are server commands that can spawn zombies on request so I imagine something like that would be possible but I don't know if anyone has approached it that way yet.
I wouldn't know about ones that would spawn a group like a triggered trap - if that's what you'd like. But what you're saying is doable.
i think there is let me find it
Not so much as a trap although that would be cool. Moreso as a way for map creators or server admins to populate maps in a very specific way or set up zombie hives. Like say a server admin wants to use that gloomy places mod to add sewers but they want it to be filled to the brim with zombies. I'm hoping I can come up with something that will allow the admin to place markers within the sewer and have those markers trigger a pre defined amount of zombies to spawn should someone enter a radius. Something like that
That would be great, thanks mate.
There is an issue on multiplayer though, read the comments about it. basically it desyncs and spawns zombies over and over
https://steamcommunity.com/sharedfiles/filedetails/?id=2992366401&searchtext=zombie+event
That sounds like a pain to fix
Is there specific documentation on multiplayer modding or is it a crapshoot?
i have never modded any other game so i wouldnt know how to compare it. but theres alot of community made guides, alot of people in here help eachother out and theres these website https://projectzomboid.com/modding/ and https://pzwiki.net/wiki/Modding
thats everything that i know of/that ive been using
Alright, thanks for the help mate!
does anyone know if there is a problem with removeItemOnServer() or maybe it works differently than addItemOnServer()? I have been using addItemOnServer() for a while without issues but can never get removeItemOnServer() to work with an identical code setup.
Asking here again, does anyone know how to send chat messages with LUA? I just need to add like a welcome message in chat when a player joins (not the one in server.ini!!)
Pair this with OnCreatePlayer
can someone please send me vanilla AnimSet for melee 2 handed (only xml files), i accidentally edited mine... whoops
verify files
Algum br ?
hmm is there a way to spawn pieces of paper pre written on? like if i want to spawn an item in a players inventory that has rules written on it or something
You can modify the tooltip so yes
I could really use some help here https://theindiestone.com/forums/index.php?/topic/71631-help-adding-xp-to-other-player-in-multiplayer/
I'm very need to modding in Project Zomboid so please forgive me if I'm overlooking something. I'm trying to create a mod where if you sitting next to another play that is actively gaining xp then you'll also gain xp. The idea is kind of like an apprenticeship mod, anyways, I'm having trouble add...
Is it possibile to use <probability> in the <subitems> on a clothing .xml like so?
<probability>0.1</probability>
<itemGUID>b53aaf11-929c-4506-8310-e9b26d5f20eb</itemGUID>
<probability>0.1</probability>
<subItems>
<itemGUID>3cac5469-f9d2-4462-8fb2-063be1b63450</itemGUID>
</subItems>
Nevermind, I figured it out, it has to be nested within the <subItems> tag.
Actually that doesn't seem to work either.
if im trying to get a model to work in-game, what specifically do i have to do? i have this code in media\lua,
getWorldStaticModels():addModel("ProjectGurashi.BossBlackCannedCoffeeModel", "media/models/bossblackcanmodel.x")
getTexture("media/textures/bossblackcantexture.png")
end
Events.OnGameBoot.Add(definePGModels)```
and in my item definition
``` StaticModel = BossBlackCannedCoffeeModel,
WorldStaticModel = BossBlackCannedCoffeeModel,```
under my canned coffee item
when i drop the item in-game it just shows the icon on the floor
im new to model stuff so is there any obvious issues here from me just not knowing how to do this?
i'm pretty sure you don't need Lua code for this
but world item models normally go into media/models_X/WorldItems
Any reasons you try to add model throught lua?
i wasnt aware that you CAN do it without lua
i literally asked chatgpt (something i need to stop doing for giving me chronically horrible answers)
with that capitalization?


