#mod_development

1 messages ยท Page 247 of 1

thick karma
#

(and screenshot)

unreal pewter
#

@thick karma

thick karma
unreal pewter
thick karma
#

Looks like you must not have ProjectGurashi module declared anymore

#

Function name should be ProjectGurashi.addBook

#

Above that you need local ProjectGurashi = {}

bronze yoke
#

but if the module wasn't declared the error should happen further up when you try to add to it right?

thick karma
#

I think maybe they changed that

unreal pewter
#

how can i just go from the debug error screen straight back to the main menu

thick karma
#

Not really possible unless you're accessing it from Main Menu

unreal pewter
#

guh

pulsar sinew
#

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,
        }
    }
}
unreal pewter
#

@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

drifting ore
#

is your file missing local ProjectGurashi = ProjectGurashi or {} at the beginning?

unreal pewter
#

apparently

grizzled fulcrum
#

the whole MyMod = MyMod or {}

drifting ore
#

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

grizzled fulcrum
#

but it's not like the file gets ran multiple times so how would MyMod = MyMod and not equal {} always?

drifting ore
#

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.

unreal pewter
#

the classroomshelves dont show that the books are in the loot pools and the desks just show an error screen

grizzled fulcrum
grizzled fulcrum
#

but scroll down to the bottom of the errors scrolling text thing

unreal pewter
#

i just cloesd it

#

gimme a minute to pull it up again

drowsy fjord
#

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.

grizzled fulcrum
#

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

drowsy fjord
grizzled fulcrum
drowsy fjord
#

the "takepill.lua" file is where the player stats gets changed.

drowsy fjord
grizzled fulcrum
grizzled fulcrum
#

in the ProjectGurashiDistributions.lua

unreal pewter
#

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

grizzled fulcrum
#

just an FYI, make sure your distributions on server side

unreal pewter
#

its in lua\server

grizzled fulcrum
#

ok that is fine

#

well the game is complaining that your distribution's chance is fucked somehow

drifting ore
#

the truncate function is not in the file

grizzled fulcrum
#

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)

unreal pewter
#

no thats the whole file

grizzled fulcrum
#

;-;

unreal pewter
#

i just copy pated what cs typed earlier

grizzled fulcrum
#

you're trying to call truncate function that doesn't exist

unreal pewter
#

ill go grab it again

drifting ore
#

i probably clipped it out without looking

grizzled fulcrum
#

don't copy paste, kids!!!!!!!!!!!!!!!!!!!!!!!!!!!

drifting ore
#

don't replace the entire file, just relevant bits

drowsy fjord
grizzled fulcrum
#

so long as the sound script defines the sound as MySound in the above example

unreal pewter
#

YESS ITS WORKING

#

thanks a lot for the help

drowsy fjord
# grizzled fulcrum one you have the sound script, you can add the sound like you would any other in...

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
}

}

grizzled fulcrum
#

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

drowsy fjord
#

It's the take pill action

grizzled fulcrum
#

ok nvm

drifting ore
#

pretty important feature over a lot of "classic" languages where trailing comma is forbidden

grizzled fulcrum
echo lark
#

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

frank elbow
#

Unsure whether it's the case for that one, but plenty of script handling code is done by reading until a comma

grizzled fulcrum
#

I just add them for uniformity idk why

drifting ore
frank elbow
#

It's been a common answer to script confusion here in the past

grizzled fulcrum
drifting ore
#

that whole system looks almost like a MIDI font

frank elbow
#

God I wish

#

SoundFonts and MIDI support would be lovely, plus more fmod access

drifting ore
#

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.

frank elbow
#

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

drifting ore
#

Eh. If it's good enough for Minecraft, it's good enough for you.

frank elbow
#

Like yeah, through a Java mod anything can be done but they require manual installation so they're less โ€œsafeโ€ anyhow

drifting ore
#

Besides. With that kind of logic you run afoul of the whole idea of modding, by restricting what people can and cannot mod.

frank elbow
#

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

drifting ore
#

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.

frank elbow
#

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

drifting ore
#

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.

frank elbow
#

Nonetheless the simplicity of dropping mods into a folder is due to the loaders, not the game

