Cant get this custom maneuver to work [Solved]

Started by jacketgun, January 09, 2020, 09:09:40 PM

Previous topic - Next topic

jacketgun

Im trying to add a custom damage type to a melee weapon, but i cant get it to work!
I have made sure that if i use the debug tool i can do the acid damage so the game knows about the damage type.

I just cant get my test weapon to actually inflict this damage....

This is the XML for the weapon, it's basically just a regular club but with the capability to inflict acid damage.
(I just wanted to get this to work before moving on.)

<ThingDef ParentName="BaseMeleeWeapon_Blunt">
    <defName>Acid_Club</defName>
    <label>acidic club</label>
    <description>Acidic test weapon, melts on hit.</description>
    <graphicData>
      <texPath>Things/Item/Equipment/WeaponMelee/Club</texPath>
      <graphicClass>Graphic_Single</graphicClass>
    </graphicData>
    <techLevel>Neolithic</techLevel>
    <weaponTags>
      <li>NeolithicMeleeBasic</li>
    </weaponTags>
    <costStuffCount>40</costStuffCount>
    <statBases>
      <WorkToMake>1</WorkToMake>
      <Mass>2</Mass>
    </statBases>
    <equippedAngleOffset>-65</equippedAngleOffset>
    <stuffCategories>
      <li>Metallic</li>
      <li>Woody</li>
      <li>Stony</li>
    </stuffCategories>
    <recipeMaker>
      <recipeUsers>
        <li>CraftingSpot</li>
      </recipeUsers>
    </recipeMaker>
    <tools>
      <li>
        <label>handle</label>
      <labelUsedInLogging>false</labelUsedInLogging>
        <capacities>
            <li>Melt</li>
        </capacities>
        <power>10</power>
        <cooldownTime>0.1</cooldownTime>
      </li>
      <li>
        <label>head</label>
        <labelUsedInLogging>false</labelUsedInLogging>
        <capacities>
            <li>Melt</li>
        </capacities>
        <power>10</power>
        <cooldownTime>0.1</cooldownTime>
      </li>
    </tools>
  </ThingDef>


Here is the capacity def

  <ToolCapacityDef>
    <defName>Melt</defName>
    <label>melt</label>
  </ToolCapacityDef>


Here is the damage xml

<DamageDef>
    <defName>Melt</defName>
    <label>acid</label>
    <workerClass>DamageWorker_Blunt</workerClass>   
    <externalViolence>true</externalViolence>
    <armorCategory>Heat</armorCategory>   
    <makesBlood>false</makesBlood>   
    <deathMessage>{0} has been burnt by acid.</deathMessage>
    <hediff>Acid</hediff>
    <hediffSkin>Acid</hediffSkin>
    <hediffSolid>Acid</hediffSolid>
    <impactSoundType>Blunt</impactSoundType>
  </DamageDef>


And here is the hediff xml

<HediffDef>
     <defName>Acid</defName>
     <label>acid</label>
     <hediffClass>Hediff_Injury</hediffClass>
     <tendable>true</tendable>
     <displayWound>true</displayWound>     
      <comps>
        <li Class="HediffCompProperties_TendDuration">
          <labelTendedWell>bandaged</labelTendedWell>
          <labelTendedWellInner>treated</labelTendedWellInner>
          <labelSolidTendedWell>medicated</labelSolidTendedWell>
        </li>
        <li Class="HediffCompProperties_Infecter">
          <infectionChance>0.05</infectionChance>
        </li>
        <li Class="HediffCompProperties_GetsPermanent">
          <permanentLabel>acid scar</permanentLabel>
        </li>
      </comps>
     <injuryProps>
        <painPerSeverity>0.01875</painPerSeverity>
        <averagePainPerSeverityPermanent>0.00625</averagePainPerSeverityPermanent>
        <canMerge>true</canMerge>
        <bleedRate>0.01</bleedRate>
       <destroyedLabel>Dissolved</destroyedLabel>
       <destroyedOutLabel>Dissolved</destroyedOutLabel>
     </injuryProps>
   </HediffDef>


Here is the maneuver xml

<ManeuverDef>
    <defName>Melt</defName>
    <requiredCapacity>Melt</requiredCapacity>
    <verb>
      <verbClass>Verb_MeleeAttackDamage</verbClass>
      <meleeDamageDef>Melt</meleeDamageDef>
    </verb>
    <logEntryDef>MeleeAttack</logEntryDef>
    <combatLogRulesHit>Maneuver_Slash_MeleeHit</combatLogRulesHit>
    <combatLogRulesDeflect>Maneuver_Slash_MeleeDeflect</combatLogRulesDeflect>
    <combatLogRulesMiss>Maneuver_Slash_MeleeMiss</combatLogRulesMiss>
    <combatLogRulesDodge>Maneuver_Slash_MeleeDodge</combatLogRulesDodge>
</ManeuverDef>


I get this when a pawn tries to use the club:

Exception in JobDriver tick for pawn Santiago driver=JobDriver_AttackMelee (toilIndex=2) driver.job=(AttackMelee (Job_234) A=Thing_Human347) lastJobGiver=Verse.AI.ThinkNode_QueuedJob
System.NullReferenceException: Object reference not set to an instance of an object


And it works fine if i set meleeDamageDef to something in vanilla, so obviously that's the error.

but... how to actually add the meleeDamageDef Melt to the game?
do i need to use c# here?

Any replies would be appreciated!

jacketgun

After some more google fu i found the problem.

by adding the damage category of burn to the weapon the game freaked out because there is no meleeDamageDef attributes on burn damage... or something.

but by changing the armorCategory from Burn to Sharp it works fine.