ivailogeimara Posted September 14, 2020 Share Posted September 14, 2020 Why is this mod needed? Spoiler 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 I haven't find a way to do it. When I begun to figure out why they did it (6 months ago. I even opened a bug report which was removed. I was very busy with other stuff so I finished this mod just now.) I 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 my 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 I don'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 I decided to create this mod trying to add back the ability to add custom reload sound per item while sticking as much as I can to the existing systems already in the game and the way they did thinigs. What this mod does? Spoiler First thing it does is removing the reload sounds from the hands animations and placing them on the gun animations where 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 I can't edit them directly (because I don't have access to them) I removed them through code at runtime through the RuntimeAnimationController. Next it allows the reload sounds to be added to the gun animations at specific time through the XML (items.xml) through 2 new properties. Important!: Making your gun mod compatible with this mod (i.e. adding reload sounds to your .unity3d file and adding the custom properties (ReloadAnimationClip, SoundReloadClip#)) does not make your mod incompatible with vanilla. Vanilla 7DaysToDie will just ignore the custom properties and the reload sounds and will use the default ones. It wont even give you warnings. How to use it? To add a custom reload sound to your gun you need 4 things: 1) Your gun has to have unique reload animation name. (Because I can't tell which animations belong to which item in runtime because they get grouped together in the RuntimeAnimationController). Also make sure the animation is long enough so you can add your sounds to it. If your reload animation is 0.5s you won't be able to add sound at 0.9s. It wont fail or warn you in any way. The sound will just not play. 2) 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 my case M1911Reload) 3) 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 I needed to re-add all sounds of the guns that come with the game to work with the new system because I remove every sounds from the animation of the player's hands for every gun holding type. Github: Link to the mod Archive with the mod: Modifiable Reload Sound.7z Link to comment Share on other sites More sharing options...
kebab39 Posted September 15, 2020 Share Posted September 15, 2020 Look and learn devs, this is how it is supposed to be done. Link to comment Share on other sites More sharing options...
bdubyah Posted September 15, 2020 Share Posted September 15, 2020 Yeah, I hope this gets changed at some point. Lol. I would love to make new reloads sounds for my stuff, but I don't wanna have to use DMT to do it. Great work figuring it out, either way. Link to comment Share on other sites More sharing options...
ivailogeimara Posted September 16, 2020 Author Share Posted September 16, 2020 4 hours ago, bdubyah said: Yeah, I hope this gets changed at some point. Lol. I would love to make new reloads sounds for my stuff, but I don't wanna have to use DMT to do it. Great work figuring it out, either way. I also hope they add something similar (or the same) that allows us to add reload sounds without loading DMT mod. DMT mods are kinda pain in the ass to distribute when you play multiplayer although custom weapons are also PIA because unity3d are not downloaded automatically from the server. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.