Friendly bandit Posted June 11, 2017 Posted June 11, 2017 Like in the title, is there way to make item forageable?
Svarog Posted June 11, 2017 Posted June 11, 2017 Yeah, with lua. File created should be placed in MyMod/media/lua/server/Farming/ require "Farming/ScavengeDefinition"; local MyItemThingy = {}; MyItemThingy.type = "MyModModule.MyItem"; MyItemThingy.minCount = 1; MyItemThingy.maxCount = 1; MyItemThingy.skill = 3; table.insert(scavenges.forestGoods, MyItemThingy); Since last Build and introduction of Foraging menu, you should keep in mind to classify the item as something that fits into the available categories. Can do that by replacing forestGoods in line belowtable.insert(scavenges.forestGoods, MyItem); With: berries mushrooms insects medicinalPlants tommysticks 1
Friendly bandit Posted June 11, 2017 Author Posted June 11, 2017 Thank you very much I know it might be dumb question, i'm new in modding (I made only 2 mods for PZ and 1 for Rimworld) but these "MyItemThingy" should be replaced by something? Do I have to change them?
Svarog Posted June 11, 2017 Posted June 11, 2017 4 hours ago, Friendly bandit said: Thank you very much I know it might be dumb question, i'm new in modding (I made only 2 mods for PZ and 1 for Rimworld) but these "MyItemThingy" should be replaced by something? Do I have to change them? Yes, for each item you want to add you should use a different MyItemThingy. Here's how the game's base code for this looks. local log = {}; log.type = "Base.Log"; log.minCount = 1; log.maxCount = 1; log.skill = 6; local branch = {}; branch.type = "Base.TreeBranch"; branch.minCount = 1; branch.maxCount = 3; branch.skill = 0; Let's say you want to make it possible to find sunflower seeds. Here's how an example file would look. require "Farming/ScavengeDefinition"; local SunflowerSeeds = {}; SunflowerSeeds.type = "Base.SunflowerSeeds"; SunflowerSeeds.minCount = 1; SunflowerSeeds.maxCount = 5; SunflowerSeeds.skill = 1; table.insert(scavenges.berries, SunflowerSeeds); It would make it possible to find 1-5 sunflower seeds if the player's Foraging skill is at least 1 and he's looking for Food items.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now