Ludeon Forums

Ludeon Forums

  • October 15, 2019, 03:27:19 PM
  • Welcome, Guest
Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: how to you make animals produce the items you want  (Read 234 times)

Austintrollinski

  • Drifter
  • **
  • Posts: 50
  • Colony of the Iron Empire
    • View Profile
how to you make animals produce the items you want
« on: September 20, 2017, 10:35:23 PM »

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
Logged

mattyboof

  • Muffalo
  • *
  • Posts: 10
  • Refugee
    • View Profile
Re: how to you make animals produce the items you want
« Reply #1 on: September 21, 2017, 04:03:11 AM »

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

Austintrollinski

  • Drifter
  • **
  • Posts: 50
  • Colony of the Iron Empire
    • View Profile
Re: how to you make animals produce the items you want
« Reply #2 on: September 21, 2017, 09:39:25 AM »

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

CannibarRechter

  • Colonist
  • ***
  • Posts: 784
  • Dericious
    • View Profile
Re: how to you make animals produce the items you want
« Reply #3 on: September 21, 2017, 09:59:38 AM »

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

Code: [Select]
      <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:

Code: [Select]
      <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.
« Last Edit: September 21, 2017, 10:04:23 AM by CannibarRechter »
Logged
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

  • Colonist
  • ***
  • Posts: 416
  • Glitterworld Modder
    • View Profile
Re: how to you make animals produce the items you want
« Reply #4 on: September 21, 2017, 10:51:19 AM »

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