drifting ore
#

Allright fair enough.

drowsy fjord
drowsy fjord
#

I'm gonna go snuggle with my pug and come back to this issue in a little bit.

unreal dust
#

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 :(

echo lark
#

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

rancid barn
#

the way that vhs dialogue gives or removes moodles i set up wrong when i wanted to do 2 moodles

drowsy fjord
oblique venture
#

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

unreal dust
#

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.

oblique venture
#

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.

echo lark
# fleet bridge 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

true pollen
#

Does anyone know what can it be? It says I don't have enough propane units, but I have many.

oblique venture
#

dont

true pollen
unreal dust
# oblique venture same for texture.

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. ๐Ÿ™‚

oblique venture
oblique venture
true pollen
oblique venture
#

do that

unreal dust
#

Yes, trying it out currently.

true pollen
# oblique venture correct

You can't see it, but I'm giving you a standing ovation, I would never find out it was that mod.๐Ÿซก

oblique venture
unreal dust
#

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. ๐Ÿ‘

oblique venture
#

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

unreal dust
#

It is just re-meshed vanilla model, I don't know what is causing this.

oblique venture
#

was it a .x file that you converted to .fbx?

unreal dust
#

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.

oblique venture
#

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

unreal dust
#

Got it, thank you. I'll just scale it down XD

oblique venture
#

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

unreal dust
#

Bravo, thank you, it all worked out well. I now only have three hours for sleep before job, so might as well. Thank you.

echo lark
#

i was just looking for something like removeXpMultiplier without thinking it through

thick karma
#

Had to tune out for awhile

unreal pewter
#

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

thick karma
#

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.

unreal pewter
#

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

frank elbow
#

If it's gonna be constant then you ought to just use the value that it'll ultimately be

thick karma
unreal pewter
#

im trying to figure out the most efficient way to organize this

unreal pewter
#

currently trying to think of a good way to organize things and then im gonna finish adding a couple other items

drifting ore
#

well it appears a good way of organizing it

unreal pewter
#

i guess ill just do a different function for each category of items i wanna do

drifting ore
#

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.

unreal pewter
#

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

drifting ore
#

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

unreal pewter
#

oh i just realized i can also make a list of locations to distribute to

drifting ore
#
table.insert(ProceduralDistributions.list["ClassroomDesk"].items, ProjectGurashi.Kokoro )
table.insert(ProceduralDistributions.list["ClassroomDesk"].items, ProjectGurashi.Yoakemae )```
etc
drifting ore
#

an example how you can do all of this manually

unreal pewter
#

oh, yeah

thick karma
# unreal pewter uh well im in the middle of editing some stuff ubt sure

Okay:

  1. local ProjectGurashi = ProjectGurashi or {} should just be local 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.
  2. You don't need truncate if you're not doing any kind of math with rate.
  3. Encapsulating books as ProjectGurashi.books and returning ProjectGurashi at 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.
  4. Adding end to 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.
  5. 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 addBook above.
  6. Since addBook in fact adds a list of books, I'd rename it.
  7. If rate were 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
unreal pewter
#

thats what i was gonna default to at first

thick karma
#

Anyhoo good luck

unreal pewter
true nova
#

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?

drifting ore
#

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.

true nova
#

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

drifting ore
#

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.

unreal pewter
#

how could I make it so when an item spawns in a container a certain amount will spawn?

true nova
drifting ore
unreal pewter
#

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

true nova
#

make it just 15

unreal pewter
#

i see

true nova
#

youre trying to call the position of ProjectGurashi at 15 which doesnt exist

unreal pewter
#

oh right

#

also

#

i can use break to end a loop but continue a function, right?

drifting ore
#

yes

unreal pewter
#

alright cool

drifting ore
#

why do you need to end the loop though?

unreal pewter
#

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

drifting ore
#

i don't get it but it sounds like the program doesn't needs to be this complicated

drifting ore
#

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

unreal pewter
#

well

drifting ore
#

anyway you can just have multiple separate lists of objects for multiple separate loops

unreal pewter
#

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

drifting ore
#

yeah I figured this is where break would go

#

no it's not gonna work like this

unreal pewter
#

why not?

drifting ore
#

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

thick karma
#

And then move to next round?

#

Just to clarify intention?

drifting ore
#

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.

unreal pewter
#

ill just get rid of the return

unreal pewter
#

i thought break would end the loop but not the function

#

so i could put it after the loop

drifting ore
#

well yes that's what it does

#

but you need to loop over all the books

#

and it stops on the 1st book

unreal pewter
#

so how do i make it not do that

thick karma
drifting ore
#

in this case, you just don't need it

unreal pewter
#

does until true end go before or after the loop

drifting ore
thick karma
unreal pewter
#

whar

thick karma
#

It's a one-round loop in a loop

drifting ore
#

yeah exactly, that whole thing doesn't makes sense. Well repeat X until true is the same as do X end

thick karma
#

Therefore break breaks the inner loop

#

Using break as continue might work with do X end as well

#

Never tried it with that

drifting ore
#

break is illegal outside of loops

#

anyway

thick karma
#

Well that why you use repeat until true

#

It counts as a loop

drifting ore
#

@unreal pewter you simply don't need break in the loop

unreal pewter
thick karma
#

Sec, I'm on a phone

drifting ore
unreal pewter
#

oh i see

thick karma
#

Ignore CS

unreal pewter
#

so should i just leave it how it was

thick karma
#

He is a fool

#

And has been combative for hours

#

And provided wrong answers repeatedly

unreal pewter
#

woah so true

thick karma
#

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

unreal pewter
#

actually i will kindly pass this time

thick karma
#
for key, value in pairs(values) do repeat

    thisHappensEveryLoop()

    if youNeedToBreak then break end

    thisOnlyHappensIfYouDoNotBreak()

until true end```
#

This is all you need

drifting ore
#

you're missing another end

thick karma
#

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

north drift
#

For loop, while loop, do while if you understand these three loop styles this all makes sense.

thick karma
#

It's another to tell others not to follow good advice

unreal pewter
#

for loop do loop until end

thick karma
drifting ore
#

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

thick karma
drifting ore
#

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.

thick karma
# unreal pewter for loop do loop until end

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.

north drift
#

Not know Lua very well, this explanation seems weird, could you not just use an if statement

drifting ore
north drift
#
for key, value in pairs(values) do

    thisHappensEveryLoop()

    if NOT youNeedToBreak then 

                      thisOnlyHappensIfYouDoNotBreak()
     end

end```
drifting ore
#

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.

thick karma
#

Totally fair alternative of course

drifting ore
#

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.

north drift
#

I would propose that it is less nesting as you replace the if statement but remove the inner loop.

thick karma
#

Yes it may require 2 or 3 more brain cells and a couple more seconds to understand than a normal for loop

north drift
#

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.

drifting ore
#

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.

north drift
#

I mean, I don't think that really is an issue tho

drifting ore
#

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.

north drift
#

Lol

#

I'm pretty sure all programing is basically magic.

#

Honestly there are very few cases for break

#

Or should be, atleast

drifting ore
#

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.

drifting ore
frank elbow
#

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

drifting ore
#

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.

frank elbow
#

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

drifting ore
#

ah. Well, hence "lite".

frank elbow
#

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

drifting ore
#

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

frank elbow
#

I disagree, considering it'd more clearly be a block

#

But ultimately all of this comes down to preference

drifting ore
#

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.

unreal pewter
#

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```
true nova
#

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?

unreal pewter
#

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

drifting ore
#

Can you show the item script for bento box?

unreal pewter
#
    {
        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,
    }```
drifting ore
#

module is ProjectGurashi right?

unreal pewter
#

right

#

any ideas?

drifting ore
#

None.

unreal pewter
#

im so confused whats wrong

#

no errors, either

drifting ore
#

For now I can only suggest a way to automate location and probablity coding, while this problem is awaiting solutions.

unreal pewter
#

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

true nova
#

that means the distribution is done right

unreal pewter
#

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

drifting ore
#

ctrl+f through the original distributions file finds no instances of KitchenFridge or ConvenienceStoreShelves

#

have you been getting Lua errors?

unreal pewter
#

none

#

well, some, but unrelated

true nova
#

i would think that would break it

unreal pewter
#

related to how i dont have a model assigned to bentobox

#

which i dont thikn is an issue

true nova
#

comment those two lines out and try?

drifting ore
#

well either way, try replacing those two locations with something that you copy and paste from the ProceduralDistributions.lua file

unreal pewter
true nova
#

well 4 wherever you put KitchenFridge or ConvenienceStoreShelves in your distribution

unreal pewter
#

lemme try some stuff

drifting ore
#

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.

unreal pewter
#

i swear to god i thought kitchenfridge existed i think im actually insane

drifting ore
#

there exist 17 varieties of kitchen fridge, but not KitchenFridge specifically

#

it's what I mean by "partial matches don't count"

true nova
#

i would suggest CafeKitchenFridge,DinerKitchenFridge,FridgeGeneric,FridgeRich,FridgeTrailerPark

unreal pewter
#

oh my god it works now, im insane

#

im so upset that that was the issue

true nova
#

your insanity will only increase with time. Lucky CS found it cause i think i thought about that earlier but completely didnt consider it

drifting ore
#

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.

unreal pewter
#

well, thank you

chilly ermine
#

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?

true nova
# chilly ermine when you assign a weapon swing animation value to an item, say you set it to bat...

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

Welcome to this guide, where you will finally make your own animations and you will learn basic concepts about animations on Project Zomboid.
(Original Author: Dislaik)...

chilly ermine
true nova
chilly ermine
thick karma
chilly ermine
#

sorry I deleted my previous msg bc I thought it was stupid

thick karma
# chilly ermine 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

chilly ermine
#

and I'm guessing that the <animNode> tag thing refers to what the provided code will override?

thick karma
#

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

thick karma
#

2HDefault will still behave normally when YOUR_CUSTOM_PLAYER_VARIABLE == false

chilly ermine
thick karma
#

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

chilly ermine
#

so the placement of the scripts dont matter?

thick karma
#

@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

chilly ermine
thick karma
#

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.

thick karma
#

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

chilly ermine
thick karma
#

"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

chilly ermine
#

why are you guys so helpful lmfao

thick karma
#

Mine are in media/anims_X/ActUndead

#

My .X files

#

They work fine there

chilly ermine
thick karma
#

Examples:

chilly ermine
#

curiously, could I set a variable inside the XML file? and adjust the animation speed from the lua script?

thick karma
thick karma
#

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.

chilly ermine
#

so in Ur case the animation speed affects walking speed?

thick karma
#

Yeah

#

zombieSpeed is for when players are acting like zombies

#

I set that whenever I set the player's movement animation

chilly ermine
# thick karma

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

thick karma
chilly ermine
#

sorry, but I think I understand the premises now. it's called "act undead" correct?

thick karma
#

yeah

hollow talon
#

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

chilly ermine
#

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?

drifting ore
#

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.

unreal pewter
#

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,
    }
}```
grizzled fulcrum
unreal pewter
#

the vanilla recipes do both

grizzled fulcrum
#

ok then I am unsure as that looks like it should work -_-

drifting ore
#

It might not make any difference but all recipes that I've looked at have a blank line between ingredients and the rest.

unreal pewter
#

yeah i did that at first

unreal pewter
#

still didnt work

grizzled fulcrum
#

๐Ÿ˜ญ

unreal pewter
#

lua moment

#

lua is allergic to working properly

grizzled fulcrum
#

is it a chance that it's in the wrong directory?

unreal pewter
#

maybe?

#

its in scripts

#

which is where the vanilla game has the recipes file

grizzled fulcrum
#

hmm true

#

maybe you might need to import base?

unreal pewter
#

tried that

grizzled fulcrum
#

oof

unreal pewter
#

didnt work and the game says it automatically imports base anyways

unreal pewter
#

yes ??

grizzled fulcrum
#

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

unreal pewter
#

well

#

the mod is lumped in with a map mod that im making

#

and i am testing it on my map

#

so

grizzled fulcrum
#

fair

unreal pewter
#

id be surprised if it wasnt on

unreal pewter
#

is there something i could be missing?

#

something at the end maybe?

grizzled fulcrum
#

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\

drifting ore
#

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.

unreal pewter
#

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

unreal pewter
drifting ore
unreal pewter
#

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

drifting ore
#

Computers do what you said, not what you meant.

unreal pewter
#

it worked 5 minutes ago

drifting ore
#

Then enough ctrl+z should fix it.

unreal pewter
#

and so i reverted my code to what worked 5 minutes ago

unreal pewter
#

what im saying i did

#

i undid my edits back to the exact same thing that just worked

#

and it no longer works

drifting ore
#

Maybe it just needs more ctrl+z

unreal pewter
#

i copy pasted a backup of the code

#

i think my computer is just cursed to never work

drifting ore
#

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.

unreal pewter
#

i guess so

#

im learning relatively quickly though

#

im not sure why but it works now

#

not the recipe, just the distribution i mentioned

unreal pewter
#

ALSO is there a way i can remove an item from a distribution table?

grizzled fulcrum
#

you should be able to use table.remove similar to how you do table.insert

unreal pewter
#

so just
table.remove(ProceduralDistributions.list["(the distribution target)"].items, "base.(item)")

#

and thats all?

drifting ore
#

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.

stone garden
#

im useless now my mod dream has come true

#

i been defeated

bronze yoke
#
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
stone garden
#

btw is an joke what i said

unreal pewter
#

thank you !

stone garden
fast galleon
unreal pewter
stone garden
#

because it was an mod that i wished to come

unreal pewter
#

how would i get that reference

stone garden
#

idk

bronze yoke
fast galleon
#

good point, I was going by the example

unreal pewter
#

vendingpop is a procedural generation list i can target, right?

#

its not showing up on a wiki list so i just wanna make sure

fast galleon
unreal pewter
#

well , it is NOT a target

fast galleon
#

but it can be one

unreal pewter
#

it doesnt exist in proceduraldistributions though?

#

what

#

ig

#

oh i see

grizzled fulcrum
#

it's not procedural iirc

#

it's just under normal Distributions table

unreal pewter
#

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)```
fast galleon
#

the answer is above

unreal pewter
#

what

grizzled fulcrum
unreal pewter
grizzled fulcrum
#

but I can't find it in suburbs distribution

#

it only exist in base distribution table I can find

fast galleon
grizzled fulcrum
#

so it inherits distribution table then modifies it

#

makes sense

unreal pewter
#

youre speaking gibberish to me

unreal pewter
#

okay

#

cool

#

thakn you

grizzled fulcrum
#

but instead of Distributions use SuburbsDistributions

unreal pewter
#

alright

grizzled fulcrum
#

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

true nova
#

does anyone know how the game handles container overlays? how can i make a container have specified overlays when it has items in it?

grizzled fulcrum
#

maybe you can find some of an answer there

true nova
#

i know it uses a table in java i just dont know what that contains exactly. thanks though maybe it will give an idea

grizzled fulcrum
#

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 ๐Ÿคทโ€โ™‚๏ธ

true nova
#

also big find at the bottom i just saw confirms this! thanks a lot!

grizzled fulcrum
#

nice

chilly ermine
# thick karma "replaces sprintToward.xml" is not quite the right way to say it; it extends tha...

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
thick karma
#

Adding the crit flag would at least increase number of recently set variables that align with that animation

chilly ermine
chilly ermine
thick karma
#

As long as their being false is not required

chilly ermine
thick karma
#

You're not setting animation variable in expected way

#

What is the name of the animation file?

chilly ermine
#

there isnt one, its just the base animation=
Bob_Attack1Hand03_Hit

thick karma
#

I mean what is your custom animation

#

Or you're using vanilla

chilly ermine
#

I havent added anything just yet, im just using the vanilla ones

thick karma
#

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

chilly ermine
#

okok, so 2DBlends corresponds to the animation file

thick karma
#

Or it might also be able to blend into others. But that's not what determines the primary animation of the xml

thick karma
chilly ermine
#

because previously i was changing both m_AnimName and the 2DBlends

thick karma
#

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

chilly ermine
#

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"}

thick karma
#

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

chilly ermine
#

IT WORKS

#

LOL

thick karma
#

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")

chilly ermine
#

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

thick karma
#

I dunno to switch animations I use different XMLs

#

I have not tried what you're trying tbh

chilly ermine
#

Anim clip not found: kumpSwingAnimation

thick karma
#

Interesting idea but would have to play with it and test

thick karma
#

Dunno if you can make it treat that as a player variable or not tbh

chilly ermine
#

seems to treet this as just text
<m_AnimName>kumpSwingAnimation</m_AnimName>

thick karma
#

Exactly

chilly ermine
#

whats the best way to reload the game?

thick karma
#

That may be fundamental to the system

chilly ermine
#

istg it worked like 3 mins ago

thick karma
#

They'll reload when you save em

chilly ermine
#

is there another way to reffer to an animation file? insteaf of using animName?

thick karma
#

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

chilly ermine
#

thats so annoying being so close, but being stopped by a slight setback

thick karma
#

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

chilly ermine
#

ill just have diff anim files, and pass a conditional string instead

thick karma
#

The outcome will be the same

#

Right

#

Well

chilly ermine
#

i belive thats what you did correct?

thick karma
#

Different animation XMLs

#

Animation "file" ambiguous

#

But presumably also different animations

chilly ermine
#

sorry, yea. just the xml

thick karma
#

And running and sprinting

chilly ermine
#

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

thick karma
#

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

thick karma
#

Means you've set that variable on the player

#

Could not exist in any XML and still be set on player

chilly ermine
#

so the right value, just isnt doing anything

thick karma
#

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

grizzled fulcrum
#

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

bronze yoke
#

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

solar rover
#

So... when I have a print command its showing up in the debug console window but not the in game chat window, any help?

modern flare
#

Hi guys! Is there any mappers and modders who does stuff fit money?

hollow current
#

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.
hollow current
modern flare
modern flare
#

Thanks!

north drift
#

Is there any standard way to extend in game items to hav additional variables ?

ancient grail
vital nacelle
#

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]"

north drift
austere sequoia
north drift
#

more on the line indivual items

#

eg two crowbars in inventory ?

north drift
vital nacelle
#

Yup haha I just saw !

north drift
#

Im going to Guess and say it works like this
item:GetModData().eyesCorrection = 8

vital nacelle
#

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 ?

north drift
#

var data = item:getModData().eyesCorrection

#

print( item:getModData().eyesCorrection) ????

vital nacelle
#

gonna try this getModData() method, never used it yet

#

I suppose it will do the job ^^

north drift
#

I also have never let me know how you go

vital nacelle
chilly ermine
north drift
#

argh

#

i cant even print to console

hollow solar
#

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!

bright fog
#

<@&671452400221159444> yikes

#

The wave of bots is back at it

austere sequoia
#

Aye. Already reported this

lost slate
#

Ty โ™ก

bright fog
ancient grail
ancient grail
# chilly ermine hey did you figure out what reffrence id reffers to? `<m_2DBlends reference...

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

