Jump to content

Item distributions help.


kongkim

Recommended Posts

Hi im new to PZ and the modding :)

 

Are still trying to learn how it all works and have a hard time with some of it. 

 

Right now im trying to make a test mod and is working with the .lua distributions file to get the test item out in the world.

 

It looks like this: 2 .lua files in the folder (Zomboid\mods\testitem\media\lua\server\items)

 

spawntestitem.lua

table.insert(SuburbsDistributions["all"]["inventorymale"].items, "custom.testitem");
table.insert(SuburbsDistributions["all"]["inventorymale"].items, 1);
table.insert(SuburbsDistributions["all"]["inventoryfemale"].items, "custom.testitem");
table.insert(SuburbsDistributions["all"]["inventoryfemale"].items, 2);
 
loadtestitem.lua
Icon = {};
 
function Icon.loadTexture()
getTexture("Item_spiffothefighter.png");
end
 
Events.OnGameBoot.Add(Icon.loadTexture);
 
1: is the code right? And can i add all the code to one lua file?
2: Is the folder destination right?
3: How do i control drop chance?
 
Hope someone can help :) Is really looking forward to build 33 :D
 
Link to comment
Share on other sites

Ok got most of it to work :)

 

But if i make it all as one file nothing spawn.

 

Also the 2 in here is the spawn rate right?

 table.insert(SuburbsDistributions["all"]["inventoryfemale"].items, 2);

 

But it is 2% or 20%?  so if i what a spawn % of 100% and one of 5% then type what?

Link to comment
Share on other sites

  • 2 months later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...