Jump to content

Question - is there way to make forageable items?

Recommended Posts

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 below
table.insert(scavenges.forestGoods, MyItem);


  • berries
  • mushrooms
  • insects
  • medicinalPlants
Link to comment
Share on other sites

4 hours ago, Friendly bandit said:

Thank you very much :D


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.

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