chilly ermine
#

mby i dont understand, but im just curious

fast galleon
#

<@&671452400221159444>

vital nacelle
#

How do you set guys the zombie loot table ? is it with distribution with same methods as for the containers etc ?

fast galleon
lost slate
#

Ty

#

Holy cheesus, so many

chilly ermine
onyx sage
#

any info on how b42 will affect mods i.e. what kind of updates will mod authors need to do

bright fog
#

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

sour island
#

People wanted cards to appear as loot - quick neat mod. I enjoyed making the artwork more lol.

bright fog
#

They didn't appear as loot ?

ancient grail
chilly ermine
ancient grail
ancient grail
#

are you modding player or zombie anim?

tribal moth
#

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?

chilly ermine
ancient grail
bright fog
#

I'm still writing the guide for it however, let me send you the WIP

#

(I explain the framework and basic stuff)

ancient grail
#

@bright fog
a guide would be nice btw

bright fog
#

I sent here

#

I'm writing it but it's stil WIP

tribal moth
ancient grail
#

oh wow didnt know there was a guide lol

bright fog
#

So you can extremely esily define weights for clothings, and for males and females

tribal moth
#

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?

bright fog
#

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

tribal moth
#

I donโ€™t think that with a regular tag I can add the zombieโ€™s ability to jump, explode, throw objects, etc.

