Jump to content
daa9997

Custom Weapon config.cpp - Cannot configure 'firing' sounds correctly

Recommended Posts

Good morning/evening! This is my first post on the forums after years of reading and searching, so please bear with me! I have been attempting to put a weapon into the game, and I have had great success so far, currently it is working in game, the model, textures, configs (mostly) and all properties like firing speed, and the ammo and magazines work. However. I cannot, after 50+ times of trial and error, get the weapon firing sound effect to work. The empty sound effect, and reloading sound effect work but not my custom firing sound. Blow is a copy of my script in its current state. This is a Star Wars weapon, and I am 100% sure i have all my file names correct. I am convinced maybe I have the path to the sound effect "wpn_rep_blaster_fire.wss" located in the "DC15SMOD\sound\" folder incorrectly formatted, as the weapon reload and empty sounds are just dependencies from another star wars mod. Most of this is practice based off of the Weapon Sample config in ARMA Samples. Any help would be greatly appreciated. I know there is also a parameter for suppressed/non-suppressed weapon sounds, but this weapon will not be suppressed at all, and I could not find any information on how to set the sound configs up correctly either. Any help would be greatly appreciated!

 

Spoiler

#include "basicdefines_A3.hpp"
class CfgPatches
{
    class Test_weapon_F
    {
        units[]={};
        weapons[]={"Test_weapon_01_F"};
        requiredVersion=0.1;
        requiredAddons[]={"A3_Weapons_F"};
    };
};
/// All firemodes, to be sure
class Mode_SemiAuto;
class Mode_FullAuto;

/// Weapon slots
class SlotInfo;

class CfgWeapons
{
    class Rifle;
    class Rifle_Base_F: Rifle
    {
        class WeaponSlotsInfo;
        class GunParticles;
    };

    class Test_weapon_01_Base_F: Rifle_Base_F /// Just basic values common for all testing rifle variants
    {
        magazines[] = {SWOP_DC15_Mag}; /// original custom made magazines and a group of several standardized mags
        reloadAction = "ReloadMagazine"; /// MX hand animation actually fits this rifle well
        magazineReloadSwitchPhase = 0.4; /// part of reload animation when new magazine ammo count should affect "revolving" animation source
        discreteDistanceInitIndex = 0; /// Ironsight zeroing is the lowest value by default

        // Size of recoil sway of the cursor
        maxRecoilSway=0.0025;
        // Speed at which the recoil sway goes back to zero (from maxRecoilSway to 0 in 1/swayDecaySpeed seconds)
        swayDecaySpeed=0.75;
        /// inertia coefficient of the weapon
        inertia = 0.9;

        /// positive value defines speed of the muzzle independent on the magazine setting, negative value is a coefficient of magazine initSpeed
        initSpeed = 300; /// this means that initSpeed of magazine is used

        class GunParticles : GunParticles
        {
            class SecondEffect
            {
                positionName = "Nabojnicestart";
                directionName = "Nabojniceend";
                effectName = "CaselessAmmoCloud";
            };
        };

        

/////////////////////////////////////////////////////  I R O N S I G H T S  /////////////////////////////////////////////////////
        opticsZoomMin=0.375;
        opticsZoomMax=25;
        opticsZoomInit=0.75;

        distanceZoomMin = 300;
        distanceZoomMax = 300;
/////////////////////////////////////////////////////  I R O N S I G H T S  /////////////////////////////////////////////////////

        descriptionShort = "Testing weapon with grenade launcher"; /// displayed on mouseOver in Inventory
        handAnim[] = {"OFP2_ManSkeleton", "\A3\Weapons_F\Rifles\MX\data\Anim\MX_gl.rtm"}; /// MX hand animation actually fits this rifle well
        dexterity = 1.8;

//caseless ammo//
        caseless[] = {"",1,1,1};  /// no sound of ejected brass
        soundBullet[] = {caseless,1};

        selectionFireAnim = "muzzleFlash"; /// are we able to get rid of all the zaslehs?

        modes[] = {Single, FullAuto, fullauto_medium, single_medium_optics1, single_far_optics2}; /// Includes fire modes for AI

    ////////////////////////////////////////////////////// NO OPTICS ///////////////////////////////////////////////////////////

