Jump to content

Help with item distribution and a few questions


Kidlonewolf

Recommended Posts

I was wondering which method i should use to get custom items to spawn in game correctly. They all have proper item names, display names, icons, and icon names. I'm not sure whether to use a copy of the SuburbsDistributions.lua in my mod with the new items added to the lists like Arican says here, or if i should make a new lua file for the new items only? I don't know if using a copy of the lua will cause problems seeing how base.items will be listed twice. 

 

I had a look at the items and recipes tutorials and it was set up like this.

 -- ================================================ --

-- Spices Tutorial Mod --
-- created by Kinyoshi --
-- Distribution File Modeled From RoboMats Mods --
-- ================================================ --

require "Items/SuburbsDistributions";

SpicesTutorialMod = {}
SpicesTutorialMod.version = "1.0.0";
SpicesTutorialMod.author = "Kinyoshi";
SpicesTutorialMod.modName = "Spices Tutorial Mod";

-- ------------------------------------------------
-- Functions
-- ------------------------------------------------
---
-- Prints out the mod info on startup.
function SpicesTutorialMod.init()
print("Mod Loaded: " .. SpicesTutorialMod.modName .. " by " .. SpicesTutorialMod.author .. " (v" .. SpicesTutorialMod.version ..")");
end

-- ------------------------------------------------
-- Item distribution
-- ------------------------------------------------
-- KMGroundBlackPepper
table.insert(SuburbsDistributions["all"]["bin"].items, "Base.KMGroundBlackPepper");
table.insert(SuburbsDistributions["all"]["bin"].items, 2);
table.insert(SuburbsDistributions["all"]["counter"].items, "Base.KMGroundBlackPepper");
table.insert(SuburbsDistributions["all"]["counter"].items, 2);
table.insert(SuburbsDistributions["all"]["metal_shelves"].items, "Base.KMGroundBlackPepper");
table.insert(SuburbsDistributions["all"]["metal_shelves"].items, 2);
table.insert(SuburbsDistributions["all"]["crate"].items, "Base.KMGroundBlackPepper");
table.insert(SuburbsDistributions["all"]["crate"].items, 2);
table.insert(SuburbsDistributions["conveniencestore"]["shelves"].items, "Base.KMGroundBlackPepper");
table.insert(SuburbsDistributions["conveniencestore"]["shelves"].items, 2);
table.insert(SuburbsDistributions["grocery"]["counter"].items, "Base.KMGroundBlackPepper");
table.insert(SuburbsDistributions["grocery"]["counter"].items, 2);
table.insert(SuburbsDistributions["grocery"]["shelves"].items, "Base.KMGroundBlackPepper");
table.insert(SuburbsDistributions["grocery"]["shelves"].items, 2);
table.insert(SuburbsDistributions["grocery"]["crate"].items, "Base.KMGroundBlackPepper");
table.insert(SuburbsDistributions["grocery"]["crate"].items, 2);
table.insert(SuburbsDistributions["spiffoskitchen"]["counter"].items, "Base.KMGroundBlackPepper");
table.insert(SuburbsDistributions["spiffoskitchen"]["counter"].items, 2);
table.insert(SuburbsDistributions["kitchen_crepe"]["counter"].items, "Base.KMGroundBlackPepper");
table.insert(SuburbsDistributions["kitchen_crepe"]["counter"].items, 2);
table.insert(SuburbsDistributions["plazastore1"]["counter"].items, "Base.KMGroundBlackPepper");
table.insert(SuburbsDistributions["plazastore1"]["counter"].items, 2);
table.insert(SuburbsDistributions["grocers"]["grocerstand"].items, "Base.KMGroundBlackPepper");
table.insert(SuburbsDistributions["grocers"]["grocerstand"].items, 2);
table.insert(SuburbsDistributions["grocers"]["smallcrate"].items, "Base.KMGroundBlackPepper");
table.insert(SuburbsDistributions["grocers"]["smallcrate"].items, 2);
table.insert(SuburbsDistributions["fossoil"]["counter"].items, "Base.KMGroundBlackPepper");
table.insert(SuburbsDistributions["fossoil"]["counter"].items, 2);
table.insert(SuburbsDistributions["fossoil"]["shelves"].items, "Base.KMGroundBlackPepper");
table.insert(SuburbsDistributions["fossoil"]["shelves"].items, 2);
table.insert(SuburbsDistributions["fossoil"]["crate"].items, "Base.KMGroundBlackPepper");
table.insert(SuburbsDistributions["fossoil"]["crate"].items, 2);
table.insert(SuburbsDistributions["fossoil"]["crate"].items, "Base.KMGroundBlackPepper");
table.insert(SuburbsDistributions["fossoil"]["crate"].items, 2);
table.insert(SuburbsDistributions["grocery"]["shelvesmag"].items, "Base.KMGroundBlackPepper");
table.insert(SuburbsDistributions["grocery"]["shelvesmag"].items, 2);
table.insert(SuburbsDistributions["fossoil"]["shelvesmag"].items, "Base.KMGroundBlackPepper");
table.insert(SuburbsDistributions["fossoil"]["shelvesmag"].items, 2);
table.insert(SuburbsDistributions["garage_storage"]["all"].items, "Base.KMGroundBlackPepper");
table.insert(SuburbsDistributions["garage_storage"]["all"].items, 2);
table.insert(SuburbsDistributions["motelbedroom"]["wardrobe"].items, "Base.KMGroundBlackPepper");
table.insert(SuburbsDistributions["motelbedroom"]["wardrobe"].items, 2);
table.insert(SuburbsDistributions["policestorage"]["metal_shelves"].items, "Base.KMGroundBlackPepper");
table.insert(SuburbsDistributions["policestorage"]["metal_shelves"].items, 2);
table.insert(SuburbsDistributions["policestorage"]["metal_shelves"].items, "Base.KMGroundBlackPepper");
table.insert(SuburbsDistributions["policestorage"]["metal_shelves"].items, 2);
table.insert(SuburbsDistributions["policestorage"]["metal_shelves"].items, "Base.KMGroundBlackPepper");
table.insert(SuburbsDistributions["policestorage"]["metal_shelves"].items, 2);
table.insert(SuburbsDistributions["policestorage"]["metal_shelves"].items, "Base.KMGroundBlackPepper");
table.insert(SuburbsDistributions["policestorage"]["metal_shelves"].items, 2);
table.insert(SuburbsDistributions["policestorage"]["metal_shelves"].items, "Base.KMGroundBlackPepper");
table.insert(SuburbsDistributions["policestorage"]["metal_shelves"].items, 2);
table.insert(SuburbsDistributions["all"]["inventorymale"].items, "Base.KMGroundBlackPepper");
table.insert(SuburbsDistributions["all"]["inventorymale"].items, 1.4);
table.insert(SuburbsDistributions["all"]["inventoryfemale"].items, "Base.KMGroundBlackPepper");
table.insert(SuburbsDistributions["all"]["inventoryfemale"].items, 3);
-- ------------------------------------------------
-- Game hooks
-- ------------------------------------------------
Events.OnGameBoot.Add(SpicesTutorialMod.init);


