Jump to content

Add an item to a loot table


Shadowlarax

Recommended Posts

Hi I was wondering how to add items to loot tables, trying to just update zombie drops but I'm a coding novice. Looked at some other peoples code but it makes no sense to me without a reference.

Thank's for your time.


Turn's out I should search harder, found it a couple of threads down. for anyone who wants to know its located in

SuburbsDistribution.lua is located in Project Zomboid\media\lua\server\Items

Edit 2: alright I've got this now but I'm not seeing any drops either I'm misunderstanding the loot system a bit. or have something wrong anyone able to shed some light on this?

 

require 'Items/SuburbsDistributions'table.insert(SuburbsDistributions["all"]["inventorymale"].items, "Base.Lighter");table.insert(SuburbsDistributions["all"]["inventorymale"].items, 100); table.insert(SuburbsDistributions["all"]["inventoryfemale"].items, "Base.Lighter");table.insert(SuburbsDistributions["all"]["inventoryfemale"].items, 100); 
Link to comment
Share on other sites

Did you place your .lua file in your mod's media\lua\server\Items directory? The code looks good.

Edit: Here you go, I was bored. Load it as a mod and it works. If you need more help, PM me I can help with the basics.

Thanks a heap for that, the issue was my file pathing it seems. doing a quick muck around test now but most like you've solved it :)

Edit: Yep it was the file path, you're a legend Svarog. Thanks a heap.

Link to comment
Share on other sites

  • 6 years later...
On 3/26/2015 at 5:19 AM, Shadowlarax said:

Hi I was wondering how to add items to loot tables, trying to just update zombie drops but I'm a coding novice. Looked at some other peoples code but it makes no sense to me without a reference.

Thank's for your time.


Turn's out I should search harder, found it a couple of threads down. for anyone who wants to know its located in

SuburbsDistribution.lua is located in Project Zomboid\media\lua\server\Items

Edit 2: alright I've got this now but I'm not seeing any drops either I'm misunderstanding the loot system a bit. or have something wrong anyone able to shed some light on this?

 

require 'Items/SuburbsDistributions'table.insert(SuburbsDistributions["all"]["inventorymale"].items, "Base.Lighter");table.insert(SuburbsDistributions["all"]["inventorymale"].items, 100); table.insert(SuburbsDistributions["all"]["inventoryfemale"].items, "Base.Lighter");table.insert(SuburbsDistributions["all"]["inventoryfemale"].items, 100); 


I'm a new modder and having the same issues as you in the time of the post.
Can you explain to me how it works?  

I know there's a change in the new loot system so I wondering how to create new mods and items to spawn.

Link to comment
Share on other sites

  • 2 months later...

Working on a similar problem as OP, so i hope people don't mind the bump.

 

Adding an item to the Suburbs distribution just like OP, although not a lighter, and it is causing tremendous  lag for whatever reason. I even moved the weighted number around to no avail. Then I loaded another mod that modified the same table and no lag.

 

I am adding a lootable token type item, and an exchange system to go with it.

>Media

>>Scripts

>>>Module Necrophilia (I can include details other, but my guess is that this is the problem)

>>lua>server>Items>Dustloot.lua

 

require 'Items/SuburbsDistributions'

table.insert(SuburbsDistributions["all"]["inventorymale"].items, "Necrophilia.BlueDust");
table.insert(SuburbsDistributions["all"]["inventorymale"].items, 200);
table.insert(SuburbsDistributions["all"]["inventoryfemale"].items, "Necrophilia.BlueDust");
table.insert(SuburbsDistributions["all"]["inventoryfemale"].items, 200);

 

Anyway, I just figured out writing this that the module name is probably the problem. So I need to load it into the game properly somewhere else?

Link to comment
Share on other sites

23 hours ago, Taldarus said:

Working on a similar problem as OP, so i hope people don't mind the bump.

 

Adding an item to the Suburbs distribution just like OP, although not a lighter, and it is causing tremendous  lag for whatever reason. I even moved the weighted number around to no avail. Then I loaded another mod that modified the same table and no lag.

 

I am adding a lootable token type item, and an exchange system to go with it.

>Media

>>Scripts

>>>Module Necrophilia (I can include details other, but my guess is that this is the problem)

>>lua>server>Items>Dustloot.lua

 

require 'Items/SuburbsDistributions'

table.insert(SuburbsDistributions["all"]["inventorymale"].items, "Necrophilia.BlueDust");
table.insert(SuburbsDistributions["all"]["inventorymale"].items, 200);
table.insert(SuburbsDistributions["all"]["inventoryfemale"].items, "Necrophilia.BlueDust");
table.insert(SuburbsDistributions["all"]["inventoryfemale"].items, 200);

 

Anyway, I just figured out writing this that the module name is probably the problem. So I need to load it into the game properly somewhere else?

 

Looks like your trying to follow old instructions, hopefully this thread might help: 

You want to be using the distributions.lua and/or proceduraldistributions.lua files to add new items.

 

Link to comment
Share on other sites

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...