        class Single: Mode_SemiAuto /// Pew
        {
            begin1[] = {"DC15SMOD\Sound\wpn_rep_blaster_fire.wss", 1, 1, 700};
            soundBegin[] = {"begin1", 1};
            reloadTime = 0.025; /// means some 625 rounds per minute
            dispersion = 0.00007; /// A bit less than 3 MOA
            recoil = "recoil_default"; /// defined in cfgRecoils
            recoilProne = "assaultRifleBase"; /// defined in cfgRecoils
            minRange = 2; minRangeProbab = 0.5;     /// Task Force Balance black magic - this is the probability which AI thinks it would hit target at set range with
            midRange = 200; midRangeProbab = 0.7;     /// it is no real probability of hit, just used for AI to compute if the shot is worth to take - AI chooses highest
            maxRange = 400; maxRangeProbab = 0.3;     /// probability of the weapon, does some calculation and compares it with calculated probability of other weapons
        };

        class FullAuto: Mode_FullAuto /// Pew-pew-pew-pew-pew
        {
            begin1[] = {"DC15SMOD\Sound\wpn_rep_blaster_fire.wss", 1, 1, 700};
            soundBegin[] = {"begin1", 1};
            reloadTime = 0.025;
            dispersion = 0.00007;
            recoil = "recoil_default"; /// defined in cfgRecoils
            recoilProne = "recoil_default"; /// defined in cfgRecoils
            minRange = 0; minRangeProbab = 0.9;
            midRange = 15; midRangeProbab = 0.7;
            maxRange = 30; maxRangeProbab = 0.1;
            aiRateOfFire = 0.000001;
        };

        class fullauto_medium: FullAuto /// Pew, pew, pew only for AI
        {
            showToPlayer = 0;
            burst = 3;

            minRange = 2; minRangeProbab = 0.5;
            midRange = 75; midRangeProbab = 0.7;
            maxRange = 150; maxRangeProbab = 0.05;

            aiRateOfFire = 2.0;
            aiRateOfFireDistance = 200;
        };
    //////////////////////////////////////////////////// OPTICS //////////////////////////////////////////////////

        class single_medium_optics1: Single /// Pew for AI with collimator sights
        {
            requiredOpticType = 1;
            showToPlayer = 0;

            minRange = 2; minRangeProbab = 0.2;
            midRange = 450; midRangeProbab = 0.7;
            maxRange = 600; maxRangeProbab = 0.2;

            aiRateOfFire = 6;
            aiRateOfFireDistance = 600;
        };

        class single_far_optics2: single_medium_optics1    /// Pew for AI with better sights
        {
            requiredOpticType = 2;
            showToPlayer = 0;

            minRange = 100; minRangeProbab = 0.1;
            midRange = 500; midRangeProbab = 0.6;
            maxRange = 700; maxRangeProbab = 0.05;

            aiRateOfFire = 8;
            aiRateOfFireDistance = 700;
        };


        aiDispersionCoefY=6.0; /// AI should have some degree of greater dispersion for initial shoots
        aiDispersionCoefX=4.0; /// AI should have some degree of greater dispersion for initial shoots
        drySound[] = {"SWOP_Main\SWOP_Rifles\SWOP_Blaster\Sounds\NoAmmo",0.398107,1,20}; /// custom made sounds
        reloadMagazineSound[] = {"SWOP_Main\SWOP_Rifles\SWOP_Blaster\Sounds\reload.wss",0.562341,1,30}; /// custom made sounds
        reloadSound[] = {"",1,1};
    };

    class Test_weapon_01_F: Test_weapon_01_Base_F
    {
        scope = 2; /// should be visible and useable in game
        displayName = "Test weapon"; /// some name
        model = "\DC15SMOD\test_weapon_01_F.p3d"; /// path to model
        picture = "\SWOP_Main\SWOP_Rifles\SWOP_Blaster\data\ui\E11.paa"; /// different accessories have M, S, T instead of X
        UiPicture = "\DC15SMOD\Data\UI\icon_gl_CA.paa"; /// weapon with grenade launcher should be marked such way

        weaponInfoType = "RscWeaponZeroing"; /// display with zeroing is good for iron sights

        class WeaponSlotsInfo: WeaponSlotsInfo
        {
            mass = 100; /// some rough estimate
        };
    };

};

 

Share this post


Link to post
Share on other sites
Quote

and I could not find any information on how to set the sound configs up correctly either. Any help would be greatly appreciated!

Look at vanilla weapon sound configs to learn how this is set up.  Use all in one config download for vanilla so you dont have to chase individual config files (google for this in this forum), or just read config classes with the ingame config viewer. I think megagoth also has some good info in his addon discussion topic.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×