Events.OnGameBoot.Add(SpicesTutorialMod.loadTextures); 

 

I'm guessing that table.insert(SuburbsDistributions) adds into the SuburbsDistributions.lua so is this the preferred way?

 

Also a question about backpacks: why does a pack that has weight reduction 100 with 45 capacity cause the players main inventory to act as if its full? I had the full back pack on and only clothes on and it said 2/8 i believe but i couldn't pick anything up, but i could add items to another bag if i had it in my hands along with the full backpack on my back.

Link to comment
Share on other sites

I'm guessing that table.insert(SuburbsDistributions) adds into the SuburbsDistributions.lua so is this the preferred way?

 

Yup AFAIK this is preferred; it means you are not overwriting the SuburbsDistributions.lua file.

The only other way would be to write your own item spawning algorithms, but I've only seen mods do this when they need fine grain control over the spawns.

Afraid I can't comment on the backpack question, but someone else might. :)

Link to comment
Share on other sites

I think you should put on the begining of file

require 'Items/SuburbsDistributions'

and then by using table.insert put items in arrays responsible for spawns of items ex. :

table.insert(SuburbsDistributions["grocery"]["counter"].items, "nameofitem");

"grocery" -- building(room?) in which item should spawn

"counter" -- container 

"nameofitem" -- name of item which you want to put 

and line below that put 

table.insert(SuburbsDistributions["grocery"]["counter"].items, 1);

I'm not sure but in my opinion that number on the end shows how rare this item should be

I hope it's clear enough :)

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