Why Is This Mod Needed?
A while ago (A17?, A16?) TFP removed the ability for us to mod the reload sound of the weapons (including the once added through mods). At least ivailogeimara hasn’t find a way to do it. When he begun to figure out why they did it (6 months ago. He even opened a bug report which was removed. He was very busy with other stuff so he finished this mod just now.) He found that they put the sounds to the hands animations. They did that because of the mods like the Bandolier which increases reload speed.
The problem is (according to his research) that there is no reliable way to speed up a sound in Unity without distorting it and being too CPU intensive. So instead they chopped up the reload sounds to small pieces (mostly some sort of clicks) and made each piece to play at the specific time of the animation. So instead of speeding the sounds they could speed the animation and have normal speed sounds play at key points of the animation. Now this is a great approach but they did not provide a way to mod it (add our sounds) (at least he doesn’t know a way to add our sounds). And on top of everything they put the reload sounds on the hands animations instead of the gun animations so you can only have 1 reload sound per hold type which is stupid. So he decided to create this mod trying to add back the ability to add custom reload sound per item while sticking as much as he can to the existing systems already in the game and the way they did thinigs.
What This Mod Does?
First thing he did was removing the reload sounds from the hands animations and placing them on the gun animations there they should be. Removing the reload sounds from the hands animations normally would be done by just deleting the animation events from the animations but because he can’t edit them directly (because he doesn’t have access to them) he removed them through code at runtime through the RuntimeAnimationController. Next he made it so they can be added to the gun animations at specific time through the XML (items.xml) through 2 new properties.
How to Use It?
To add a custom reload sound to your gun you need 4 things:
- Your gun has to have unique reload animation name. (Because he can’t tell which animations belong to which item in runtime because they get grouped together in the RuntimeAnimationController)
- You need to add the following property to the main section of your item entry:
<property name="ReloadAnimationClip" value="animation_name"/>
Where the animation_name is the name of your gun’s reload animation (it has to be unique, so in his case M1911Reload)
- A few properties with consecutive names of “SoundReloadClip0”, “SoundReloadClip1″… with value containing the name of the sound you want to play (the name is the SoundDataNode name from sounds.xml) and a param1 attribute containing the time of the reload animation at which the sound should of played.
Example:
items.xml
<config>
<append xpath="/items">
<item name="gunHandgunT1M1911"> <!-- T2 pistols -->
<property name="Tags" value="weapon,ranged,holdBreathAiming,reloadPenalty,gun,shortRange,pistol,barrelAttachments,sideAttachments,smallTopAttachments,magazine,firingMode,selfLoading,attAgility,perkGunslinger,9mmGun,canHaveCosmetic"/>
<property name="CustomIcon" value="M1911"/>
<property name="DisplayType" value="rangedGun"/>
...
<property name="ReloadAnimationClip" value="M1911Reload"/>
<property name="SoundReloadClip0" param1="0.1" value="m1911_clipin"/>
<property name="SoundReloadClip1" param1="0.8" value="m1911_cock_back"/>
<property name="SoundReloadClip2" param1="1.09" value="m1911_cock_forward"/>
<property class="Action0">
<property name="Class" value="Ranged"/>
...
</append>
</config>
sounds.xml
<config>
<append xpath="/Sounds">
...
<SoundDataNode name="m1911_clipin"> <AudioSource name="Sounds/AudioSource_Reloads"/>
<Noise ID="6" noise="7" time="2" muffled_when_crouched="0.5"/>
<AudioClip ClipName="#@modfolder:Resources/m1911.unity3d?1911_clipin"/>
<LocalCrouchVolumeScale value="0.5"/> <CrouchNoiseScale value="1"/> <NoiseScale value="1"/> <MaxVoices value="10"/> <MaxRepeatRate value="0.001"/>
</SoundDataNode>
<SoundDataNode name="m1911_clipout"> <AudioSource name="Sounds/AudioSource_Reloads"/>
<Noise ID="6" noise="7" time="2" muffled_when_crouched="0.5"/>
<AudioClip ClipName="#@modfolder:Resources/m1911.unity3d?1911_clipout"/>
<LocalCrouchVolumeScale value="0.5"/> <CrouchNoiseScale value="1"/> <NoiseScale value="1"/> <MaxVoices value="10"/> <MaxRepeatRate value="0.001"/>
</SoundDataNode>
<SoundDataNode name="m1911_cock_back"> <AudioSource name="Sounds/AudioSource_Reloads"/>
<Noise ID="6" noise="7" time="2" muffled_when_crouched="0.5"/>
<AudioClip ClipName="#@modfolder:Resources/m1911.unity3d?1911_cock_back"/>
<LocalCrouchVolumeScale value="0.5"/> <CrouchNoiseScale value="1"/> <NoiseScale value="1"/> <MaxVoices value="10"/> <MaxRepeatRate value="0.001"/>
</SoundDataNode>
<SoundDataNode name="m1911_cock_forward"> <AudioSource name="Sounds/AudioSource_Reloads"/>
<Noise ID="6" noise="7" time="2" muffled_when_crouched="0.5"/>
<AudioClip ClipName="#@modfolder:Resources/m1911.unity3d?1911_cock_forward"/>
<LocalCrouchVolumeScale value="0.5"/> <CrouchNoiseScale value="1"/> <NoiseScale value="1"/> <MaxVoices value="10"/> <MaxRepeatRate value="0.001"/>
</SoundDataNode>
<SoundDataNode name="m1911_draw"> <AudioSource name="Sounds/AudioSource_Reloads"/>
<Noise ID="6" noise="7" time="2" muffled_when_crouched="0.5"/>
<AudioClip ClipName="#@modfolder:Resources/m1911.unity3d?1911_draw"/>
<LocalCrouchVolumeScale value="0.5"/> <CrouchNoiseScale value="1"/> <NoiseScale value="1"/> <MaxVoices value="10"/> <MaxRepeatRate value="0.001"/>
</SoundDataNode>
...
</append>
</config>
They are more examples in the items.xml in the mod’s Config folder because he needed to re-add all sounds of the guns that come with the game to work with the new system because he remove every sounds from the animation of the player’s hands for every gun holding type.
This is a DMT mod. So requires DMT Modding Tool.
The forum topic of the mod is here.
Credits: ivailogeimara
If you have any questions or have any problems/bugs, please use the support link (Discord, Forum Topic, GitHub Issues, etc.) in the post. If there is no support link in the post, please use the comments section.