Custom Melee Audio

Started by BasedGreg, June 07, 2019, 05:58:43 AM

Previous topic - Next topic

BasedGreg

Hello Ludeon,
I'm current working on my most recent additon to my personal mod collection. A charge sword that in all honesty is basically just a lightsaber. I'm aware there is a lightsaber mod but I have run into framerate problems with that mod so I'm just trying to make one of my own that is also a bit more lore-friendly.


The weapon itself works just fine, but the problem I'm having is with adding custom audio to the weapon.

Here's my current code:

SoundDef:

<?xml version="1.0" encoding="utf-8"?>

<Defs>

  <SoundDef>
    <defName>Pawn_Melee_Saber_Cut</defName> 
    <context>MapOnly</context>
    <eventNames /> 
    <maxVoices>2</maxVoices> 
    <subSounds>
      <li>
        <grains>
          <li Class="AudioGrain_Folder">
            <clipFolderPath>Melee/sabercut</clipFolderPath>
          </li>
        </grains>     
        <volumeRange>
          <min>20</min>       
          <max>20</max>
        </volumeRange>     
        <pitchRange>
          <min>1</min>       
          <max>1.18353</max>
        </pitchRange>
      </li>
    </subSounds>
  </SoundDef>
 
    <SoundDef>
    <defName>Pawn_Melee_Saber_Stab</defName> 
    <context>MapOnly</context>
    <eventNames /> 
    <maxVoices>2</maxVoices> 
    <subSounds>
      <li>
        <grains>
          <li Class="AudioGrain_Folder">
            <clipFolderPath>Melee/saberstab</clipFolderPath>
          </li>
        </grains>     
        <volumeRange>
          <min>20</min>       
          <max>20</max>
        </volumeRange>     
        <pitchRange>
          <min>1</min>       
          <max>1.18353</max>
        </pitchRange>
      </li>
    </subSounds>
  </SoundDef>
 
  </Defs>


BaseDef:

<DamageDef>
    <defName>SaberStab</defName>
    <label>saberstab</label>
    <workerClass>DamageWorker_Stab</workerClass>
    <externalViolence>true</externalViolence>
    <deathMessage>{0} has been sabered to death.</deathMessage>
    <hediff>Burn</hediff>
<hediffSkin>Burn</hediffSkin>
    <hediffSolid>Burn</hediffSolid>
    <impactSoundType>Slice</impactSoundType>
    <armorCategory>Heat</armorCategory>
    <stabChanceOfForcedInternal>0.9</stabChanceOfForcedInternal>
    <overkillPctToDestroyPart>0.4~1.0</overkillPctToDestroyPart>
  </DamageDef>
 
    <DamageDef Name="CutBase">
    <defName>SaberCut</defName>
    <label>sabercut</label>
    <workerClass>DamageWorker_Cut</workerClass>
    <externalViolence>true</externalViolence>
    <deathMessage>{0} has been sabered to death.</deathMessage>
    <hediff>Burn</hediff>
    <hediffSkin>Burn</hediffSkin>
    <hediffSolid>Burn</hediffSolid>
    <harmAllLayersUntilOutside>true</harmAllLayersUntilOutside>
    <impactSoundType>Slice</impactSoundType>
    <armorCategory>Heat</armorCategory>
<stabChanceOfForcedInternal>0.8</stabChanceOfForcedInternal>
    <overkillPctToDestroyPart>0.4~1.0</overkillPctToDestroyPart>
    <cutExtraTargetsCurve>
      <points>
        <li>0, 0</li>
        <li>0.6, 1</li>
        <li>0.9, 2</li>
        <li>1, 3</li>
      </points>
    </cutExtraTargetsCurve>
    <cutCleaveBonus>1.4</cutCleaveBonus>
  </DamageDef>

  <ManeuverDef>
    <defName>SaberSlash</defName>
    <requiredCapacity>SaberCut</requiredCapacity>
    <verb>
      <verbClass>Verb_MeleeAttackDamage</verbClass>
      <meleeDamageDef>SaberCut</meleeDamageDef>
  <soundCast>Pawn_Melee_Saber_Cut</soundCast>
    </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>

  <ManeuverDef>
    <defName>SaberStab</defName>
    <requiredCapacity>SaberStab</requiredCapacity>
    <verb>
      <verbClass>Verb_MeleeAttackDamage</verbClass>
      <meleeDamageDef>SaberStab</meleeDamageDef>
  <soundCast>Pawn_Melee_Saber_Stab</soundCast>
    </verb>
    <logEntryDef>MeleeAttack</logEntryDef>
    <combatLogRulesHit>Maneuver_Stab_MeleeHit</combatLogRulesHit>
    <combatLogRulesDeflect>Maneuver_Stab_MeleeDeflect</combatLogRulesDeflect>
    <combatLogRulesMiss>Maneuver_Stab_MeleeMiss</combatLogRulesMiss>
    <combatLogRulesDodge>Maneuver_Stab_MeleeDodge</combatLogRulesDodge>
  </ManeuverDef>
 
    <ToolCapacityDef>
    <defName>SaberStab</defName>
  </ToolCapacityDef>
 
   <ToolCapacityDef>
    <defName>SaberCut</defName>
  </ToolCapacityDef>


and WeaponDef:

<ThingDef ParentName="Greggo_BaseMeleeWeapon">
<defName>ChargeSword</defName>
<label>charge blade</label>
<description>Melee weapons were thought to be a thing of the past, but with pulse technology also came the invention of the energy sword. The weapon itself is extremely powerful, able to slice thorugh even the strongest armor and the built in gyrostablizer makes this blade feel almost weightless as one swings.</description>
<graphicData>
<texPath>Things/Melee/ChargeBlade</texPath>
<graphicClass>Graphic_Single</graphicClass>
</graphicData>
<techLevel>Spacer</techLevel>
<costList>
<Plasteel>80</Plasteel>
<ComponentSpacer>5</ComponentSpacer>
</costList>
<statBases>
<WorkToMake>45000</WorkToMake>
<Mass>3.5</Mass>
</statBases>
<equippedAngleOffset>-65</equippedAngleOffset>
<tools>
<li>
<label>handle</label>
<capacities>
<li>Blunt</li>
</capacities>
<power>8</power>
<cooldownTime>1</cooldownTime>
</li>
<li>
<label>point</label>
<capacities>
<li>SaberStab</li>
</capacities>
<power>22</power>
<cooldownTime>0.8</cooldownTime>
<armorPenetration>0.7</armorPenetration>
</li>
<li>
<label>edge</label>
<capacities>
<li>SaberCut</li>
</capacities>
<power>26</power>
<cooldownTime>0.9</cooldownTime>
<armorPenetration>0.7</armorPenetration>
</li>
</tools>
<recipeMaker>
<skillRequirements>
<Crafting>8</Crafting>
</skillRequirements>
<recipeUsers Inherit="False">
<li>FabricationBench</li>
</recipeUsers>
</recipeMaker>
</ThingDef>


I have already tried having the audio file location say Sounds/Melee/(etc), and that didn't make a difference so I'm assuming that's not where my problem is. Yeah, I'm just stuck so any advice would be greatly appreciated!


Mehni

if you ahve a single file, use clipPath and appropriate li Class =

Search forums, you're not the first to run into the issue.