ancient grail
tribal moth
#

"then add the necessary functions and animations for those feature" - How?

bright fog
#

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

tribal moth
#

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

bright fog
#

You still need to code the zombie ability that's for sure

sour island
tribal moth
#

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.

bright fog
bright fog
#

And applying it on the zombie

#

I do it with my bloater by making it an outfit

tribal moth
#

I cant understand

#

I hope i can get it later

bright fog
#

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

chilly ermine
#

pre much

dull moss
#

its done handsup

#

I hate ui

pulsar sinew
#

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

bright fog
ancient grail
grizzled fulcrum
#

<@&671452400221159444>

#

Sorry for ping lol

dull moss
#

Surely not a scam link

dull moss
dull moss
#

Big thanks to @mellow frigate @sour island and few others who I bullied in here with questions PepeLaugh

#

Getting initial thing to work was the hardest part

#

then it's jsut filling up the page

bright fog
#

Nice

sour island
#

Nice update! ๐Ÿ˜ฎ

#

I removed the message, can't time out or ban people lol

#

His last message was from exactly last year this time

dull moss
#

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

sour island
#

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

dull moss
#

hm

unreal pewter
#

is there a way i can make a custom playstyle, like Apocalypse or Builder?

hollow solar
unreal pewter
unreal pewter
grizzled fulcrum
unreal pewter
#

