Jump to content
Sign in to follow this  
kongkim

Item distributions help.

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
 

Share this post


Link to post
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?

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...