how to you make animals produce the items you want

Started by Austintrollinski, September 20, 2017, 10:35:23 PM

Previous topic - Next topic

Austintrollinski

i need help to make animals produce an item i want them to dose someone know to do that and can to tell me how

mattyboof

What sort of item? food, horn etc

You could make it Milkable (see the cow or muffalo for a template)

Then make a custom "milk" which is the item you want?

Or add a bodypart to it which you get on butchering (see thrumbo for a template) You will need to make the ThingDef also unless it is a vanilla item you are wanting.

Austintrollinski

i want the animal to produce gold and am still new to modding

CannibarRechter

#3
Open up Races_Animal_Arid. Look at the ThingDef for Muffalo. Under the comps section, you'll see:


      <li Class="CompProperties_Shearable">
        <woolDef>WoolMuffalo</woolDef>
        <shearIntervalDays>25</shearIntervalDays>
        <woolAmount>100</woolAmount>
      </li>


Copy this to your animal. And then change it as follows:


      <li Class="CompProperties_Shearable">
        <woolDef>Gold</woolDef>
        <shearIntervalDays>25</shearIntervalDays>
        <woolAmount>100</woolAmount>
      </li>


The trick is understanding that this comp doesn't actually require a "WoolDef". It can produce just about any Thing. This is exactly how I made my Thrumbo mod allow periodic harvesting of horns (I assume this still works; haven't tested lately).

p.s., the "zen" of modding is to looking for examples, and just try it. That's how I learned this was possible in the first place. Modding is a great deal of trial and error.
CR All Mods and Tools Download Link
CR Total Texture Overhaul : Gives RimWorld a Natural Feel
CR Moddable: make RimWorld more moddable.
CR CompFX: display dynamic effects over RimWorld objects

Albion

If you want to make something more complex than just using the sheering component (which then also means that the thrumbo horn is sheered off) look at the Chemicals extraction & Neutroamine crafting mod by ShadowTani. He even has the source code published so you can inspect it directly.

Alternativly you can check out the wool production component in the c# assemly of the core game and reverse engineer it to create your own production code.

All in all you'll need to do the following things:

  • write c# code to create your own production component
  • patch the def of the animal you want to use the production on or create your own animal
  • add a workgiver def to have your pawn actually milk/sheer/whatever you want from your animals

... or just use the solution given by CannibarRechter