?

grizzled fulcrum
#

well there's Distributions table which is like the base of the distributions

safe silo
#

Sending chat messages with LUA? How would I go about doing that? Just a general /all chat message.

grizzled fulcrum
#

then there's SuburbsDistributions which is a subset of distributions that inherits Distributions table

unreal pewter
#

wait i might misunderstand

safe silo
grizzled fulcrum
bronze yoke
grizzled fulcrum
#

not fully sure, just guessing

grizzled fulcrum
#

I thought SuburbsDistributions adds to the table after it inherits the base one

bronze yoke
#

they're just two different variables pointing to the same table

unreal pewter
#

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
grizzled fulcrum
#

why would SuburbsDistributions even exist then

grizzled fulcrum
bronze yoke
#

oh i see actually, Distributions is for the weird table merging thing they have

#

i misremembered, SuburbsDistributions is actually Distributions[1]

unreal pewter
#

yknow

#

thatd do it

grizzled fulcrum
#

even more confusing...

bronze yoke
#

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

unreal pewter
#

huh

#

it is finished, just not in what i sent here

#

weird?

grizzled fulcrum
unreal pewter
#

yep still nothing

grizzled fulcrum
grizzled fulcrum
unreal pewter
#

wait i might be actually stupid and forgotten to do that

#

