{"name":"Arma 3: Sound: ExampleWeaponConfig","title":"Arma 3: Sound: ExampleWeaponConfig","type":"topic","url":"https://community.bistudio.com/wiki/Arma_3:_Sound:_ExampleWeaponConfig","revid":347070,"updated":"2023-08-29T19:15:36Z","aliases":["Arma 3 Sound: ExampleConfig","Arma 3 Sound: ExampleWeaponConfig","Arma 3: Sound: ExampleConfig"],"markdown":"### Example Weapon Config\n\n#### CfgPatches\n\nCfgPatches is the class that that gives your addon it is identity. More info in the CfgPatches page.\n\n```cpp\nclass CfgPatches\n{\n    class TAG_ThisIsMyAddon\n    {\n        units[] = {};\n        weapons[] = {};\n        requiredAddons[] = { \"A3_Weapons_F\", \"A3_Sounds_F\", \"A3_Sounds_F_Mark\", \"A3_CargoPoses_F\" };\n        /*\n            requiredAddons is important. It kind of answers the question \"What addons do I load before loading this one?\"\n            If your addon will overwrite certain data from the original arma3 config (that is mostly the case\n            with sound/asset REPLACEMENTS) you need to put the cfgPatches class here that contains the information that you are about to\n            overwrite. For example most arma3 sounds are defined in a config that's cfgPatches class is \"A3_Sounds_F\". So if you want to\n            overwrite data from there you need to put it into the requiredAddons array. If you want to change vehicle sounds, look in which\n            cfgPatches they are configured and add that to requiredAddons.\n        */\n        requiredVersion = 0.1;\n        version = \"0.01\"; //optional: internal version number\n        author = \"Megagoth1702\"; //optional: your alias\n        authorUrl = \"URL\"; //optional: URL to your website/online presence\n    };\n};\n```\n\n#### CfgSoundShaders\n\nMore detailed infos on CfgSoundShaders can be found on the Arma 3: Sound: cfgSoundShaders page.\n\n```cpp\nclass CfgSoundShaders\n{\n    //###################################### SHOTS ######################################\n    class TAG_Your_Rifle_Closure_SoundShader\n    {\n        samples[] = {{ \"path\\to\\sound.wav\", 1 }}; // you can use wav/wss/ogg, ogg will have a small delay before playback (not too good for weapons/explosions)\n        volume = 0.4466836;\n        range = 5;\n    };\n    class TAG_Your_Rifle_closeShot_SoundShader\n    {\n        samples[] = {{ \"path\\to\\sound.wav\", 1 }};\n        volume = 1.0;\n        range = 50;\n        rangeCurve = \"closeShotCurve\";\n    };\n    class TAG_Your_Rifle_midShot_SoundShader\n    {\n        samples[] = {{ \"path\\to\\sound.wav\", 1 }};\n        volume = 0.7943282;\n        range = 1800;\n        rangeCurve[] = { {0,0.2}, {50,1}, {300,0}, {1800,0} };\n    };\n    class TAG_Your_Rifle_distShot_SoundShader\n    {\n        samples[] = {{ \"path\\to\\sound.wav\", 1 }};\n        volume = 1.0;\n        range = 1800;\n        rangeCurve[] = { {0,0}, {50,0}, {300,1}, {1800,1} };\n    };\n    // ###################################### TAILS ######################################\n    class TAG_Your_Rifle_tailInterior_SoundShader\n    {\n        samples[] = {{ \"path\\to\\sound.wav\", 1 }};\n        volume = \"interior\";\n        range = 500;\n        limitation = 0;\n    };\n    class TAG_Your_Rifle_tailTrees_SoundShader\n    {\n        samples[] = {{ \"path\\to\\sound.wav\", 1 }};\n        volume = \"(1-interior/1.4)*trees/3\";\n        range = 1800;\n        limitation = 1;\n    };\n    class TAG_Your_Rifle_tailForest_SoundShader\n    {\n        samples[] = {{ \"path\\to\\sound.wav\", 1 }};\n        volume = \"(1-interior/1.4)*forest/3\";\n        range = 1800;\n        limitation = 1;\n    };\n    class TAG_Your_Rifle_tailMeadows_SoundShader\n    {\n        samples[] = {{ \"path\\to\\sound.wav\", 1 }};\n        volume = \"(1-interior/1.4)*(meadows/2 max sea/2)/3\";\n        range = 1800;\n        limitation = 1;\n    };\n    class TAG_Your_Rifle_tailHouses_SoundShader\n    {\n        samples[] = {{ \"path\\to\\sound.wav\", 1 }};\n        volume = \"(1-interior/1.4)*houses/3\";\n        range = 1200;\n        limitation = 1;\n    };\n    class TAG_Your_Rifle_silencerShot_SoundShader\n    {\n        samples[] = {{ \"path\\to\\sound.wav\", 1 }};\n        volume = 1.0;\n        range = 150;\n        rangeCurve = \"closeShotCurve\";\n    };\n    class TAG_Your_Rifle_silencerTailForest_SoundShader\n    {\n        samples[] = {{ \"path\\to\\sound.wav\", 1 }};\n        volume = \"(1-interior/1.4)*forest/3\";\n        range = 150;\n        rangeCurve[] = { {0,1}, {150,0.3} };\n        limitation = 1;\n    };\n    class TAG_Your_Rifle_silencerTailHouses_SoundShader\n    {\n        samples[] = {{ \"path\\to\\sound.wav\", 1 }};\n        volume = \"(1-interior/1.4)*houses/3\";\n        range = 150;\n        rangeCurve[] = { {0,1}, {150,0} };\n        limitation = 1;\n    };\n    class TAG_Your_Rifle_silencerTailInterior_SoundShader\n    {\n        samples[] = {{ \"path\\to\\sound.wav\", 1 }};\n        volume = \"interior\";\n        range = 150;\n        rangeCurve[] = { {0,1}, {50,0.3}, {150,0} };\n        limitation = 1;\n    };\n    class TAG_Your_Rifle_silencerTailMeadows_SoundShader\n    {\n        samples[] = {{ \"path\\to\\sound.wav\", 1 }};\n        volume = \"(1-interior/1.4)*(meadows/2 max sea/2)/3\";\n        range = 150;\n        rangeCurve[] = { {0,1}, {150,0.3} };\n        limitation = 1;\n    };\n    class TAG_Your_Rifle_silencerTailTrees_SoundShader\n    {\n        samples[] = {{ \"path\\to\\sound.wav\", 1 }};\n        volume = \"(1-interior/1.4)*trees/3\";\n        range = 150;\n        rangeCurve[] = { {0,1}, {150,0.3} };\n        limitation = 1;\n    };\n};\n```\n\n#### CfgSoundSets\n\nmore info about soundSetscan be found on the Arma 3: Sound: cfgSoundSets page.\n\n```cpp\nclass CfgSoundSets\n{\n    class TAG_Your_Rifle_Shot_SoundSet\n    {\n        soundShaders[] = { \"TAG_Your_Rifle_Closure_SoundShader\", \"TAG_Your_Rifle_closeShot_SoundShader\", \"TAG_Your_Rifle_midShot_SoundShader\", \"TAG_Your_Rifle_distShot_SoundShader\", \"TAG_Your_Rifle_tailInterior_SoundShader\" };\n        volumeFactor = 1.6;\n        volumeCurve = \"InverseSquare2Curve\";\n        sound3DProcessingType = \"WeaponMediumShot3DProcessingType\";\n        distanceFilter = \"weaponShotDistanceFreqAttenuationFilter\";\n        spatial = 1;\n        doppler = 0;\n        loop = 0;\n    };\n    class TAG_Your_Rifle_Tail_SoundSet\n    {\n        soundShaders[] = { \"TAG_Your_Rifle_tailTrees_SoundShader\", \"TAG_Your_Rifle_tailForest_SoundShader\", \"TAG_Your_Rifle_tailMeadows_SoundShader\", \"TAG_Your_Rifle_tailHouses_SoundShader\" };\n        volumeFactor = 1;\n        volumeCurve = \"InverseSquare2Curve\";\n        frequencyRandomizer = 1;\n        sound3DProcessingType = \"WeaponMediumShotTail3DProcessingType\";\n        distanceFilter = \"weaponShotTailDistanceFreqAttenuationFilter\";\n        spatial = 1;\n        doppler = 0;\n        loop = 0;\n        soundShadersLimit = 2;\n    };\n};\n```\n\n#### CfgWeapons\n\n```cpp\n// ###################################### GENERAL MODES FOR INHERITANCE ######################################\n// sooner or later in weapon modding you are going to need to inherit from these classes so why not just put them here for future reference?\n\nclass Mode_SemiAuto;\nclass Mode_Burst;\nclass Mode_FullAuto;\n\nclass BaseSoundModeType;\n\nclass CfgWeapons\n{\n    class Rifle_Base_F;\n    class arifle_MX_Base_F : Rifle_Base_F\n    {\n        class Single : Mode_SemiAuto\n        {\n            sounds[] = { \"StandardSound\", \"SilencedSound\" };\n            class StandardSound : BaseSoundModeType\n            {\n                soundSetShot[] = { \"TAG_Your_Rifle_Shot_SoundSet\", \"TAG_Your_Rifle_Tail_SoundSet\" };\n            };\n            class SilencedSound : BaseSoundModeType\n            {\n                // this is wrong, obviously you would create your own silenced versions of soundShaders & sets and assign the SETS here\n                // the soundSets was put here as an example\n                soundSetShot[] = { \"TAG_Your_Rifle_Shot_SoundSet\", \"TAG_Your_Rifle_Tail_SoundSet\" };\n            };\n        };\n        class FullAuto : Mode_FullAuto\n        {\n            sounds[] = { \"StandardSound\", \"SilencedSound\" };\n            class StandardSound : BaseSoundModeType\n            {\n                soundSetShot[] = { \"TAG_Your_Rifle_Shot_SoundSet\", \"TAG_Your_Rifle_Tail_SoundSet\" };\n            };\n            class SilencedSound : BaseSoundModeType\n            {\n                // this is wrong, obviously you would create your own silenced versions of soundShaders & sets and assign the SETS here\n                // the soundSets was put here as an example\n                soundSetShot[] = { \"TAG_Your_Rifle_Shot_SoundSet\", \"TAG_Your_Rifle_Tail_SoundSet\" };\n            };\n        };\n    };\n};\n```","sections":[{"heading":"Example Weapon Config","level":3,"markdown":""},{"heading":"CfgPatches","level":4,"markdown":"CfgPatches is the class that that gives your addon it is identity. More info in the CfgPatches page.\n\n```cpp\nclass CfgPatches\n{\n    class TAG_ThisIsMyAddon\n    {\n        units[] = {};\n        weapons[] = {};\n        requiredAddons[] = { \"A3_Weapons_F\", \"A3_Sounds_F\", \"A3_Sounds_F_Mark\", \"A3_CargoPoses_F\" };\n        /*\n            requiredAddons is important. It kind of answers the question \"What addons do I load before loading this one?\"\n            If your addon will overwrite certain data from the original arma3 config (that is mostly the case\n            with sound/asset REPLACEMENTS) you need to put the cfgPatches class here that contains the information that you are about to\n            overwrite. For example most arma3 sounds are defined in a config that's cfgPatches class is \"A3_Sounds_F\". So if you want to\n            overwrite data from there you need to put it into the requiredAddons array. If you want to change vehicle sounds, look in which\n            cfgPatches they are configured and add that to requiredAddons.\n        */\n        requiredVersion = 0.1;\n        version = \"0.01\"; //optional: internal version number\n        author = \"Megagoth1702\"; //optional: your alias\n        authorUrl = \"URL\"; //optional: URL to your website/online presence\n    };\n};\n```"},{"heading":"CfgSoundShaders","level":4,"markdown":"More detailed infos on CfgSoundShaders can be found on the Arma 3: Sound: cfgSoundShaders page.\n\n```cpp\nclass CfgSoundShaders\n{\n    //###################################### SHOTS ######################################\n    class TAG_Your_Rifle_Closure_SoundShader\n    {\n        samples[] = {{ \"path\\to\\sound.wav\", 1 }}; // you can use wav/wss/ogg, ogg will have a small delay before playback (not too good for weapons/explosions)\n        volume = 0.4466836;\n        range = 5;\n    };\n    class TAG_Your_Rifle_closeShot_SoundShader\n    {\n        samples[] = {{ \"path\\to\\sound.wav\", 1 }};\n        volume = 1.0;\n        range = 50;\n        rangeCurve = \"closeShotCurve\";\n    };\n    class TAG_Your_Rifle_midShot_SoundShader\n    {\n        samples[] = {{ \"path\\to\\sound.wav\", 1 }};\n        volume = 0.7943282;\n        range = 1800;\n        rangeCurve[] = { {0,0.2}, {50,1}, {300,0}, {1800,0} };\n    };\n    class TAG_Your_Rifle_distShot_SoundShader\n    {\n        samples[] = {{ \"path\\to\\sound.wav\", 1 }};\n        volume = 1.0;\n        range = 1800;\n        rangeCurve[] = { {0,0}, {50,0}, {300,1}, {1800,1} };\n    };\n    // ###################################### TAILS ######################################\n    class TAG_Your_Rifle_tailInterior_SoundShader\n    {\n        samples[] = {{ \"path\\to\\sound.wav\", 1 }};\n        volume = \"interior\";\n        range = 500;\n        limitation = 0;\n    };\n    class TAG_Your_Rifle_tailTrees_SoundShader\n    {\n        samples[] = {{ \"path\\to\\sound.wav\", 1 }};\n        volume = \"(1-interior/1.4)*trees/3\";\n        range = 1800;\n        limitation = 1;\n    };\n    class TAG_Your_Rifle_tailForest_SoundShader\n    {\n        samples[] = {{ \"path\\to\\sound.wav\", 1 }};\n        volume = \"(1-interior/1.4)*forest/3\";\n        range = 1800;\n        limitation = 1;\n    };\n    class TAG_Your_Rifle_tailMeadows_SoundShader\n    {\n        samples[] = {{ \"path\\to\\sound.wav\", 1 }};\n        volume = \"(1-interior/1.4)*(meadows/2 max sea/2)/3\";\n        range = 1800;\n        limitation = 1;\n    };\n    class TAG_Your_Rifle_tailHouses_SoundShader\n    {\n        samples[] = {{ \"path\\to\\sound.wav\", 1 }};\n        volume = \"(1-interior/1.4)*houses/3\";\n        range = 1200;\n        limitation = 1;\n    };\n    class TAG_Your_Rifle_silencerShot_SoundShader\n    {\n        samples[] = {{ \"path\\to\\sound.wav\", 1 }};\n        volume = 1.0;\n        range = 150;\n        rangeCurve = \"closeShotCurve\";\n    };\n    class TAG_Your_Rifle_silencerTailForest_SoundShader\n    {\n        samples[] = {{ \"path\\to\\sound.wav\", 1 }};\n        volume = \"(1-interior/1.4)*forest/3\";\n        range = 150;\n        rangeCurve[] = { {0,1}, {150,0.3} };\n        limitation = 1;\n    };\n    class TAG_Your_Rifle_silencerTailHouses_SoundShader\n    {\n        samples[] = {{ \"path\\to\\sound.wav\", 1 }};\n        volume = \"(1-interior/1.4)*houses/3\";\n        range = 150;\n        rangeCurve[] = { {0,1}, {150,0} };\n        limitation = 1;\n    };\n    class TAG_Your_Rifle_silencerTailInterior_SoundShader\n    {\n        samples[] = {{ \"path\\to\\sound.wav\", 1 }};\n        volume = \"interior\";\n        range = 150;\n        rangeCurve[] = { {0,1}, {50,0.3}, {150,0} };\n        limitation = 1;\n    };\n    class TAG_Your_Rifle_silencerTailMeadows_SoundShader\n    {\n        samples[] = {{ \"path\\to\\sound.wav\", 1 }};\n        volume = \"(1-interior/1.4)*(meadows/2 max sea/2)/3\";\n        range = 150;\n        rangeCurve[] = { {0,1}, {150,0.3} };\n        limitation = 1;\n    };\n    class TAG_Your_Rifle_silencerTailTrees_SoundShader\n    {\n        samples[] = {{ \"path\\to\\sound.wav\", 1 }};\n        volume = \"(1-interior/1.4)*trees/3\";\n        range = 150;\n        rangeCurve[] = { {0,1}, {150,0.3} };\n        limitation = 1;\n    };\n};\n```"},{"heading":"CfgSoundSets","level":4,"markdown":"more info about soundSetscan be found on the Arma 3: Sound: cfgSoundSets page.\n\n```cpp\nclass CfgSoundSets\n{\n    class TAG_Your_Rifle_Shot_SoundSet\n    {\n        soundShaders[] = { \"TAG_Your_Rifle_Closure_SoundShader\", \"TAG_Your_Rifle_closeShot_SoundShader\", \"TAG_Your_Rifle_midShot_SoundShader\", \"TAG_Your_Rifle_distShot_SoundShader\", \"TAG_Your_Rifle_tailInterior_SoundShader\" };\n        volumeFactor = 1.6;\n        volumeCurve = \"InverseSquare2Curve\";\n        sound3DProcessingType = \"WeaponMediumShot3DProcessingType\";\n        distanceFilter = \"weaponShotDistanceFreqAttenuationFilter\";\n        spatial = 1;\n        doppler = 0;\n        loop = 0;\n    };\n    class TAG_Your_Rifle_Tail_SoundSet\n    {\n        soundShaders[] = { \"TAG_Your_Rifle_tailTrees_SoundShader\", \"TAG_Your_Rifle_tailForest_SoundShader\", \"TAG_Your_Rifle_tailMeadows_SoundShader\", \"TAG_Your_Rifle_tailHouses_SoundShader\" };\n        volumeFactor = 1;\n        volumeCurve = \"InverseSquare2Curve\";\n        frequencyRandomizer = 1;\n        sound3DProcessingType = \"WeaponMediumShotTail3DProcessingType\";\n        distanceFilter = \"weaponShotTailDistanceFreqAttenuationFilter\";\n        spatial = 1;\n        doppler = 0;\n        loop = 0;\n        soundShadersLimit = 2;\n    };\n};\n```"},{"heading":"CfgWeapons","level":4,"markdown":"```cpp\n// ###################################### GENERAL MODES FOR INHERITANCE ######################################\n// sooner or later in weapon modding you are going to need to inherit from these classes so why not just put them here for future reference?\n\nclass Mode_SemiAuto;\nclass Mode_Burst;\nclass Mode_FullAuto;\n\nclass BaseSoundModeType;\n\nclass CfgWeapons\n{\n    class Rifle_Base_F;\n    class arifle_MX_Base_F : Rifle_Base_F\n    {\n        class Single : Mode_SemiAuto\n        {\n            sounds[] = { \"StandardSound\", \"SilencedSound\" };\n            class StandardSound : BaseSoundModeType\n            {\n                soundSetShot[] = { \"TAG_Your_Rifle_Shot_SoundSet\", \"TAG_Your_Rifle_Tail_SoundSet\" };\n            };\n            class SilencedSound : BaseSoundModeType\n            {\n                // this is wrong, obviously you would create your own silenced versions of soundShaders & sets and assign the SETS here\n                // the soundSets was put here as an example\n                soundSetShot[] = { \"TAG_Your_Rifle_Shot_SoundSet\", \"TAG_Your_Rifle_Tail_SoundSet\" };\n            };\n        };\n        class FullAuto : Mode_FullAuto\n        {\n            sounds[] = { \"StandardSound\", \"SilencedSound\" };\n            class StandardSound : BaseSoundModeType\n            {\n                soundSetShot[] = { \"TAG_Your_Rifle_Shot_SoundSet\", \"TAG_Your_Rifle_Tail_SoundSet\" };\n            };\n            class SilencedSound : BaseSoundModeType\n            {\n                // this is wrong, obviously you would create your own silenced versions of soundShaders & sets and assign the SETS here\n                // the soundSets was put here as an example\n                soundSetShot[] = { \"TAG_Your_Rifle_Shot_SoundSet\", \"TAG_Your_Rifle_Tail_SoundSet\" };\n            };\n        };\n    };\n};\n```"}],"categories":["Arma 3: Sound"],"groups":["Configuration"]}