[SOLVED] Why is my new tool capacity not being recognized?

Started by Jernfalk, April 02, 2018, 03:04:29 PM

Previous topic - Next topic

Jernfalk

I'm working on a new mod and I created a new capacity for my melee weapon. However, it's not getting used in the game when I test it. I tried leaving it as the only tool possible, but then the weapon doesn't show the command to attack when Pawns have it equipped.
Here are the weapons' XML files:
<?xml version="1.0" encoding="utf-8" ?>
<Defs>
<ThingDef ParentName="BaseMeleeWeapon_Blunt">
<defName>Jernfalk_Firestick</defName>
<label>firestick</label>
<description>Blah</description>
<graphicData>
<texPath>Things/Item/Equipment/WeaponMelee/Firestick</texPath>
<graphicClass>Graphic_Single</graphicClass>
</graphicData>
<techLevel>Neolithic</techLevel>
<weaponTags>
<li>NonNeolithicOnlyMelee</li>
<li>NonNeolithicOnlySimpleMelee</li>
<li>NeolithicMeleeBasic</li>
</weaponTags>
<statBases>
<WorkToMake>200</WorkToMake>
<Mass>1</Mass>
<Weapon_Bulk>0.5</Weapon_Bulk>
</statBases>
<equippedAngleOffset>0</equippedAngleOffset>
<costList>
<WoodLog>10</WoodLog>
<Cloth>5</Cloth>
</costList>
<recipeMaker>
<recipeUsers>
<li>ElectricSmithy</li>
<li>FueledSmithy</li>
<li>CraftingSpot</li>
</recipeUsers>
</recipeMaker>
<tools>
<li>
<label>handle</label>
<capacities>
<li>Poke</li>
</capacities>
<power>8</power>
<cooldownTime>2.15</cooldownTime>
</li>
<li>
<label>flame</label>
<capacities>
<li>Jernfalk_Flame</li>
</capacities>
<power>14.2</power>
<cooldownTime>2.15</cooldownTime>
</li>
</tools>
</ThingDef>
</Defs>


and the tool capacity code:

<?xml version="1.0" encoding="utf-8" ?>
<Defs>
  <ToolCapacityDef>
    <defName>Jernfalk_Flame</defName>
    <label>burn</label>
  </ToolCapacityDef>
</Defs>

Jernfalk


Albion

For your new melee attack to be used you also need a maneuverDef and you should also have a rulesDef that describes the way hits are logged in the combat log.
You can find these in the correspondingly named folders of the core mod.

Let me know if you need any further information or if you found the Defs.

Albion

I finally got to my PC and was able to look it up.
You need a ManeuverDef with a <requiredCapacity> linking to the CapacityDef you already created and the <verbClass> Verb_MeleeAttack. You can then also use a custom DamageDef for <meleeDamageDef> or use one of the core ones.
Last but not least as I already mentioned above you need <combatLogRules> where you can either use a vanilla core RulesDef or create a new custom one.

If you have any further questions I'm happy to help you out.

Jernfalk

Quote from: Albion on April 17, 2018, 04:39:04 AM
I finally got to my PC and was able to look it up.
You need a ManeuverDef with a <requiredCapacity> linking to the CapacityDef you already created and the <verbClass> Verb_MeleeAttack. You can then also use a custom DamageDef for <meleeDamageDef> or use one of the core ones.
Last but not least as I already mentioned above you need <combatLogRules> where you can either use a vanilla core RulesDef or create a new custom one.

If you have any further questions I'm happy to help you out.

This was incredibly helpful! It works without any errors now! Thanks!

Albion

Glad I was able to help you.
I ran into the same problem last December so I remembered how to fix it.