Jump to content
Shaun Gates

Help With Weapons Script

Recommended Posts

Hello, I am trying to learn modding for Arma 3 and was wondering if I could get some help. I'm trying to develop a new M240 and can't quite get the gunshot sounds to work. I've been following different tutorials and the wiki, yet the gun's fire sound does not play in the game. Forgive me for using the cup model, I'm just using it as a placeholder until I finish the new model. Thanks for your help!

Here is the code, thanks!
 

class CfgPatches

{

 class M240B                    

 {

    requiredaddons[] = {};

    requiredversion = 0.1;

    units[] = {};

    weapons[] = {"M240B"};

    magazines[] = {"CUP_100Rnd_TE4_LRT4_White_Tracer_762x51_Belt_M","CUP_100Rnd_TE4_LRT4_Red_Tracer_762x51_Belt_M","CUP_100Rnd_TE4_LRT4_Green_Tracer_762x51_Belt_M","CUP_100Rnd_TE4_LRT4_Yellow_Tracer_762x51_Belt_M"};             //mags used

 };

};
 

 class Mode_SemiAuto;

 class Mode_Burst;

 class Mode_FullAuto;

 class BaseSoundModeType;

 

class CfgWeapons {

    class M240B_base {

        access = 3;

        afmax = 0;

        aidispersioncoefx = 4;

        aidispersioncoefy = 5;

        airateoffire = 0.5;

        airateoffiredistance = 500;

        ammo = "";

        autofire = 1;

        autoreload = 0;

        backgroundreload = 0;

        ballisticscomputer = 0;

        bullet1[] = {"A3\sounds_f\weapons\shells\7_62\metal_762_01.wav", 0.1, 1, 15};

        bullet10[] = {"A3\sounds_f\weapons\shells\7_62\grass_762_02.wav", 0.01, 1, 15};

        bullet11[] = {"A3\sounds_f\weapons\shells\7_62\grass_762_03.wav", 0.01, 1, 15};

        bullet12[] = {"A3\sounds_f\weapons\shells\7_62\grass_762_04.wav", 0.01, 1, 15};

        bullet2[] = {"A3\sounds_f\weapons\shells\7_62\metal_762_02.wav", 0.1, 1, 15};

        bullet3[] = {"A3\sounds_f\weapons\shells\7_62\metal_762_03.wav", 0.177828, 1, 15};

        bullet4[] = {"A3\sounds_f\weapons\shells\7_62\metal_762_04.wav", 0.177828, 1, 15};

        bullet5[] = {"A3\sounds_f\weapons\shells\7_62\dirt_762_01.wav", 0.1, 1, 15};

        bullet6[] = {"A3\sounds_f\weapons\shells\7_62\dirt_762_02.wav", 0.1, 1, 15};

        bullet7[] = {"A3\sounds_f\weapons\shells\7_62\dirt_762_03.wav", 0.1, 1, 15};

        bullet8[] = {"A3\sounds_f\weapons\shells\7_62\dirt_762_04.wav", 0.1, 1, 15};

        bullet9[] = {"A3\sounds_f\weapons\shells\7_62\grass_762_01.wav", 0.01, 1, 15};

        candrop = 1;

        canlock = 0;

        canshootinwater = 0;

        cartridgepos = "nabojnicestart";

        cartridgevel = "nabojniceend";

        count = 0;

        cursor = "arifle";

        cursoraim = "CursorAim";

        cursoraimon = "";

        cursorsize = 1;

        cmimmunity = 1;

        descriptionshort = "2-505th M240 Bravo <br />Caliber: 7.62/5.56mm NATO<br />Rounds: 100<br />Used by: US Army<br />";

        detectrange = 0;

        dexterity = 1.64;

        discreteDistance[] = {100,200,300,400,500,600,700,800,900,1000,1100,1200,1300,1400,1500}; //distance in meters

        discretedistanceinitindex = 1;

        dispersion = 0.0001;

        displayname = "M240B";

        disposableweapon = 0;

        distancezoommax = 300;

        distancezoommin = 300;

        drysound[] = {"A3\sounds_f\weapons\other\dry7.wav", 0.01, 1};

        emptysound[] = {"", 1, 1};

        enableattack = 1;

        ffcount = 3;

