[Mod Help] A patch for medicine skill to be used in drug production.

Started by Harry_Dicks, January 15, 2018, 03:33:28 PM

Previous topic - Next topic

Harry_Dicks

Would it be possible to make a simple patch so that all of <workSpeedStat>DrugProductionSpeed</workSpeedStat> can always use <workSkill>Medicine</workSkill> instead of Intellectual? Would you have to make a patch for all of the vanilla drugs that use intelligence as well? Is this a dumb idea?

BrokenValkyrie

I believe a better idea is to modify DrugProductionSpeed stat to include medicine skill factor. You only need to patch one def this way.

This is the xpath patch I used to make sculptingSpeed affected by artistic skill

  <Operation Class="PatchOperationAdd">
    <xpath>Defs/StatDef[defName = "SculptingSpeed"]</xpath>
    <value>
<skillNeedFactors>
  <li Class="SkillNeed_BaseBonus">
<skill>Artistic</skill>
<baseValue>0.4</baseValue>
<bonusPerLevel>0.08</bonusPerLevel>
  </li>
</skillNeedFactors>
    </value>
  </Operation>


The patch for your code would look something like this, tweak to your need. Base starts at 40% speed and at lvl 20 its 200% .

  <Operation Class="PatchOperationAdd">
    <xpath>Defs/StatDef[defName = "DrugProductionSpeed"]</xpath>
    <value>
<skillNeedFactors>
  <li Class="SkillNeed_BaseBonus">
<skill>Medicine</skill>
<baseValue>0.4</baseValue>
<bonusPerLevel>0.08</bonusPerLevel>
  </li>
</skillNeedFactors>
    </value>
  </Operation>


Then set up a cook race for test. Use developer tool set skill to help with this.

As for the intellectual requirement, use xpath remove patch on the skillNeedFactor node.

Harry_Dicks

Quote from: BrokenValkyrie on January 17, 2018, 03:36:32 PM
As for the intellectual requirement, use xpath remove patch on the skillNeedFactor node.

Mmm, yeah.. still learning this stuff! :P

Thank you so very much for the help!

aguibu

Hello,

What folder are these Defs in?
I want to modify base speed for Sculpting.


Harry_Dicks

Quote from: aguibu on February 18, 2018, 01:17:15 PM
Hello,

What folder are these Defs in?
I want to modify base speed for Sculpting.

Use Notepad++ feature "Find in Files+ (ctrl+F) and then search for "<workSpeedStat>DrugProductionSpeed</workSpeedStat>" without the quotes. Make it search your entire Mods folder if you want to change it for mods too, or Mods/Core/Defs for just vanilla stuff.

There's a chance that mod defs might inherit from core and won't need to be changed, but you could always check just to be sure.

If you need further help, you can post here or on the RimWorld Discord.