Jump to content
Sign in to follow this  
Friendly bandit

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);

With:

  • berries
  • mushrooms
  • insects
  • medicinalPlants

Share this post


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

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