        fffrequency = 11;

        ffmagnitude = 0.5;

        fireanims[] = {};

        firelightduration = 0.05;

        firelightintensity = 0.012;

        firespreadangle = "3.0f";

        flash = "gunfire";

        flashsize = 0.5;

        forceoptics = 0;

        handanim[] = {"OFP2_ManSkeleton","\CUP\Weapons\CUP_Weapons_M240\data\anim\m240.rtm"};   //hand animation lcation

        hiddenselections[] = {};

        hiddenselectionstextures[] = {};

        hiddenunderwaterselections[] = {};

        hiddenunderwaterselectionstextures[] = {};

        htmax = 600;

        htmin = 1;

        initspeed = 0;

        irdistance = 0;

        irdotintensity = 0.001;

        irlaserend = "laser dir";

        irlaserpos = "laser pos";

        laser = 0;

        lockacquire = 1;

        lockedtargetsound[] = {"\A3\sounds_f\dummysound", 0.000316228, 6};

        lockingtargetsound[] = {"\A3\sounds_f\dummysound", 0.000316228, 2};

        magazinereloadtime = 0;

        magazines[] = {"CUP_100Rnd_TE4_LRT4_White_Tracer_762x51_Belt_M","CUP_100Rnd_TE4_LRT4_Red_Tracer_762x51_Belt_M","CUP_100Rnd_TE4_LRT4_Green_Tracer_762x51_Belt_M","CUP_100Rnd_TE4_LRT4_Yellow_Tracer_762x51_Belt_M"};                         //magazines used

        maxleadspeed = 23;

        maxrange = 500;

        maxrangeprobab = 0.04;

        maxrecoilsway = 0.008;

        memorypointcamera = "eye";

        mfact = 1;

        mfmax = 0;

        midrange = 150;

        midrangeprobab = 0.58;

        minrange = 1;

        minrangeprobab = 0.3;

        model = "\CUP\Weapons\CUP_Weapons_M240\model\CUP_M240G";                    //weapon location of p3d...(dont add .p3d at the end)

        modelmagazine = "";

        modeloptics = "-";

        modelspecial = "";

        modes[] = {"FullAuto"};

        multiplier = 1;

        muzzleend = "konec hlavne";

        muzzlepos = "usti hlavne";

        muzzles[] = {"this"};

        namesound = "rifle";

        optics = 0;

        opticsdisableperipherialvision = 0.67;

        opticsflare = 0;

        opticsid = 0;

        opticsppeffects[] = {};

        opticszoominit = 0.75;

        opticszoommax = 1.1;

        opticszoommin = 0.375;

        picture = "\WEAPON_MAIN_FOLDER\UI\gear_WEAPON_x_ca";

        primary = 10;

        recoil = "recoil_zafir";

        recoilprone = "assaultRifleBase";

        reloadAction = "GestureReloadMMG01";                            //reload gesture

        reloadMagazineSound[] = {"A3\Sounds_F_Mark\arsenal\weapons\Machineguns\MMG_01_Navid\MMG_01_reload",1,1,10};

        reloadsound[] = {"", 1, 1};

        reloadtime = 0.15;

        scope = 0;

        selectionfireanim = "zasleh";

        showaimcursorinternal = 1;

        showempty = 1;

        shownunderwaterselections[] = {};

        showswitchaction = 0;

        showtoplayer = 1;

        simulation = "Weapon";

        sound[] = {};

        soundbegin[] = {"sound", 1};

        soundbeginwater[] = {"sound", 1};

        soundbullet[] = {"bullet1", 0.083, "bullet2", 0.083, "bullet3", 0.083, "bullet4", 0.083, "bullet5", 0.083, "bullet6", 0.083, "bullet7", 0.083, "bullet8", 0.083, "bullet9", 0.083, "bullet10", 0.083, "bullet11", 0.083, "bullet12", 0.083};

        soundburst = 1;

        soundclosure[] = {"sound", 1};

        soundcontinuous = 0;

        soundend[] = {"sound", 1};

        soundloop[] = {"sound", 1};

        swaydecayspeed = 2;

        tbody = 100;

        texturetype = "default";

        type = 1;

        uipicture = "\A3\weapons_f\data\UI\icon_regular_CA.paa";