.

#

yep

grizzled fulcrum
#

idk if you can change distributions at runtime (like mid-game) but I've always done and seen it done in OnGameBoot

unreal pewter
#

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

bronze yoke
#

you need to do it on OnInitGlobalModData to access sandbox options

grizzled fulcrum
#

oh true

bronze yoke
#

the ItemPickerJava.Parse call forces the game to re-parse the distribution table since that would have already happened by then

grizzled fulcrum
#

oh that is good to know

#

I was actually wondering what that did

#

nice

unreal pewter
#

still nothing..

grizzled fulcrum
#

;-;

grizzled fulcrum
#

you called your func BookDistribution

unreal pewter
#

yeahh

#

i noticed that

#

i just fixed it

grizzled fulcrum
#

oh ok

unreal pewter
#

because i copied a different distribution function

#

now i have uhh

grizzled fulcrum
unreal pewter
#
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)```
grizzled fulcrum
#

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

unreal pewter
#

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

grizzled fulcrum
#

whats the file name of the file it's contained in

unreal pewter
#

ProjectGurashiRecipes

#

.txt

#

i think?

#

oh my god

#

its not a txt file

grizzled fulcrum
#

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

unreal pewter
#

its just a

#

file

grizzled fulcrum
#

LOL

#

nvm then that's why

#

but your lua code still not working which is weird

unreal pewter
#

yeah

#

glad i figured out the recipe though

grizzled fulcrum
#

like you even put .items at the end of the distribution table and everything

unreal pewter
#

do you have an example of putting something in suburbsdistributions?

grizzled fulcrum
#

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

unreal pewter
#

so
table.insert(SuburbsDistributions["vendingpop"].items, sodaVMItemName)
table.insert(SuburbsDistributions["vendingpop"].items, sodaVMrate)

grizzled fulcrum
#

so it's just table.insert(SuburbsDistributions["vendingpop"].items, item)

#

yes

#

I am like 99% sure SuburbsDistributions doesn't have a "list" member

unreal pewter
grizzled fulcrum
#

damn I was hoping that would work

#

why can't it be simple ever

unreal pewter
#

because lua

grizzled fulcrum
#

vendingpop doesn't even exist for SuburbsDistributions

unreal pewter
#

right it exists in just normal Distributions file right?

grizzled fulcrum
#

yes

unreal pewter
#

should i try Distributions instead?

grizzled fulcrum
#

probably

bronze yoke
#

the distributions file defines SuburbsDistributions

#

the actual SuburbsDistributions file is just a bunch of util functions and the merging code

unreal pewter
#

Distributions or Distributions.list

#

?

#

which should i do

grizzled fulcrum
#

im so confused and im not even making the mod and my vscode kicked the bin so I have to wait

unreal pewter
#

most of my experience modding has been pure confusion

grizzled fulcrum
#

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)
bronze yoke
#

requiring vanilla files does nothing whatsoever

fast galleon
unreal pewter
#

??

#

what does that mean

fast galleon
#

literally table.all.anotherTable

unreal pewter
#

do i need the .items at the end?

shadow rose
#

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?

unreal pewter
#

uhh so table.insertSuburbsDistributions.all.vendingpop.items, sodaVMItemName?

unreal pewter
#

ah

#

right

pulsar sinew
unreal pewter
#

heyyy that worked

#

thank you!

unreal pewter
# fast galleon add brackets ()

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

fast galleon
unreal pewter
#

well

#

ideally id like to replace them

grizzled fulcrum
unreal pewter
#

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

grizzled fulcrum
#

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

unreal pewter
#

oh wow thats incredibly helpful thank you

#

i wish i knew lua more so i could figure this out on my own

grizzled fulcrum
#

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

unreal pewter
#

ill look into how to set it up, thakns

grizzled fulcrum
#

I use that and sometimes I open the pz media folder so I can just search all files for specific words or strings

unreal pewter
#

i searched apocalypse and survivor and sandbox but nothing like this showed up

grizzled fulcrum
#

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

unreal pewter
#

hh i see

coarse sinew
# hollow solar Hello~ I'm trying to reduce the chance of getting useful materials you get from ...

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.

ancient grail
#

<@&671452400221159444> this

unreal pewter
#

so i was able to modify the settings for Apocalypse but how does it work if i wanna provide settings for a mod?

true nova
unreal pewter
#

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

true nova
#

if getActivatedMods():contains("the mod id here") then

echo lark
#

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

hollow current
echo lark
hollow current
#

Would you happen to be subscribed to the new mod on steam workshop and the changes done only locally?

echo lark
hollow current
#

Not quite sure what's going on there then honestly. Only two reasons I can think of ^

echo lark
#

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

sacred oyster
#

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.

sour island
sacred oyster
#

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

sacred oyster
echo lark
sacred oyster
#

Is there specific documentation on multiplayer modding or is it a crapshoot?

echo lark
#

thats everything that i know of/that ive been using

sacred oyster
#

Alright, thanks for the help mate!

outer crypt
#

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.

safe silo
#

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!!)

chilly ermine
#

can someone please send me vanilla AnimSet for melee 2 handed (only xml files), i accidentally edited mine... whoops

tidal pike
#

Algum br ?

echo lark
#

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

bright fog
winged ocean
#
worthy pawn
#

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>
worthy pawn
#

Nevermind, I figured it out, it has to be nested within the <subItems> tag.

worthy pawn
#

Actually that doesn't seem to work either.

unreal pewter
#

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?

drifting ore
#

i'm pretty sure you don't need Lua code for this

#

but world item models normally go into media/models_X/WorldItems

tranquil kindle
unreal pewter
#

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)

unreal pewter