#mod_development
1 messages · Page 529 of 1
nice
release myt go karts last night.
if i had to guess .. i'd say you'll make the zombie explode into nothing while crawling
into oblivion
the cool thing about CZs method is you can pretty much get any field value from any object using it
well not NOTHING... but it would hurt them till they die.
I did figure you could probably index the classes for their fields, but didn't know how to go about it
there's another FUNction that happens then
thats the only one that doesnt have one
yeah would be nice
koni, did i have you look at the new spray?
but again it's super expensive to do .. so wouldn't recommend OnZombieUpdates .. i avoided using that like the plague
didnt see it
Yeah, if you can find any method that doesn't involve reflection, you will almost certainly be better off
yeah it is plague
vanilla zombie already lag as hell in lousiville, cant imagine an unoptimized onzombie added to it
It does feel like it should be something that should be exposed, the state of bCrawling I mean
its one of hte reasons why customizable zombies kills the game with lots of zombies around
@hearty herald definitely
maybe it's overlooked
pretty sure its just a forgotten getter, dont know where we can propose it to the dev. Probably the forum.
What's the deal with this on a body?
function DebugContextMenu.OnDeadBodyToggleCrawling(body)
body:setCrawling(not body:isCrawling())
end
At all relevant?
local isCrawling = zombie:GetAnimSetName() == "zombie-crawler"; no worky
Is the aiming with weapons thing hardcoded in java? Because it does differentiate between prone and not prone, and crawlers are in the prone category
ERROR: General , 1646086736703> ExceptionLogger.logException> Exception thrown java.lang.RuntimeException: attempted index: GetAnimSetName of non-table: null at KahluaThread.tableget line:1689.
---@public
---@return boolean
function IsoZombie:isCrawling() end
If you remove the auto attack prone and use the keybind you entirely ignore prone enemies with everything except stomp
That means your zombie doesn't exist
Or it's not a zombie?
looks like its in IsoZombie.lua line 413 .. did you try this @faint jewel ?
If it's inside the zombie you might not be able to access it outside zombie
probably inherited?
I'm curious what is body reffering to?
because body has :isCrawling
In the higher context it's provided by IsoObjectPicker.Instance:PickCorpse(x, y)
in IsoZombie.java +3770
public boolean isCrawling() {
return this.bCrawling;
}
could be exposing this
Worth trying to call isCrawling() from the lua side then right?
worth a shot
yup thanks to @chrome egret for finding it
noice, good looking out to spot the Java side
it was hidden, sneaky little getter
Konijima, I've seen your tutorial about using IntelliJ but I'm confused
does it imply after decompiling to Java I have to recompile the files into the .jar files?
i used this guide
to get decompiled source into project
when you search in intellij (ctrl+shift+f) you need to set the destination of the search to Scope
to search through the .jar files
Well those jars don't exist anywhere on my system
That's why I assumed it was implying that after decompiling .class to .java, I had to recompile to the jars that needed to be added
when you run the gradle tasks, it does it for you
if zombie and (zombie:getCurrentState() == ZombieOnGroundState.instance() or zombie:isCrawling()) then ?
yeah you need to start a new project and initialize is as a Gradle project .. what i do is initialize a separate mod, so mine isn't cluttered w/ all the stuff it adds
then i go over to that projet when i need to scan source files
pz-41.66-generator
yeah sorry havent updated the tutorial for a long time
that would be great let me know here
@willow estuary Do you mind pin this?
Pinned posts previously reached a point where there so many pinned posts that nobody could find the information.
Now if something is thought to be pin-worthy it should be added to the wiki here: https://pzwiki.net/wiki/Modding
It's now on the page.
Okay thank you
👍
Any mods that add additional sounds/tracks for playing TV/radio? Looking for something that adds more immersion when my zedhunter is watching Paws but is listening to a talkshow host talk about poverty, disease, and climate change.
okay! crawlers get boned now!
gratz Skiz
It would be even better if it also left a circle of gore on the cell where the zombo was crawling + run over
what's the difference between index = 1 and index = -1?
it's used a lot in vehicle spawns
Can you give a little more context?
Like, is that index being used to retrieve values from a table?
VehicleZoneDistribution.trafficjame.vehicles["Base.86oshkoshUSMC"] = {index = -1, spawnChance = 0}; here's the whole line of code
courtesy of oshkosh mod
the -1 is replaced with 1s a lot of the time
i have a temporary for that... buy i am working on how to leave a swirl.
i wanna get the fan right first.
then i get to devolve into how to change that damned art that it's using.
addBloodSplat() i mean if you can tell me where that is opulling the art from and how to change that i could do MAGIC
public void addBloodSplat(float float1,
float float2,
float float3,
int int1)
i know the floats are the square (or i believe so) the int should be the type.. everything from 1 to 100 is the EXACT SAME ART.
addBloodSplat(square, ZombRand(100));
Did you try it without the zombrand?
what about 1-3
It could be indexed and it simply doesn't have variants above, say 3
i would fall in love with someone if they can tell me how to get the game to actually throw blood like i hit em with an axe.
I think you'd have to mess with blood giblets and such to get that
Javadoc Project Zomboid Modding API declaration: package: zombie.iso, class: IsoChunk
Javadoc Project Zomboid Modding API declaration: package: zombie.iso.objects, class: IsoZombieGiblets
could make a fun gore cannon that pushes back zombies with chnks of other zombies XD
or a mod where you "Code V" blood.
lol i love how i can kill this channel
in general, what's the easiest type of mod to get started on?
I want to make a vehicle mod but I feel like I should wait a bit for that
Addin simple items is usually the first baby steps, and then recipes
I wouldn't recommend clothes as they require linking the XML files, go for a food items, or maybe a literature item as those are useful just by giving the item script the correct values
got it. Is there anywhere I learn about file organization for this game?
every game I've tried modding has been quite different
The PZ Wiki has some resources, this tutorial is a good starter: https://github.com/FWolfe/Zomboid-Modding-Guide
One of the sections is on the structure
thank you
Is this pinned anywhere? Might be a good one to pin
It's prominently featured on "the pinned post page" which is https://pzwiki.net/wiki/Modding
I was more meaning the tutorial he linked not the wiki. I did see the pin to the wiki page
But I see it's linked in the wiki page
Previously the amount of pinned posts reached a point where people were unable to find pinned posts, and were daily requesting that posts that were already pinned get pinned. It's not a viable organizational system once there's a critical mass of pinned posts.
Therefore now, for this channel, that page of the wiki is the pinned post page, in that that format allows for better organization. Albeit that aspect of that page needs more work.
I can appreciate that :) just wanted to make sure that resource was available for people. Missed it on the wiki before :)
Well, I'm seriously an idiot that's more of a janitor than anything, so I have no attachment to how I haphazardly transferred everything over there and added to it.
So anyone who wants to take a crack at better organizing that stuff on that page is a goddamn hero if anything. Registering +editing pages are pretty painless.
Looks promising, what are you going for with that?
Think he mentioned earlier getting all nearby containers, so maybe just search everything around you
Yeah, with lots of item storage (say in the large warehouse) it becomes hard to know where to find things
So the idea was to allow an item input, then your character auto-searches for the item
Oh, like walking to each container?
Still feeling out the compromise of having to walk directly up to everything and just kinda scanning from a distance
but sumfin like that for sure
Because the distance for what containers qualify could get iffy
hey i have a project you can attempt...
And if they are on other side of wall etc
hehehe
Are you considering making sure containers are in visibility?
Perhaps
There's nothing saying you couldn't find something on the floor
Since in SP you got the whole pause game and flick through all containers you can loot already lol
Right, it's def an idea borne out of MP
Does any of the veterans know if there is any mod that improved the debugging UI? Cause the current one is kinda bad IMHO
I do like idea of just adding filter text on inventories in general
Another good idea
does anyone know a simple way to off set the position and direction of a vehicle? like i just want to get a position that .5 away from and 45 degrees to the right and facing of the vehicle
and if i could do that in a function it would be even better.
Wouldn't there be a trig function for that?
been forever since I've had to think about those
welli found a couple things but have no idea what they want to be fed.
Have you tried searching for invocations of the functions in the vanilla code?
Javadoc Project Zomboid Modding API declaration: package: zombie.scripting.objects, class: VehicleScript, class: Position
well in the lua yeah.
that looks a really interesting UI design.
its a rough one, honestly
it does not function in for weight/size
so you can throw in 5 heavy items out of a set of 30 tiles and you still have 25 tiles still sitting there
nice concept though
I think it would only be graphical, and if it needs more tiles you'd probably just add a scrollbar.
In fact there's already a scrollbar there 😂, so it doesn't have to be that big vertically for sure
that's a stretched out view yeah.
What is that lone getPlayer() for? Also that mod looks incompatible with other mods that modify the tooltip. It also looks like it may not work well with firearms that have attachments. You could try picking at what y to start by getting the tooltip's height after doing the original render function.
does anybody know where the ground-models are stored? for example if i replace a vanilla model with a new created one the "place on ground" model is the same, but it's shifted upside down.
What is a good way to spawn custom, player-only clothing items?
I don't want to add them to zombie loot list
I wonder if crafting them with stupid easy items like a ripped sheet is a good idea 
Is there an empty texture I can set the <texture> attribute to to make my clothing item transparent?
If no, where do I put my transparent texture to use it?
Damn, this looks goooooooood
Fellow modders, I was wondering how does sound work in MP/SP?
I'm planning to make a L4D1/2 pipebomb mod, where you yeet it, makes loud beeps zombies go to it, and they go boom
How do I spawn sounds? And how do I make it that that sound will aggro the zombies more then me? And sync it in MP
I'm not on the PC rn, but I will give it a look thanks
@celest crane have you seen this discussion? #mod_development message
What's the correct code to grant skill xp when crafting something?
I have the mod "Craft Sheets" as a base, and the code to grant xp is wrong. A couple commenters posted the "correct" code and I edited the mod code directly but it doesn't seem to have any effect
What do you mean you edited directly? Not all mod code can be replaced the same way.
The mod simply consists of media/scripts/recipe.txt
I edited that .txt directly
the code right now reads OnGiveXP:Recipe.OnGiveXP.Tailoring5
A commenter says this:
OnGiveXP:Recipe.OnGiveXP.Tailoring5,
(instead of your current code: OnGiveXP:Give5TailoringXP,)
I've tested it and it works for me. And thank you for a nice mod! It helped me create mine for sturdy sticks recipe without utilizin a saw :)```
It has the same syntax as the vanilla game recipes (such as slicing watermelon) but it doesn't seem to work
Either that or 5 XP is too small that I don't notice somehow
Anyway, is there an explanation for the crafting recipe?
I want to make the recipe unavailable from right click (i.e I have to open the crafting menu to see the recipe), is it possible?
You know what would improve inventory? Color coded inventory slots by category
I was thinking you could color code the backgrounds of the icons. green for food, yellow for crafting, red for weapons etc.
Could you color by condition then color the background?
I like the coloring by background for the icons actually
Not too intrusive
This type of inventory would also benefit from icons taking up space proportional to their weight
Left it in there by mistake, it was for a new update that would display additional info based on your personal weapon level
Also it actually seems to be fine so long as they aren't modifying weapon tooltips, but yeah it would prob need to be changed to accommodate weapon tooltips mods
Not too fussed about the y pos ATM maybe I'll fix it in the future
who ever codes it... can do it however they like lol.
True lol
Might look into it, though it's probably over my head atm
Love how the hands are in the groin
you need to as thirsty as these damned zombies are.
Lmao uh
I set the model to empty
and instead of a transparent nose ring I get a checkerboard dress that covers the face and body kek
Hmmm well the belly button object doesn't have anything associated to it but
okay got it, I have the wrong texture path
How does insulation work? I tried adding insulation to a custom nosering/bellybutton and it does nothing. The game shows the items as wearable, I have equipped them, and it shows insulation/wind resistance.
Do they have to have condition for insulation to function?
or is it because of the BodyLocation?
BloodLocation
Nani
I thought "BloodLocation" is where the blood textures would be applied when getting bloody
alright let's see...
BloodLocation handles protection and insulation too
I know cause I spent the last week working on the transmog mod and that shit was so confusing
You're the guy that made transmog?
Yes
Huh that's cool
Thanks 
So if I have insulation 1.0 and bloodlocation is literally the whole body
I'd basically be heating myself to the mars
I guess that will be the case
Are you making a mod that adds stuff like RPG games? Where earring and similar trinkets add bonuses and stuff?
No I'm just trying to figure things out at this point
maybe mod that lets place gate that only faction members can open?
uh oh, 1.0 insulation is too strong
or is it?
Sure it's strong in summer, but I assume it'd help a lot in winter
Jesus there's a variant for each ring, for each fucking finger????
Good luck
So since I'm taking in text input for the item search mod, I'm wondering-- is there a way to get a reference to all defined items, so I can look for a match?
Or at least to get it through a multi-step process like get all items modules, get all items for the module, repeat
@faint jewel I was imagining something like this where you show each bag, have icons colored by category, show weight, and show how encumbered you get in the background grid
nice edit!
I feel like the dayz inventory screen is already good
Could include a toggle for showing weight, there's definitely something to be said about overengineering
Ideally I'd like some way to show how much weight everything takes up but it's hard to do that and show the icon and show max carry capacity bc there are only so many visual channels
i think size would be okay.
like if an axe weighs 4, make the icon take up a 2x2
i need a function! "ObjectOffsetAngle()"
The problem with funky shapes is that you have to kinda tile them together and sorting gets weird
Also low weight icons have to misrepresent their weight, you'd have to add a toggle to switch between show/hide small icons
ObjectOffsetAngle(o,a) NEEEEEEED
dammit that would help but not really.
i would have to kno how to offset from that.
anyone familiar with the Save Our Station mod, the radio broadcast portion of the mod seems to write out variable names instead of the values of the location/faults
Hey, anyone good a good article/howto on using python to read details from the players.db?
Is there a mod let's me move multiple vehicles across the map at once?
this looks so good Q_Q
Thanks!
Miiiight steal that ModKeymap panel idea
absolutely
I'm not that skilled with UI. You could take the code and improve it if you want
I'd gladly use a version of yours
I'm still testing, but I'm keeping my code current on github: https://github.com/TheCrimsonKing92/pz-item-searcher
So you're welcome to scavenge what you like
This one doesnt work anymore
does anyone know how to get underwear to appear in character creation? This doesn't work and throws "unknown item type":
I wonder if anyone knows how to read the Zombie Population map(debug mode)? Or where I can get more info/ask?
Specifically curious about the meaning of green square outlines, blue square, and the number n/n in the topleft corner of cells(assume zomb population but doesnt seem right)
Hi I have a Super Cool™ Mod idea
But I dont really know how to start
I just want to make your character talk to themselves
about their current situation
as an alternative to moodles
that .... would not be to hard?
are there any tutorials on this kinda thing?
I used to mod Skyrim and Fallout so I'm not compltely foreign to modding
but I dunno anything about PZ
I saw a mod that seemed to already show characters talking I was wondering if that can be like a template
its called Super Survivors?
Does Zomboid use like events to detect things going on?
@faint jewel Any idea how I might start on this kinda thing or any tutorials that might nudge me in the right direction?
yes it does.
I think I could do something really fun with it
but I'm stuck on the "how do you start" part lol
step 1.: learn lua.
uh huh
step 2. learn java.
uh huh
I know a lot of Python, will that help here? lol
.uhhhhhhh
oh
I see someone made the mod I want to make already
so I can just expand this
very cool
there ya go.
AngleOffset(object, angle, distance)
I need this function.
anyone?
Idk man, it looks like there are some getAngle* methods on BaseVehicle
i just want that specific function.
takes and object and the way it's facing, adds the angle ot that angle, and puses it away from the object the distance
I don't imagine something that specific is already implemented as a function, but you should be able to make it using methods on IsoMovingObject
well i dont brain that well lately.
If you want an angle offset from a center you need the center, then construct a unit vector, rotate that by the angle you want to offset, then add the two together.
You can also scale the unit vector if you don't want the offset to be 1
The only important thing is that the unit vector is pointing the way you want, say forward.
Anyone know how to fix the issue with your dedicated server and ModOptions saying it doesnt exist giving you the error code for media/lua/shared/!ModOptionsEngine.lua
-- not real code, just example pseudo
function angleOffset(offsetAngle, length)
offset = Vector3(1,0,0) -- assumes positive x is forward
offset.rotateZ(offsetAngle) -- few ways to do this part, and gotta be specific if angle is in radians or degrees
offset = offset * length -- scale to length
return offset
end
position = Vector3(0,0,0)
offset = angleOffset(90, 1)
newPosition = position+offset -- expected output of 0,1,0
offset = angleOffset(180, 1) -- expected output of -1,0,0
offset = angleOffset(90, 1) -- expected output of 0,-1,0
offset = angleOffset(-180, 1) -- expected output of -1,0,0
Other than that, maybe you'd find enjoyment in a video about quaternions by 3b1b https://www.youtube.com/watch?v=zjMuIxRvygQ&ab_channel=3Blue1Brown
Go experience the explorable videos: https://eater.net/quaternions
Ben Eater's channel: https://www.youtube.com/user/eaterbc
Help fund future projects: https://www.patreon.com/3blue1brown
An equally valuable form of support is to simply share some of the videos.
Special thanks to these supporters: http://3b1b.co/quaternion-explorable-thanks
Pre...
where can I find or whats the directory for the sound file WatchAlarmLoop?
Sounds are also located under media/scripts. I believe you're looking for sounds_item.txt
Ah, I found it, thanks
np
Ouh actually this shows me what event triggers to play the sound
but still no directory where the sound is
Not sure, just going off the reference for scripts in the Zomboid Modding Guide
it says event is used for "sound clips that are in the vanilla soundbanks, for customer sounds we need to use file"
I'm reading the guide, yeah its probably in a .bank file
I'll check it out now, thanks again
So it begins... results!
Is it possible for an object to have multiple types?
i.e
Are there any radiation mods out there?
i'm sure it won't let you separate with ",", to separate is ; or / depending on what are you doing
that being said, I don't know about your question, but I learned what I've told you after many errors
A lot of new music I want to release for my True music pack.
If only if I knew how to update the mod w
same way you uploaded it
i was about to ask if you would take a request. so i searched the workshop first and someone already included it 👌
So it's just restore the deleted files from the recycle bin, add the new songs and run the add music exe and repeat.
didn't knew that was necessary to update a mod
Sadly both didn't work
I tried replacing AlarmClock with AlarmClockClothing, still no luck
I wanted to create a clothing with the BodyLocation at neck which plays an alarm like the Digital Watch
But the issue with AlarmClockClothing, as soon I unequip it I can't wear it back
upload =/= update tho, I was answering how to update a mod
yeah sometimes doesn't work, attachments are like that too
maybe some lua functions are required?
I'll try to figure this out.
maybe it's worth to keep an eye here or to ask someone who uploaded it
or maybe downloading one and checking the file structure
Good idea.
I think I've might've messed something up.
why? are you getting some error?
I'm an absolute noob with creating mods.
Well I realized I forgot to rename some files in the True Music addon folder
yeah me too, but I've been doing a private mod for some time so I know it's a pain to upload one
That's was a required step for the addon to not conflict with other True music addons.
I'm gonna try to fix the stuff inside the folder before I even consider starting over.
Gonna test it in game after.
👍
I think I'm good now.
You should add the number of item if superior to one. There is a function that give you just that
Btw, why not use a collapsable window and remove the collapse part (the window element work too) ? Like that you can have the close button like other window (the bar in the top) and add a name for the window
Also I believe that the EntryText element has a function for when enter is pressed. Like that you could delete the two buttons
Hey, i need some advice, i'm looking for way to set some items to not spawn on map, and others to spawn in any container instead of dedicated spawn. Is there way to do it easly(mod) or do i need go hard way and modify item.txt and distributions.lua?
You could just modify the distributions.lua for spawn chances of items and basically not have them spawn at all and if I’m correct item.txt contains an items base stats
any chance you can DEpseudo that? lol
Just replace Vector3 with the math vector3f you can access in zomboid I guess
alternatively do the whole rotation thing manually like you did before, just on the forward unit vector by however many degrees lol
Is there a way to reload my mod without restarting the game?
I appreciate the advice! Will look into that a bit more
If you're testing in singleplayer, all the Lua is reloaded every time you quit and continue
which vector3? offset = Vector3(1,0,0) -- assumes positive x is forward this one?
thanks
yeah, Vector3 if not a class, it's called something else. like vector3f
I think you have to do vector3f:new(1,0,0)
It's under math java stuff in the javadoc's
Javadoc Project Zomboid Modding API declaration: package: javax.vecmath
Javadoc Project Zomboid Modding API declaration: package: zombie.core.math, class: Vector3
It was matrix3f that had the rotation function, but they're more of a pain to get the xyz out of I think
Though, vector3f had inherited methods from something else
rotateX, rotateX, rotateY, rotateY, rotateZ, rotateZ
Can we ship .class files in a workshop mod?
Cause I need to edit the original Clothing class 😐
If not, is it possible to ask the devs to add a single function to it?
no
if you have a very good case, explain why you want the function,I'd say go ahead and make the suggestion. But make sure you explored what you already have first and there are no solutions to your problem/limitation
this is shredding my brain.
tempVector = Vector3f.new()
vecPos = vehicle:getWorldPos(0, 0, 0, tempVector)
print("vehicle:getWorldPos = x:", vecPos:x(), "-- y:", vecPos:y(), "-- z:",vecPos:z())
print("vehicle:get* = x:", vehicle:getX(), "-- y:", vehicle:getY(), "-- z:",vehicle:getZ())
tempVector = Vector3f.new(1,0,0)
vecPos2 = vehicle:getForwardVector(tempVector)
print("vehicle:getForwardVector = x:", vecPos2:x(), "-- y:", vecPos2:y(), "-- z:",vecPos2:z())
print("vehicle:getAngle* = x:", vehicle:getAngleX(), "-- y:", vehicle:getAngleY(), "-- z:",vehicle:getAngleZ())
the numbers are all over the chart.
all i want is
function angleOffset(position, offsetAngle, length)
offset = position
offset.rotateZ(offsetAngle)
offset = offset * length
return offset
end```
Is there a pager mod or something like that ?
not that i know of?
Yeah i searched and found nothing. Good, I'll be busy tonight. I'm tired of work
Sometimes you make me feel downright slow 😄
Hello, can someone direct me to any source regarding applying a retexture to a mod vehicle? Trying to just do a simple texture overwrite to keep the dependency on the original as I only want to alter the texture of a few variants of it. Only thing I came up with was a post on TIS forums simply saying "copy the whole file structure" buuuut that would basically steal all the original work. And I've got no desire to model a vehicle from scratch at the moment. - Thanks for any assistance, my google-fu seems to be lacking lately...
thanks ill give a look at the file structure. cheers
it's just that all the stuff to do, I've already done it for my other mods so it won't be too complicated. I just need to look at how to add an object on the map like a radio but I have an example mod that does just that
i think i cracked my skull headbutting the wall.
this makes zero damned sense.
like at ALL
Ok how does one include change notes in an already uploaded mod?
I'm trying to get a second entry
update itt hrough pz.
make it possible to throw items (spear - spear is used for throwing), and create torch from a stick of rags and gasoline
Yep
Well that didnt help much, see files associated with loot tables and what not but thanks regardless.
it adds new ones whenever you upload through the game
Military Used Car Skins\media\scripts\vehicles - these are the scripts.
they updated teh existing ones to add thier skins.
Hm is it possible to make melee weapons deal fire damage? I know it's not a default weapon_item parameter, you'd have to hijack the damage system somehow.
or just use a lua to cehck if they got hit and if so do fire dmg then.
sigh.
anyone? at all....
man i kilt this channel DED.
yeah you did RIP
i just need this dumb ass function to work. then i can release my mowers.
yeah pretty much.
Is there something special that I need to do to set an item as a backpack? I've given it carry capacity and weight reduction stats, also the sounds (open close put) but nothing
Oh... I forgot to set it to type container 
Opinions on the design? I like it but never used a pager so maybe I'm missing something
i would darken the bg so it numbers are more readable.
Which one ? the medium green ?
also they were grey.
Grays are the latest gen, this is the first gen with liquid crystal screen so they are green
To stay as much as possible in the year of the game
I could do it gray it's true, it would be more historical but I like green. It's reminiscent of the gameboy and the era
But I will pass the numbers in black and keep the green background
For the moment I only do a digital to send codes, can send [0-9]
This way you use a notepad to write down your codes, the old fashioned way
Yeah I get it, thx for the opinion
🙂
- Is an item's modData synced with the server and players? For example, if I add a variable to the modData of an item from the server, can a client read it?
- Can I save an item in global modData?
I'm trying to find an efficient way to save a number in an item (the pager) then, if the server receives the command to send a message to this number, find the item and change these modData.
This is the part where you have to find the item that I have no idea how to do
Do whatever you want with it.
Any way of reloading lua without disabling mod, go back to main screen, enable mod?
using debug mode IIRC allows you to reaload lua from the main menu
I've changed my mod's code many times-- simply quitting the SP game and hitting continue reloads the code
I tried just quitting the game and continue. When I do that, it shows the new lua code, however it doesnt seem to be executed.
Only when I disable/enable It actually executes the new code
very odd
for example... the object watcher does not show a new variable
even when the lua code shows it.. Its odd
I can reproduce this behavior many times
I am in debug mode. How do I reload? I dont see any option in the main menu
just tried and isn't showing, I rmember it was on the right corner of the screen or near it
The way I have been doing it is find your file in the debug mode, click "reload file" after you made your changes and saved. Granted, I am generally new to modding in PZ but that has been working for me.
funny thing is even scenary list dissapeared from the main menu, so it could be bugged
Just found that button! lol life changer
But its funny how it shows the new code, but doesnt execute it unless you forcefully reload it
tf is this?!
Anyone know where a tutorial is for making a UI?
Same fella also provides a lib for making custom UIs if you don't want to learn the vanilla way
cool ty! I was looking at lib but it wasn't expansive enough
anyone cna help me wiht this?
function zombieDeath(zombie)
local inv = zombie:getInventory();
inv:AddItem("AsuraChi.baseChi", 1);
end
Events.OnZombieDead.Add(zombieDeath);
I've ben trying for quite some time to spawn items in zombies when they die
I've tried a lot of scripts to make it work, and while it does spawn the item, that item gets duplicated by the ammount of players that loot that corpse
that code is one I've made following They Knew as example
but even with that the item still duplicates, while in they knew it doesn't happen
so, what I'm missing?
the script is in media/lua/server
all my efforts always end on the same result, the item getting duplicated in MP
it's literally the only thing holding me off uploading that mod and I'm getting insane 
Do you need to do it this way, or could you alter the loot distribution for the zombies?
the idea is that every zombie spawns only 1
idk what's the better approach on this honestly
at this point I'm thinking on just launching it with that bug
I mean sure, you can always update it later if you feel it's breaking balance or w/e
Though I think I found an example from Blair about modifying stuff zombos would have: #mod_development message
A benefit of trying to do it through distribution or generation would simply be to prevent adding the performance load of a function called on every death.
Though of course it's pretty simple code
thank you pal, it's a good idea and probably the method that other mods uses like greenfire
New and improved h/t to MrBounty
Messy!
Aye Cool mod dudes, Can you add Cool kids - Gas station into your next True music addon, Thanks!
anyone know what mod is this map mod?
Over the River
i mean the draw tool on the top right corner
and gps/mini when u dont have the map on full screen
nvm i didnt realize this was vanilla stuff, havent played in awhile lol
just finished my first mod! it lets you bundle planks just like you can with logs. any feedback would be greatly appreciated 😄
https://steamcommunity.com/sharedfiles/filedetails/?id=2771356513
Btw, for one of my mod I made a function to change a string so if you use it with string.match(), "can opener" and "Can opener" is the same, like that capital and lowercase letter is the same. Do you want it ?
What you mean ? It will help me improve it
Absolutely, I was expecting to have to roll my own implementation
I use it like that string.find(text, transformToPatern(subText))
local function transformToPatern(name)
-- For the filter, remove upper and lowercase issue. Like that ShOrt and shorT is the same thing.
-- To use with gmatch or string.find
local toReturn = ""
for i = 1, #name do
local c = name:sub(i,i)
toReturn = toReturn .. "[" .. c:lower() .. c:upper() .. "]"
end
return toReturn
end
Hello, I want to change the speed of the sprinters and I've come across these 2 mods
https://steamcommunity.com/sharedfiles/filedetails/?id=2747261527&searchtext=slow+sprint
https://steamcommunity.com/sharedfiles/filedetails/?id=2716710487&searchtext=slow+sprint
They both uses the method of changing the speed of animation using m_SpeedScale in the xml file which to me is really weird
Are there any other methods to change the speed of sprinters code wise?
I've read through the source code and try to decode it but I just couldn't figure it out.
Just wondering if it's possible in theory to make a map with a power plant and water facility, and have some way for the player(s) to bring them back online and maintain them?
Isn't there one called "save our station" which does something similar for radio? I think for the weather reports mainly
It's just an interesting idea.. but the last time I had an interesting mod idea for another game, it ended up as a DLL that loaded into the game's memory space and did hooks/code injections lmao
I'm hoping its a bit easier in zomboid
With global modData, if I use ModData.request(String key). How do I get the table after ? With the event OnReceiveGlobalModData or I can use ModData.get(String key) ?
Quick question; how do I spawn a single "stack" of ammo from a recipe, or is that just broken?
I the vanilla game, ammo spawn in stack. For shotgun shells it's by 6, you can find it here https://pzwiki.net/wiki/Shotgun_Shells, with the line Count = 6. I'm not sure you can spawn a single ammo, someone should confirm
The two first recipes spawn a single shotgun shell
What I can't get to work is for it to spawn six. It either spawns one, or some other multiple of 6.
Send you recipe
{
GunPowder=1,
CanBeDoneFromFloor : TRUE,
Result:ShotgunShells,
Sound:OpenCannedFood,
Time:50,
Category:Firearm,
}
recipe Result:ShotgunShells=1
{
GunPowder=1,
CanBeDoneFromFloor : TRUE,
Result:ShotgunShells=1,
Sound:OpenCannedFood,
Time:50,
Category:Firearm,
}
recipe Result:ShotgunShells=2
{
GunPowder=1,
CanBeDoneFromFloor : TRUE,
Result:ShotgunShells=2,
Sound:OpenCannedFood,
Time:50,
Category:Firearm,
}
Wich one give you one ammo ? And wich one give you a multiple of 6 ?
First two spawn a single shell. Third one spawns 12 (2*6) as it's supposed to.
Seems to be normal, you can't spawn one stack. In any case, nothing in the vanilla game, all the recipes have a =2
So for my sample input "Can Opener" I should expect to get "[cC][aA][nN][ ][oO][pP][eE][nN][eE][rR]" back?
Yes, to be simple, for lua [aAbBcC] is only one character that can be either a, A, b, B, c or C
ah, I just found the Lua reference for this
[ and ] are magic characters to create a char-set
Perfect, thank you so much
Unfortunately not: the water cutoff is in the Java side of the game, and hardcoded as days since start date; I would assume the same is true for the power cutoff
You might be able to fake it but doing so would be an incredibly involved process (manually setting squares as having power as they're checked, or creating fake water sources that constantly get topped off to plumb things to, both pretty obnoxious hacks that may or may not be feasible or work as expected)
heh invisible modded noiseless generators all over the map
I've found some tutorials and stuff for map making so far, and I think I could get into this...
but there's a lot of other stuff. vehicles, recipes, and so on that I'm not even sure where to get started
Hi
Its this video updated or file structure for mods changed?
https://www.youtube.com/watch?v=ArPOmuFEdGo
Wouldn't it be possible to make a context action for sinks etc that allow you to draw water if some variable is true?
ofc it probably wouldn't be detected by crafting that needs water, but you could just tap it into pots etc before crafting
Thats the sort of thing I want to learn about. Especially map interaction; like a locked gate popping open when you hit a button
I am nesting multiple buttons and text field in a row inside the scroll option.
does anyone know where foraging zone data is kept on a save file?
my recipe .lua file for my mod causes the items required for crafting sheet rope, ripped sheets and dismantling digital watches to disappear? the recipes are still in the crafting list but nothing the box that usually has the ingredients is gone. any ideas?
put the code of one of those recipes here
you mean the lua code right?
Recipe = {}
Recipe.GetItemTypes = {}
Recipe.OnCanPerform = {}
Recipe.OnCreate = {}
Recipe.OnGiveXP = {}
Recipe.OnTest = {}
function Recipe.GetItemTypes.CraftPlankStack(scriptItems)
scriptItems:addAll(getScriptManager():getItemsTag("Rope"));
end
-- save the ropes used
function Recipe.OnCreate.CreatePlankStack(items, result, player)
local item, itemType;
local ropeItems = {};
for i = 0, items:size() - 1 do
item = items:get(i);
if item then
itemType = item:getFullType();
if itemType ~= "Base.Plank" then
table.insert(ropeItems, itemType);
end;
end;
end;
result:getModData().ropeItems = ropeItems;
end
-- give back the ropes used
function Recipe.OnCreate.SplitPlankStack(items, result, player)
local ropeItems = items:get(0):getModData().ropeItems;
if ropeItems == nil then
player:getInventory():AddItem("Base.Rope");
player:getInventory():AddItem("Base.Rope");
else
for i = 1, #ropeItems do
player:getInventory():AddItem(ropeItems[i]);
end;
end
end
here's what it looks like in game when i go to dismantle the watch
everything that i modded in functions as it should, its just messing up these other recipes ( for anyone reading this after the fact, i pretty much took the code from server/recipecode.lua that referenced LogsStacks, switched out the names so it's referring to my new items, and stuck that code into a new .lua file that was packaged in my mod. )
uhm
I cna't help you, but that code should be able to tel someone more experienced what's happening
ty:)
sorry mate, butthere is really nice and talented people here so I'm sure you'll get an answer soon
you're overrdiing the tables at the beginning of your file, don't do that
Recipe = {}
Recipe.GetItemTypes = {}
Recipe.OnCanPerform = {}
Recipe.OnCreate = {}
Recipe.OnGiveXP = {}
Recipe.OnTest = {}
remove these
You flushed vanilla recipe functions down the toilet the moment you made those = {} , empty tables
is there a way to create sound loops? I'm doing a script for sound, looks like this:
sound demake
{
category = Item,
clip
{
file = media/sound/demake.ogg,
}
}
but it'll only play once and I'm trying to avoid creating longer sounds, but I'll have to do it if I don't have a way to loop them
sound demake
{
category = Item, loop = true, is3D = true,
clip
{
file = media/sound/demake.ogg, distanceMax = 20, volume = 1,
}
}
distance max it's relaetd to how far the sound gets in the game, like for a sound that will attract zeds?
to attrack zombies you need to use this global function
addSound(playerObj, playerObj:getX(), playerObj:getY(), playerObj:getZ(), 20, 20);
Is there a way to add multiple outputs of a recipe?
Apparently this here doesnt work:
Basically i want to split a previously combined item again
To add more you need to use the OnCreate property and a function to plug into it.
Recipe want to return only 1 result item. The OnCreate function will let you add more.
eh ?
Thanks! Will look into it
where do you put mods that you create?
C:\Users\YOU_PC_NAME\Zomboid\Workshop
you can use ModTemplate as example for the mod file structure
ok, thanks
Cool. It worked. Thanks again 😄
With global modData, if I use ModData.request(String key). How do I get the table after ? With the event OnReceiveGlobalModData or I can use ModData.get(String key) ?
Having trouble with regions on my server (hosted). They never show up when I boot the server and start to spawn in, can anyone break down what I have to do fix it?
By the way, I mean I don't have the option to spawn in them
In single player it works fine
what % chance does this translate to?
.01% or .001% or what?
since in most games 0.4 is usually like 40%
Thats 0.1 percent
thanks
np
Any idea how I fix the problem with spawn regions? Im desperate
good plan lol. I've been in that spot before, kinda sucks
Hello, I have a question, can it be implemented that a garment can be repaired with cloth or leather?
While this is active can anyone help me with the region thing I posted a little while ago
How do I get the in-game time and date?
I mean in lua
Maybe I'm misunderstanding you, but there is a vanilla feature to patch holes and reinforce clothing in-game with the tailoring skill. At a high enough level you can even perfectly repair clothes.
Perfect, thx
sadly you'll have to wait until someone that knows that answer would help you out :/
if I knew I'm sure as hell I would be glad to help you out
Alr
don't lose hope, this channel has a lot of very cool, talented and nice people
Ok, let me explain this way.
Is it possible to configure that a garment when repaired completely "without patches", like a jacket, the chest is repaired with leather and the sleeves with cloth?
You mean like you're repairing it and because of that, there's extra/different material?
So like I break both sleeves on a cotton t shirt, I repair it and it becomes leather or some other material I had
?
my isn't my mod showing up in the mod list?
followed the Blackbeard tutorial almost exactly
oh wait
fixed it
OnReceiveGlobalModData
then you choose if you want to save it or do something with it
Ok and the table is save ? Like if the server reboot, the table is the same ?
i have seen this issue before. cant completely remember all the correct file names and such because i dont host games ever. BUT im pretty sure you should have a spawn regions file somwhere with a list of all the maps. modded maps have to be put into this list before the vanilla ones.
Before as in they have to be above the other ones so they are run first?
Ie, moving the ky maps to the bottom of this
yes. move the KY maps to bottom so the game reads them last
i hope it works
atm servers dont save global mod data
ive told the devs
Didnt work however I think im on to something
Damn, is there a risk free alternative?
have a look around because the spawn regions file you eddited isnt set out the same way as i remember
save the table with the json thingy and load it back on startup
Well heres what I noticed
If I go and check my server files, you have all the mod spawn regions as maps
and then just maldraugh
What happens if the server crashes? But I get it, thx
These makes me believe that maldraugh should have all the modded regions in it
But they arent in it
it should look likemap= modname, modname, Muldragh, KY
cope
It was reading all of those as maps, instead of regions
I need to find the map file
can save on a timer
And then add those all and put muldraugh ky
Yes that's what I told myself, save every hour
exactly. riveside and westpoint wont be in the list iirc
because they are covered under the same region as Muldragh, KY
this is the client side save of a server
server side save
global mod data is missing
Any idea where the file is, cant find it on google
nope. never done it myself. not at my computer either xD
@sand tinsel
from this guide:
https://steamcommunity.com/sharedfiles/filedetails/?id=2702119685
Server test ini
^ 👍
Mmmm kind of stupid to not save it
Still cant figure it out, and it seems Im missing the spawnpoints.lua file
for all the maps
dont know why
never mind found it
still doesnt solve the problem though
Found it!
Alright
I did it
I did all the steps
Moment of trut
truth
Its booting
It didnt work
I hate this
Hello there. I wanted to start modding pz but am kinda confused on what to use. Should I just program in lua or should I use the Storm Toolchain? https://github.com/pzstorm/storm
sorry man. it must be more complex and probably beyond me then
theres one line I dont understand
Next, re-FTP into your folder. Overwrite/edit your spawnregions.lua files and copy the info from the mod= line in your servertest file to match the one in the server, either manually or by overwriting.
That one
I think he means make the mods the same as the server
But i dont know
It just dont make sense
And when I go in game, I still have to add the regions as maps in order for them to appear in spawn region
Its just so stupid
how would i go about locking a recipe behind a certain zombie kill count/days alive?
yeah!
Hm
I mean
I dont code
But you could add a stat thing
LIke
Every day you get
20 xp in this stat
Like maintennance those kinda stats
once you hit a certain level it gives you the recipe
Or I mean, not sure if this would work, but have something to check the amount of days, then when you hit a certain amount of days it gives you an item or something that has the recipe
But im not savvy with that stuff
lookup mod become desensitized. have a look through the code to see how they achieved it
Nice 
is there a way for me to detect if the vehicle i'm driving is damaged?
raising an event
anyone know how many unique zombie sound effects there are?
Any opinion about this ui?
It's kinda raw but I think i did an okay-ish job, but god I hate unresponsive UI
I am creating a Custom Object.
I have the ISCustomLightSwitch which describes how the object is placed.
Once the object is placed ISCustomLightSwitch:create is called. This method will then create the object IsoObject.new(getCell(), self.sq, getSprite(sprite)) and add it to the square.
Does my workflow makes sense? I tested and it works as intended.
The second question I have is around using the IsoObject. I could not find any generic type I could use. However, by using IsoObject I have no way of using isinstanceof when building my menus. Should I derive from IsoObject to create my own?
Thanks in advance.
Prototype of my pager mod, almost finish
Damn man that's pretty cool 😮
Can I add a custom recipe to a vanilla magazine ?
What is wrong with this code?
local electronicsSubMenuOption = context:addOption("Electronics", nil, nil)
local electronicsSubMenu = ISContextMenu:getNew(context)
context:addSubMenu(electronicsSubMenuOption, electronicsSubMenu)
electronicsSubMenu:addOption("Light Switch", nil, nil)
Hello everyone.
I have created a stealth camo mod, and I'm using vanilla GhostMode to achieve stealth.
However, GhostMode is mainly for debugging purposes, which has caused some problems.
(no sound playback, collision detection disabled, etc.)
Another possible way to achieve stealth would be to "take away the zombie's vision",
but this could not be achieved (by my modding skill).
This is just an idle talk, do you have any good ideas on how to achieve stealth?
I would like to hear various opinions.
https://steamcommunity.com/sharedfiles/filedetails/?id=2762398967
Where is getPlayerInventory defined? I'm calling it, and it seems to work, but I'd like to look at it. I can't find it among the other functions exposed globally by the LuaManager class, or searching anywhere else (other than the actual calls using it in vanilla code).
its defined in lua
client\ISUI\PlayerData\ISPlayerData.lua
Muchas gracias
Some later game ideas
Ability to craft a pager to a door
So if the door is opened it notifies the connected users pager(s)
Good for MP if you have a base thats getting raided for example
Do you guys know where is the furnitures files? I want to make one but I don't have any reference
Is it normal for Item instances (from a character's inventory "backpack" in this case) to always return a Count/getCount() result of 1?
I would've expected stackable items to report a count of 2+ similar to the way they look in the inventory page:
Would anyone know why this SubMenu is throwing an error?
Can you include the error? just seeing the code isn't necessarily enough info
attemped index: subOptionsNums of non-table: null
What's the function call chain?
is there a way to copy from the game stackstrace?
It's just a file
it's k, you just needed a rubber duck 🙂
Glad you found it!
Thanks anyways for helping out
np
Furniture appears to be defined under <PZ install dir>\media\scripts\newMoveables.txt
yep thanks a lot
there is a zombie camouflage mod that make the player "invisible", maybe you could take a look https://steamcommunity.com/sharedfiles/filedetails/?id=2665369300
this code would generate the item I want with 100% chance on all zeds?
require 'Items/SuburbsDistributions'
local allinv = {"inventorymale", "inventoryfemale"};
table.insert(SuburbsDistributions["all"][allinv].items, "AsuraChi.baseChi");
table.insert(SuburbsDistributions["all"][allinv].items, 100);
well, didn't work
shows an error, I'll keep trying
Hi modders, am new to modding - just wanted to start with something simple like changing an item's image and stats (not through the game files, would rather release as a mod so the server can apply it). How should I start? There is probably very similar code I can reference to? (I am more trained in data analytics, think R and Python, so not familiar to modding languages)
I think it'll depend on the item but it's pretty basic, even for us non programmers!
waht item you want to change?
this one worked out fine
require 'Items/SuburbsDistributions'
table.insert(SuburbsDistributions["all"]["inventorymale"].items, "AsuraChi.baseChi");
table.insert(SuburbsDistributions["all"]["inventorymale"].items, 999999999);
table.insert(SuburbsDistributions["all"]["inventoryfemale"].items, "AsuraChi.baseChi");
table.insert(SuburbsDistributions["all"]["inventoryfemale"].items, 999999999);

but IDK if this change did something to zombies, someone knows if it's correct?
tried using 100 but the item didin't appeared in all zeds, this one worked out fine
I was afraid of that but I wasn't sure
Unless there's a -1 or something for "always add this", but I haven't looked into distributions at all
still appeared other items like always tho
yeah this is my first time on this due desperation because I was using OnZombieDeath function but creates some weird issues in MP
the item I spawn duplicates by the ammount of players that loot the corpse
if anyone knows how I can add an item for everyone without messing with other mods would be fantastic
😅
Aren't there ways for scripts to run serverside, aka only once?
Otherwise you'd have to mess with that message sending thing from client/server/otherclients
idk honestly, I had the script on server folder
was this one
function zombieDeath(zombie)
local inv = zombie:getInventory();
inv:AddItems("AsuraChi.baseChi", 1);
end
Events.OnZombieDead.Add(zombieDeath);
and tried many more iteration of similar codes, all with the same results
I'll try with -1 just to see if it works
nope, doesn't work, now the item doesn't spawn 😦
Hmm
Apparantly you might be able to place a minimum value for items to spawn in a container
If you can say minimum 1 asura it would always drop
yeah that would be nice, but it only have to drop from corpses
in the future I'm planning to add a player action to gather the item I want plus the zeds
I saw it on a forum post "quick guide how to mod distribution" but that's in the distributions.lua file when I did a quick google
yeah but that's fro containers
Zombie corpses are also containers though, technically
but yeah idk if you can change what zombies drop from it
Maybe only in procedural
the adding you did looks like a proceduraldistributions
Since it only has a weight
But hmm, wouldn't it be possible to add a new table for your asura that has minimum 1 and only contains asuraChi?
I don't know how to do that honestly
but I would do anything at this point, I'll try to look for examples
If this structure is still the case
What I'd like to see, is the distributions.lua ["all"][inventorymale]
Because if you can edit that one, you can add a new entry to the ProcList, and add your own procedural distributions for that proclist that only contains ur chi
And set it to minimum 1 so it always drops 1
You could also set it so maximum is 2 so theres a chance for 2, if you wanted to lol
nah just 1 it's perfect
I've looked that file and tbh I didn't understand anything
Where is the distributions.lua file? I could take a look
thanks for responding! Honestly just wanted to see if I could create a "texture pack" of sorts, but more for the items themselves. Have not looked into coding languages yet though, I am really starting from 0 right now. I see some mentions about Java and stuff but will have to look closer after I get off work
Cheers!
Game is written in java, but modding uses lua, so you might need a little java knowledge to understand the documents that tell you what functions exist etc
well, it's completely possible, most mods do that in fact, sicne you have a coding background it'll be easy to understand
media/lua/items, there are the 2 files
3 in fact, distributions.lua, proceduraldistributions.lua and suburbsdistributions.lua
I took the example code form a mod that adds loot to zombies and compared to another one and both shares the same structure, but both works with chances and I haven't found anything llike what I want
a great way to understand how the item structure works if looking for the fiels that add items on vanilla, it's in the main pz folder, then media/scripts
relevant files are the ones with "item_" and models_items
Hmm, can a container have both a procList and standard items?
Or does procedural override it
I don't have idea, tbh my mods is pretty simple, just a bunch of items and recipes
inventorymale = {
rolls = 1,
items = {
"BluePen", 1,
"Cigarettes", 0.5,
"Cologne", 0.5,
"Comb", 1,
"CreditCard", 1,
"Earbuds", 1,
"Lighter", 0.5,
"Locket", 1,
"Magazine", 1,
"MarchRidgeMap", 0.1,
"Matches", 0.5,
"MuldraughMap", 0.1,
"Newspaper", 1,
"Notebook", 1,
"Pen", 1,
"Pencil", 1,
"Pills", 0.1,
"PillsAntiDep", 0.1,
"PillsBeta", 0.1,
"PillsVitamins", 0.1,
"Radio.WalkieTalkie1", 0.05,
"Radio.WalkieTalkie2", 0.03,
"Radio.WalkieTalkie3", 0.001,
"RedPen", 1,
"RiversideMap", 0.1,
"RosewoodMap", 0.1,
"Wallet", 1,
"Wallet2", 1,
"Wallet3", 1,
"Wallet4", 1,
"WestpointMap", 0.1,
}
},
I've been avoiding lua stuff
That's how the inventoryMale is
It takes 1 item from all those
I can see 1 method that might save you hassle, since this is only dropped items
What if you make all zombies equip an asurachi?
Then it would also drop
equip how, like clothes?
Yeah, I'm sure theres a place you can change what clothes they spawn in
And such
Like items in their inventory
Axes in their body and all that
So i posted my utilities class that i posted here before, on the forum, might be easier to follow up and update.
https://theindiestone.com/forums/index.php?/topic/49989-utilities-class-for-modder/
I share my Utilities class here, it add a variety of useful function to help make mods implementation works both in SP as in MP. It contains client only functions, server only functions and shared functions that can be used by both the client and server. The networking functions give the modders ...
-- Current
inventorymale = {
rolls = 1,
items = {
-- lots of stuff
}
},
-- Possible, changes? But probably would fk with other mods...
inventorymale = {
procedural = true,
ProcList = {
{name="InventoryMale", min=1, max=1, weightChance=100}, -- would have to add it to proceduraldist.lua
{name="AsuraChi", min=1, max=2, weightChance=5}, -- would weightChange add 5% for two?
}
},
-- Do both work at the same time? would be for best probably.
inventorymale = {
rolls = 1,
items = {
-- lots of stuff
}
procedural = true,
ProcList = {
{name="AsuraChi", min=1, max=2, weightChance=5}, -- would weightChange add 5% for two?
}
},
It's that or making it so zombies spawn with it in their inventory that's best I think. Maybe konjima's utilities has a better method for you
I actually got a small api that i will release for easily adding item spawn to outfits.
cause adding items to an outfit require the outfit entry to be already in the distribution table, so it kind of handle it so that if its found already from an other mod, it will just add the items but if its not then it creates it.
Well, I don't think I can find out if you can have both items and ProcList on a single entry and have both work without looking at the java for picking what item(s) to spawn
Since nothing in the default list has both
Too lazy to actually test it in practice 😂
I believe the distribution for outfit is not procedural
Don't know about outfits, wouldn't surprise me if they did include randomness to it though
well mate, I'm really greatful for all your help
I think I'll stick to OnZombieDead even if it's bugged :/
if you wanted to test having both proclist and the other one
I am finding things like "ArmySurplusOutfit" in proceduraldist
So I'm guessing that the outfits have their own ProcLists included
but it's that 999999 weight really messing with other mods?
all of this would be more easy if I couldtreat it like the containers on rooms
mhm interesting
I just tested it in MP and works as I want, but I don't want to mess with other mods at all
I have this for now
require "Items/SuburbsDistributions"
-- Define your mod distribution for outfits
local myOutfitDistributionEntries = {
["Bandit"] = {
rolls = 1,
items = {
"Drugs.EmptyBaggie", 5,
"Drugs.CocaineBaggie", 10,
},
},
["Punk"] = {
rolls = 1,
items = {
"Drugs.EmptyBaggie", 10,
"Drugs.CocaineBaggie", 5,
},
},
};
-- The code handling the distribution table
for key, value in pairs(myOutfitDistributionEntries) do
local outfitName = "Outfit_" .. key;
-- Outfit not found we create it
if not SuburbsDistributions.all[outfitName] then
SuburbsDistributions.all[outfitName] = {
rolls = value.rolls or 1,
items = value.items,
};
-- Outfit already found we just add the items
else
for i = 1, #value.items do
table.insert(SuburbsDistributions.all[outfitName].items, value.items[i]);
end
end
end
in fact I'm thinking that I should drop the chi from corpses and try to get working a player action, I could use just a recipe but AFAIK recipes doesn't allow to change things like hunger or thirst
taht would be more true to my kenshi mod
maleTable = UrbanDistributions["all"]["inventorymale"]
table.insert(maleTable, {"procedural", true}) -- can you add keyValuepairs like this?
table.insert(maleTable, {"ProcList",{{name="AsuraChi", min=1, max=2, weightChance=5}}})
table.insert(ProceduralDistributions.list,{
"AsuraChi",
{
rolls=1,
items={"AsuraChi", 1}
}
})
Well idk about the table.insert thing
table insert will add it as an array entry, not as an object table with keys (just saying idk if that ok or not for your case)
Idk it seems easier to let the game handle merging it isntead
than doing it with code
The SuburbsDistributions.lua has merging logic for additional distributions
I'm completely lost at this point lmao
I'm sure as hell I'll be crediting you too when I launch this
So you can add your own distributions.lua and add it to a list of distributions
and the game merges it together when it's loading
thank you for the aptience and the disposition, means a lot to me
I'll go to sleep, it's almsot 4am here and I'm dying
thank you very much to you 2, again
what if two mod try to add to the same outfit? its not yet merge and one will overwrite the other kind of.
And i supose it will anyway if one mod doesnt do it properly
If any keys conflict
There's a List called Distributions somewhere, and the games default Distribution should be the first item in the list (always)
And if you want to add new lists you need to add your distributions table onto that one
And any conflicts from base game will be overriden
Like if you want to make a certain item spawn less
ah yeah i see
-- in SuburbsDistributions.lua
local function mergeDistributions()
SuburbsDistributions = Distributions[1] -- the games distribition table should always be the first in table.
-- if there are modded distribution tables merge them into the main suburbsdistributions
im gonna need to take deep look at the whole distribution system i think im missing a couple key things here
-- at the bottom of Distributions.lua
table.insert(Distributions, 1, distributionTable);
--for mod compat:
SuburbsDistributions = distributionTable;
Is it possible to insert into that list without specifying index?
So you don't accidentally override any other mods dsitributions
yeah im looking at the same
just omit the index and it will append it
table.insert(Distributions, myModDistributionTable);
If things do merge, it might be possible that things do have both procedural and fixed items
Yeah its seem that it might be the proper way of doing it
Does it handle both of them properly then?
Because that'd be a good way to solve Asura guy's problem
Just smack a ProcList that always drops 1 on the inventory of male and female corpses
Or if theres a method without proclist that gives you minimum of 1 and doesn't impact random rolls
i always used SuburbsDistributions directly not knowing i could simply add my own tables to Distributions and that would simply merge and prevent conflict with other mods.
If im understanding correctly
Well it will still conflict if you are both changing the same things
And it will use the last loaded one in that case most likely
But that's only if you are both changing the same variable, not sure how it works for the lists?
However you could be naughty and hook to Events.OnPostDistributionMerge if you want to ensure no other mod screwed you on something 😂
ProceduralDistributions does not have that merging stuff
Nah, but it is a simple list instead
or should I say simpler
It's only one level deep
not sure what the mod compat thing at the bottom wants
if you use table.insert, and you have an object with same key as the base game, what happens?
hmm
probably they though of doing something similar and decided to not to for now or not needed at all
Hmm
Well
Think would have to go read some java to find out how it uses the procedural tables
well the procedural table is only used for "linking" to the suburbDistribution proc list.
so basically it must only be looking up for the key in list
Well from what I gather so far, you could probably add a new procedural table by writing something like:
require('summat/ProceduralDistributions.lua') -- whatever the path is
list = ProceduralDistributions.list
table.insert(list, "ProcListName", {rolls=1, items={"ItemName", 1}}
or just simply
ProceduralDistributions.list.Konijima_DopeStorage = {
rolls = 2,
items = {
"Drugs.EmptyBaggie", 20,
"Drugs.CocaineLine", 20,
"Drugs.MDMAPill", 10,
"Drugs.CocaineBaggie", 1,
"Drugs.MDMABaggie", 1,
},
junk = {
rolls = 1,
items = { }
},
};
Yeah that probably works too
it does
But that definitivly will be overwritten if an other mod use the same key
So its a good idea to prefix our custom proc table
I just saw the examble for outfit adding items
in All
-- This is an example to add a specific distribution on a dead corpse according to his outfit
Outfit_Generic99 = {
rolls = 1,
items = {
"Wallet", 100,
}
},
Yea
You can definitely add ProcList to that then
but if an other mod add items not as procedural to the same outfit (and that if they dont override it completely in the first place) then idk what will happen
based on the example i suspect it shouldnt be procedural
Just curious what would happen if an item has both procedural =true and items{some items}
but not saying you cant
Nah there are outfits that have procedural I think
because proceduraldist file has "armysurplusoutfit"
bunch of outfit proclists
I dont know where the outfit are set but clearly not in Items\Distributions.lua
armysurplusoutfit is only to generate army clothing into a container
hmm
i havent found where the zombie base loot is defined
But since it's inside distributionsLua it should hook into the proc thing
So it should work
yeah sure it should
i would assume that if the code find procedural = true, it will use procedural only.
im trying to find the actual code instead
xD
so IsoZombie have addItemToSpawnAtDeath(InventoryItem var1) which seem to be used with AttachedWeaponDefinitions
but i think outfit loot is defined in the xml
but thats only for the clothing item, not the random Items loot
that attachweapon thing is also neat for ading items on death
it should only add it once right? on servers
tho I've heard of people seeing different items inside zombies
when I played some MP apparantly same zombie had 2 diff things for people
But thats also for visual item like katana on the chest
You think this might work?
-- AsuraDistributions.lua
-- Idk the actual requires, fix as necessary
require('Distributions')
require('ProceduralDistributions')
local asuraTable = {
all = {
inventoryfemale = {
items={"Apple", 50000,}
procedural=true,
ProcList= {
{name="AsuraChiItems", min=1, max=2, weightChance=5}
}
},
inventorymale = {
items={"Apple", 50000,}
procedural=false,
ProcList= {
{name="AsuraChiItems", min=1, max=2, weightChance=5}
}
}
}
}
ProceduralDistributions.list.AsuraChiItems = {
rolls = 1,
items = {
"AsuraChi.baseChi", 10,
},
junk = {
rolls = 0,
items = {}
}
}
-- Fix as necessary if names are wrong
table.insert(Distributions, asuraTable);
Though it assumes that it can take rolls from itemlist and procedural same time
table.insert for the ProceduralDistributions.list will not work
cause is a key/value table not an indexed table
oh right
but im sure it would work for the Distributions line
it will process it into the merge function
but
inventoryfemale might not works
cause its already defined not as a procedural
I mean, doing the table insert with key is the same as doing the .Name thing
I even spelled procedural wrong LOL
in the worst case scenario it will use you procedural only and ignore the other vanilla items to it
Well, should try it still
add some ridiculous weight item the norm and then use procedural too
i really dont think table.insert works with key/value table
cause it dont set the key anywhere
It should if you specify the key