        useaction = 0;

        useactiontitle = "";

        useasbinocular = 0;

        usemodeloptics = 1;

        value = 4;

        weaponinfotype = "RscWeaponZeroing";

        weaponlockdelay = 0;

        weaponlocksystem = 0;

        weaponpoolavailable = 1;

        weaponsoundeffect = "";

        weight = 0;

        class Library {

            libtextdesc = "LONG DETAILED WEAPON DESCRIPTION HERE";

        };

        class GunClouds {

            access = 0;

            cloudletaccy = 0;

            cloudletalpha = 0.3;

            cloudletanimperiod = 1;

            cloudletcolor[] = {1, 1, 1, 0};

            cloudletduration = 0.05;

            cloudletfadein = 0;

            cloudletfadeout = 0.1;

            cloudletgrowup = 0.05;

            cloudletmaxyspeed = 100;

            cloudletminyspeed = -100;

            cloudletshape = "cloudletClouds";

            cloudletsize = 1;

            deltat = 0;

            initt = 0;

            interval = -0.02;

            size = 0.3;

            sourcesize = 0.02;

            timetolive = 0;

            class Table {

                class T0 {

                    color[] = {1, 1, 1, 0};

                    maxt = 0;

                };

            };

        };

        class WeaponSlotsInfo {

            allowedslots[] = {901};

            mass = 4;

            class MuzzleSlot {};

            class CowsSlot {};

            class PointerSlot {};

        };  

        class GunParticles {

            class FirstEffect {

                directionname = "Konec hlavne";

                effectname = "RifleAssaultCloud";

                positionname = "Usti hlavne";

            };

        };

        class FullAuto : Mode_FullAuto {

            aidispersioncoefx = 1.4;

            aidispersioncoefy = 1.7;

            airateoffire = 2;

            airateoffiredistance = 500;

            artillerycharge = 1;

            artillerydispersion = 1;

            autofire = 1;

            burst = 0; // 0 = single shot, 1 = 3 round burst, 2 = 5 round burst, 3 = 8 round burst, 4 = 10 round burst, 5 = 12 round burst, 6 = 15 round burst

            canshootinwater = 0;

            dispersion = 0.00093;

            displayname = "FullAuto";

            ffcount = 1;

            fffrequency = 11; //

            ffmagnitude = 0.5;

            flash = "gunfire";

            flashsize = 0.3;

            maxrange = 500;

            maxrangeprobab = 0.2;

            midrange = 250;

            midrangeprobab = 0.7;

            minrange = 2;

            minrangeprobab = 0.3;

            multiplier = 1;

            recoil = "recoil_auto_trg";

            recoilprone = "recoil_auto_prone_trg";

            reloadtime = 0.065;

            requiredoptictype = -1;

            setFullAuto = 1; // 1 = full auto, 0 = semi auto

            soundcontinuous = 1;

            texturetype = "semi";

            useaction = 0;

            useactiontitle = "";

            weaponsoundeffect = "DefaultRifle";

            sounds[] = { "StandardSound" };

            class StandardSound {

                soundSetShot[] = { "M240B_Shot_SoundSet" };

            };

        };

       

    };

    class M240B : M240B_base {

        scope = 2;

    };

};

 

class CfgSoundSets {

    class M240B_Shot_SoundSet {

        soundShaders[] = {"M240B_closeShot_SoundShader", "M240B_midShot_SoundShader", "M240B_distShot_SoundShader"};

        volumeFactor = 1.3;

        volumeCurve = "InverseSquare2Curve";

        distanceFilter = "LowPassFilter";

    };

};

 

class CfgSoundShaders {

    class M240B_closeShot_SoundShader {

        samples[] = {{"\M240\sounds\M240B_close1.ogg", 1}};

        volume = 1.4;

        range = 50;

    };

   

    class M240B_midShot_SoundShader {

        samples[] = {{"\M240\sounds\sounds\M240B_distant1.ogg", 1}};

        volume = 1.2;

        range = 300;

    };

   

    class M240B_distShot_SoundShader {

        samples[] = {{"\M240\sounds\sounds\M240B_far1.ogg", 1}};

        volume = 1.0;

        range = 800;

    };

   

};

 

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

×