Yuval 29 Posted July 15, 2014 I'm trying to get RH M4 pack working. I edited the guns and silencer with the new way it works but I have a problem. When the weapon needs to do it's regular sound it works, but when I attach a suppressor to it there's no sound at all. Here are the Suppressor and Gun configs: class Mode_SemiAuto; class Mode_Burst; class Mode_FullAuto; class SlotInfo; class CowsSlot; class PointerSlot; class CfgWeapons { class Rifle; class UGL_F; class WeaponSlotsInfo; class Rifle_Base_F: Rifle { class WeaponSlotsInfo; class GunParticles; }; class ItemCore; class ItemInfo; class InventoryItem_Base_F; class InventoryMuzzleItem_Base_F; class InventoryOpticsItem_Base_F; class InventoryFlashLightItem_Base_F; class Zasleh2; class supp_556: ItemCore { htMin = 1; htMax = 600; afMax = 0; mfMax = 0; mFact = 1; tBody = 100; scope = 2; displayName = "M4 Suppressor"; picture = "\m4\inv\ui\qdss_nt4_ui_ca.paa"; model = "\m4\qdss_nt4"; class ItemInfo: InventoryMuzzleItem_Base_F { mass = 4; soundTypeIndex = SilencedSound; class MagazineCoef { initSpeed = 1; }; class AmmoCoef { hit = 1.0; visibleFire = 0.5; audibleFire = 0.3; visibleFireTime = 0.5; audibleFireTime = 0.5; cost = 1.0; typicalSpeed = 1.0; airFriction = 1.0; }; muzzleEnd = "zaslehPoint"; alternativeFire = "Zasleh2"; }; }; class M4: Rifle_Base_F { scope = 2; magazines[] = {"30Rnd_556x45_STANAG","30Rnd_STANAG"}; class Library { libTextDesc = "Colt M4"; }; reloadAction = "GestureReloadSMG_02"; maxrecoilsway = 0.003; swaydecayspeed = 0; class WeaponSlotsInfo: WeaponSlotsInfo { class MuzzleSlot: SlotInfo { linkProxy = "\A3\data_f\proxies\weapon_slots\MUZZLE"; compatibleItems[] = {"supp_556"}; }; class CowsSlot: SlotInfo { linkProxy = "\A3\data_f\proxies\weapon_slots\TOP"; displayName = "$STR_A3_CowsSlot0"; compatibleItems[] = {"optic_Arco","optic_aco","optic_ACO_grn","optic_hamr","optic_Holosight","optic_SOS","optic_tws","optic_NVS","optic_Nightstalker","optic_DMS","optic_rds","optic_t1","optic_acog","optic_compm4s"}; }; class PointerSlot: PointerSlot{} }; opticsZoomMin = 0.375; opticsZoomMax = 1.1; opticsZoomInit = 0.75; distanceZoomMin = 300; distanceZoomMax = 300; descriptionShort = "Assault rifle<br/>Caliber: 5.56 mm"; displayName = "M4"; model = "\m4\m4.p3d"; picture = "\m4\inv\m4_x_ca.paa"; discreteDistance[] = {100,200,300,400,500,600,800}; discreteDistanceInitIndex = 1; weaponInfoType = "RscWeaponZeroing"; handAnim[] = {}; modes[] = {"Single","Burst","FullAuto","single_medium_optics1","single_far_optics2"}; class Single: Mode_SemiAuto { sounds[] = {StandardSound, SilencedSound}; class BaseSoundModeType /// I am too lazy to copy this twice into both standard and silenced sounds, that is why there is a base class from which both inherit (and sound of closure stays the same no matter what muzzle accessory is used) { weaponSoundEffect = "DefaultRifle"; closure1[] = {"A3\sounds_f\weapons\closure\closure_rifle_2",1.1220185,1,10}; closure2[] = {"A3\sounds_f\weapons\closure\closure_rifle_3",1.1220185,1,10}; soundClosure[] = {"closure1",0.5,"closure2",0.5}; }; class StandardSound: BaseSoundModeType /// Sounds inside this class are used when soundTypeIndex = 0, according to sounds[] { begin1[] = {"\m4\sound\m4_fire1",1.2589254,1,1200}; begin2[] = {"\m4\sound\m4_fire2",1.2589254,1,1200}; soundBegin[] = {"begin1",0.5,"begin2",0.5}; }; class SilencedSound: BaseSoundModeType /// Sounds inside this class are used when soundTypeIndex = 1, according to sounds[] { begin1[] = {"m4\sound\m4sd",1.0,1,240}; begin2[] = {"m4\sound\m4sd",1.0,1,240}; begin3[] = {"m4\sound\m4sd",1.0,1,240}; soundBegin[] = {"begin1",0.5,"begin2",0.5,"begin3",0.5}; }; reloadTime = 0.075; recoil = "m4_Recoil"; recoilProne = "m4_RecoilProne"; dispersion = 0.00225; minRange = 2; minRangeProbab = 0.5; midRange = 225; midRangeProbab = 0.7; maxRange = 500; maxRangeProbab = 0.2; }; class Burst: Mode_Burst { sounds[] = {StandardSound, SilencedSound}; class BaseSoundModeType /// I am too lazy to copy this twice into both standard and silenced sounds, that is why there is a base class from which both inherit (and sound of closure stays the same no matter what muzzle accessory is used) { weaponSoundEffect = "DefaultRifle"; closure1[] = {"A3\sounds_f\weapons\closure\closure_rifle_2",1.1220185,1,10}; closure2[] = {"A3\sounds_f\weapons\closure\closure_rifle_3",1.1220185,1,10}; soundClosure[] = {"closure1",0.5,"closure2",0.5}; }; class StandardSound: BaseSoundModeType /// Sounds inside this class are used when soundTypeIndex = 0, according to sounds[] { begin1[] = {"\m4\sound\m4_fire1",1.2589254,1,1200}; begin2[] = {"\m4\sound\m4_fire2",1.2589254,1,1200}; soundBegin[] = {"begin1",0.5,"begin2",0.5}; }; class SilencedSound: BaseSoundModeType /// Sounds inside this class are used when soundTypeIndex = 1, according to sounds[] { begin1[] = {"m4\sound\m4sd",1.0,1,240}; begin2[] = {"m4\sound\m4sd",1.0,1,240}; begin3[] = {"m4\sound\m4sd",1.0,1,240}; soundBegin[] = {"begin1",0.333,"begin2",0.333,"begin3",0.333}; }; reloadtime = 0.075; recoil = "m4_Recoil_Auto"; recoilProne = "m4_RecoilProneAuto"; dispersion = 0.00225; aiRateOfFire = 1; aiRateOfFireDistance = 200; minRange = 0; minRangeProbab = 0.8; midRange = 60; midRangeProbab = 0.7; maxRange = 120; maxRangeProbab = 0.05; }; class FullAuto: Mode_FullAuto { sounds[] = {StandardSound, SilencedSound}; class BaseSoundModeType /// I am too lazy to copy this twice into both standard and silenced sounds, that is why there is a base class from which both inherit (and sound of closure stays the same no matter what muzzle accessory is used) { weaponSoundEffect = "DefaultRifle"; closure1[] = {"A3\sounds_f\weapons\closure\closure_rifle_2",1.1220185,1,10}; closure2[] = {"A3\sounds_f\weapons\closure\closure_rifle_3",1.1220185,1,10}; soundClosure[] = {"closure1",0.5,"closure2",0.5}; }; class StandardSound: BaseSoundModeType /// Sounds inside this class are used when soundTypeIndex = 0, according to sounds[] { begin1[] = {"\m4\sound\m4_fire1",1.2589254,1,1200}; begin2[] = {"\m4\sound\m4_fire2",1.2589254,1,1200}; soundBegin[] = {"begin1",0.5,"begin2",0.5}; }; class SilencedSound: BaseSoundModeType /// Sounds inside this class are used when soundTypeIndex = 1, according to sounds[] { begin1[] = {"m4\sound\m4sd",1.0,1,240}; begin2[] = {"m4\sound\m4sd",1.0,1,240}; begin3[] = {"m4\sound\m4sd",1.0,1,240}; soundBegin[] = {"begin1",0.333,"begin2",0.333,"begin3",0.333}; }; reloadTime = 0.075; recoil = "m4_Recoil_Auto"; recoilProne = "m4_RecoilProneAuto"; dispersion = 0.00225; minRange = 0; minRangeProbab = 0.9; midRange = 15; midRangeProbab = 0.7; maxRange = 30; maxRangeProbab = 0.1; aiRateOfFire = 1e-006; }; class single_medium_optics1: Single { requiredOpticType = 1; showToPlayer = 0; minRange = 2; minRangeProbab = 0.2; midRange = 550; midRangeProbab = 0.7; maxRange = 700; maxRangeProbab = 0.1; aiRateOfFire = 6; aiRateOfFireDistance = 600; }; class single_far_optics2: single_medium_optics1 { requiredOpticType = 2; }; class fullauto_medium: FullAuto { showToPlayer = 0; burst = 3; minRange = 2; minRangeProbab = 0.5; midRange = 75; midRangeProbab = 0.7; maxRange = 150; maxRangeProbab = 0.05; aiRateOfFire = 2.0; }; aiDispersionCoefY = 10; aiDispersionCoefX = 8; changeFiremodeSound[] = {"\m4\sound\m4_selector.wav",0.25,1}; drySound[] = {"A3\sounds_f\weapons\Other\dry_1",1.1,1,10}; reloadMagazineSound[] = {"m4\sound\m4_reload",1.8,1,30}; }; }; Thanks in advance - Yuval P.S - The whole thing worked before the update Share this post Link to post Share on other sites
pettka 694 Posted July 15, 2014 I'm trying to get RH M4 pack working.I edited the guns and silencer with the new way it works but I have a problem. When the weapon needs to do it's regular sound it works, but when I attach a suppressor to it there's no sound at all. Here are the Suppressor and Gun configs: Thanks in advance - Yuval P.S - The whole thing worked before the update I would expect the issue to be in this part: soundBegin[] = {"begin1",0.5,"begin2",0.5,"begin3",0.5}; As far as I know, the sum of probabilities should be 1, which is a bit exceeded in this case. The rest seems to be OK as far as I can tell from a quick look :icon_twisted: Share this post Link to post Share on other sites
Yuval 29 Posted July 15, 2014 I would expect the issue to be in this part: soundBegin[] = {"begin1",0.5,"begin2",0.5,"begin3",0.5}; As far as I know, the sum of probabilities should be 1, which is a bit exceeded in this case. The rest seems to be OK as far as I can tell from a quick look :icon_twisted: I honestly have no idea how to use soundBegin, could you tell me what would this number do? Share this post Link to post Share on other sites
da12thMonkey 1943 Posted July 15, 2014 (edited) IIRC the numbers represent a probability of each sound ("begin1", "begin2" etc.) being selected from the soundBegin[] array when the weapon fires. It creates a sort of semi-random variation in the order in which the sound samples are played while firing the weapon. So a sound with a probability 0.5 has a 50% chance of being played, one with 0.2 has a 20% chance of being played. The sum of all probabilities in the array has to equal 1 (100% probability). If you had two sounds that you wanted to have an equal chance of being selected you would use 0.5 for both soundBegin[] = {"begin1",0.5,"begin2",0.5}; (0.5 + 0.5 = 1) statistically this would mean each sound would be heard every once every two shots fired by the weapon. If you wanted begin1 to be more likely to be played than begin2 you would use say soundBegin[] = {"begin1",0.7,"begin2",0.3}; (0.7 + 0.3 = 1) statistically this would mean you would hear begin2 around once every three shots fired by the weapon. For three sounds you'd use something like soundBegin[] = {"begin1",0.33,"begin2",0.33,"begin3",0.34}; to get all three sounds playing with equal chance. The last number is rounded up slightly because 1/3 is 0.3333333333333333333333333 recurring, and you don't want to write out an infinite string of 3s to make the sum of probabilities exactly 1 :) That said, Pettka, does this actually work: soundTypeIndex = SilencedSound; Without having some sort of define like #define StandardSound 0 #define SilencedSound 1 in the config header (or #including some sort of basicDefines_A3.hpp with those macros already set)? I'd been operating under the assumption that you wrote the numeric index value of the class in the sounds[] array rather than the classname itself, and it was only written like that in the example on the wiki to provide an indication of which index number to use. Looking at the soundTypeIndex values in the config browser, they were showing as numeric index values. i.e. soundTypeIndex = 1; for suppressor attachments. Edited July 15, 2014 by da12thMonkey Share this post Link to post Share on other sites
Yuval 29 Posted July 15, 2014 IIRC the numbers represent a probability of each sound ("begin1", "begin2" etc.) being selected from the soundBegin[] array when the weapon fires. It creates a sort of semi-random variation in the order in which the sound samples are played while firing the weapon.So a sound with a probability 0.5 has a 50% chance of being played, one with 0.2 has a 20% chance of being played. The sum of all probabilities in the array has to equal 1 (100% probability). If you had two sounds that you wanted to have an equal chance of being selected you would use 0.5 for both soundBegin[] = {"begin1",0.5,"begin2",0.5}; (0.5 + 0.5 = 1) statistically this would mean each sound would be heard every once every two shots fired by the weapon. If you wanted begin1 to be more likely to be played than begin2 you would use say soundBegin[] = {"begin1",0.7,"begin2",0.3}; (0.7 + 0.3 = 1) statistically this would mean you would hear begin2 around once every three shots fired by the weapon. For three sounds you'd use something like soundBegin[] = {"begin1",0.33,"begin2",0.33,"begin3",0.34}; to get all three sounds playing with equal chance. The last number is rounded up slightly because 1/3 is 0.3333333333333333333333333 recurring, and you don't want to write out an infinite string of 3s to make the sum of probabilities exactly 1 :) That said, Pettka, does this actually work: soundTypeIndex = SilencedSound; Without having some sort of define like #define StandardSound 0 #define SilencedSound 1 in the config header (or #including some sort of basicDefines_A3.hpp with those macros already set)? I'd been operating under the assumption that you wrote the numeric index value of the class in the sounds[] array rather than the classname itself, and it was only written like that in the example on the wiki to provide an indication of which index number to use. Looking at the soundTypeIndex values in the config browser, they were showing as numeric index values. i.e. soundTypeIndex = 1; for suppressor attachments. Thanks, it helped me alot Share this post Link to post Share on other sites
pettka 694 Posted July 16, 2014 (edited) That said, Pettka, does this actually work: soundTypeIndex = SilencedSound; Without having some sort of define like #define StandardSound 0 #define SilencedSound 1 in the config header (or #including some sort of basicDefines_A3.hpp with those macros already set)? You are actually right, that may be the issue I have missed in the skimming through as soundTypeIndex is defined in InventoryMuzzleItem_Base_F to be 1 (by the define You have mentioned) :icon_twisted: And thanks a lot for letting me know, I have adjusted the wiki accordingly, it makes sense to rather have the value in example :bounce2: Edited July 16, 2014 by pettka Share this post Link to post Share on other sites
Yuval 29 Posted July 28, 2014 I came back from my vacation and I decided to give this config another shot. I found out the problem is in my suppressors, because I tried attaching them to another gun and it didn't work - but when I attached a regular 556 suppressors it did (It was a custom gun too). Now it seems to me I also fucked up something in the config because this very specific addon (I have different PBOs for different weapon types, so M4's, M1's, Pistols and etc... have different PBOs) doesn't load? Here is my suppressors lines (It's under CfgWeapons) class supp_556: ItemCore { htMin = 1; htMax = 600; afMax = 0; mfMax = 0; mFact = 1; tBody = 100; scope = 2; displayName = "M4 Suppressor"; picture = "\m4\inv\ui\qdss_nt4_ui_ca.paa"; model = "\m4\qdss_nt4"; class ItemInfo: InventoryMuzzleItem_Base_F { mass = 4; class MagazineCoef { initSpeed = 1; }; class AmmoCoef { hit = 1.0; visibleFire = 0.5; audibleFire = 0.3; visibleFireTime = 0.5; audibleFireTime = 0.5; cost = 1.0; typicalSpeed = 1.0; airFriction = 1.0; }; soundTypeIndex = 1; muzzleEnd = "zaslehPoint"; alternativeFire = "Zasleh2"; }; }; class supp_spr: ItemCore { htMin = 1; htMax = 600; afMax = 0; mfMax = 0; mFact = 1; tBody = 100; scope = 2; displayName = "Mk12 Suppressor"; picture = "\m4\inv\ui\spr_mbs_ui_ca.paa"; model = "\m4\spr_mbs"; class ItemInfo: InventoryMuzzleItem_Base_F { mass = 4; class MagazineCoef { initSpeed = 1; }; class AmmoCoef { hit = 1.0; visibleFire = 0.5; audibleFire = 0.3; visibleFireTime = 0.5; audibleFireTime = 0.5; cost = 1.0; typicalSpeed = 1.0; airFriction = 1.0; }; soundTypeIndex = 1; muzzleEnd = "zaslehPoint"; alternativeFire = "Zasleh2"; }; }; Please, if you find a problem - or any error because it doesn't load - tell me. Share this post Link to post Share on other sites
pettka 694 Posted July 28, 2014 I came back from my vacation and I decided to give this config another shot. I found out the problem is in my suppressors, because I tried attaching them to another gun and it didn't work - but when I attached a regular 556 suppressors it did (It was a custom gun too). Now it seems to me I also fucked up something in the config because this very specific addon (I have different PBOs for different weapon types, so M4's, M1's, Pistols and etc... have different PBOs) doesn't load?Please, if you find a problem - or any error because it doesn't load - tell me. Just to be sure, do You have the declaration of necessary classes before this? I mean: class ItemCore; class InventoryMuzzleItem_Base_F; Because the piece of config You have posted looks legit :icon_twisted: Share this post Link to post Share on other sites
Yuval 29 Posted July 29, 2014 Just to be sure, do You have the declaration of necessary classes before this? I mean: class ItemCore; class InventoryMuzzleItem_Base_F; Because the piece of config You have posted looks legit :icon_twisted: Uhmm... This is all I have between cfgWeapons to class supp_556 class CfgWeapons { class Rifle; class UGL_F; class WeaponSlotsInfo; class Rifle_Base_F: Rifle { class WeaponSlotsInfo; class GunParticles; }; class ItemCore; class ItemInfo; class InventoryItem_Base_F; class InventoryMuzzleItem_Base_F; class InventoryOpticsItem_Base_F; class InventoryFlashLightItem_Base_F; class Zasleh2; class supp_556: ItemCore I guess this means yes! Is there anyway to check what's the error (Usually when I script PAWN, the compiler always says if there's an error, in which line and what is the error exactly. - I always run -showScriptErrors and I see no errors... that specific PBO does not load up.. Share this post Link to post Share on other sites
warlord554 2065 Posted July 29, 2014 When you can post the entire complete config, im scrolling up and down to read them both. Could also be a problem with the other lines of code you haven't included. Addon builder with binarize checked will do a great job catching exact config problems, will even tell you the line of error Share this post Link to post Share on other sites
Yuval 29 Posted July 31, 2014 Solved it finally. The problem was that I didn't add the following code in the silencer's ItemInfo: class MuzzleCoef { dispersionCoef = "0.8f"; artilleryDispersionCoef = "1.0f"; fireLightCoef = "0.1f"; recoilCoef = "1.0f"; recoilProneCoef = "1.0f"; minRangeCoef = "1.0f"; minRangeProbabCoef = "1.0f"; midRangeCoef = "1.0f"; midRangeProbabCoef = "1.0f"; maxRangeCoef = "1.0f"; maxRangeProbabCoef = "1.0f"; }; Thanks everyone. Share this post Link to post Share on other sites