[4.20] I believe i have fixed the destroyer main battery sound bug

Ask here if you experience technical problems with X4: Foundations.

Moderator: Moderators for English X Forum

Post Reply
Troubleshooter11
Posts: 723
Joined: Sat, 8. Nov 08, 02:51
x4

[4.20] I believe i have fixed the destroyer main battery sound bug

Post by Troubleshooter11 » Thu, 20. Jan 22, 15:31

Howdy folks,

Ever since X4 released, i was annoyed by the main guns on destroyers having a sound bug where the first shot plays the correct sound (FWOOM!!), but followup shots make a pitiful sound, as demonstrated in this YT video: https://www.youtube.com/watch?v=GXsneMT ... el=Trouble

After extracting all the game files and spending a few hours of trying to figure out how guns, projectiles and sounds work, it seems i found a solution as demonstrated in this YT video: https://www.youtube.com/watch?v=JkQbxMV ... el=Trouble

This seems to be the cause:

\assets\props\WeaponSystems\capital\macros\weapon_arg_l_destroyer_01_mk1_macro.xml contains the following code:

Code: Select all

<?xml version="1.0" encoding="utf-8"?>
<!--Exported by: Matthias (192.168.3.59) at 14.05.2021_15-01-12-->
<macros>
  <macro name="weapon_arg_l_destroyer_01_mk1_macro" class="weapon">
    <component ref="weapon_arg_l_destroyer_01_mk1" />
    <properties>
      <identification name="{20105,3004}" basename="{20105,3001}" makerrace="argon" description="{20105,3002}" mk="1" />
      <bullet class="bullet_arg_l_laser_01_mk1_macro" />
      <heat overheat="10000" cooldelay="1.13" coolrate="2000" reenable="9500" />
      <rotationspeed max="32.3" />
      <rotationacceleration max="64.6" />
      <reload />
      <hull max="8000" />
      <sounds>
        <firing ref="wpn_impulse_l" />
      </sounds>
    </properties>
  </macro>
</macros>
The line firing ref="wpn_impulse_l" refers to an entry in the sound_library.xml file, which randomly plays 1 of 5 different big laser sounds (FWOOM!!) . However, this is only triggered once, when the fire button is clicked or held down.

Next i looked up the bullet associated with this weapon, you can see the bullet class reference in the code block above. This file can be found here:

\assets\fx\weaponFx\macros\bullet_arg_l_laser_01_mk1_macro.xml

Code: Select all

<?xml version="1.0" encoding="utf-8"?>
<!--Exported by: nick (192.168.3.124) at 16.01.2020_17-05-34-->
<macros>
  <macro name="bullet_arg_l_laser_01_mk1_macro" class="bullet">
    <component ref="bullet_arg_l_laser_01_mk1" />
    <properties>
      <ammunition value="3" reload="2" />
      <bullet speed="1659" lifetime="6.3" amount="1" barrelamount="1" icon="weapon_laser_mk1" timediff="0.002" angle="0.03" maxhits="1" ricochet="0" scale="0" attach="0" />
      <heat value="486" />
      <reload rate="1.2" />
      <damage value="2588" repair="0" />
      <effects>
        <impact ref="impact_gen_l_laser_01_mk1" inside="impact_gen_l_laser_01_mk1_inside" />
        <bigobjectimpact ref="impact_gen_l_laser_01_mk1_bigobject" inside="impact_gen_l_laser_01_mk1_bigobject_inside" />
        <launch ref="muzzle_gen_l_laser_01_mk1" />
      </effects>
      <weapon system="weapon_standard" />
    </properties>
  </macro>
</macros>
We see no sound references here, but we do see a launch effect: launch ref="muzzle_gen_l_laser_01_mk1". This refers to an entry in the effects.xml file:

Code: Select all

 <effect name="muzzle_gen_l_laser_01_mk1" alignment="object">
    <references>
      <reference effect="muzzle_gen_l_laser_01_mk1_base"/>
    </references>
    <elements>
      <!-- Sound -->
      <element id="4" ref="effect_dummy_macro" forkeffect="none" duration="1.5" forklod="none">
        <sound ref="wpn_impulse_player_muzzle"/>
      </element>
    </elements>
  </effect>
Here we DO see a sound reference: sound ref="wpn_impulse_player_muzzle". So we crossreference this entry with the sound_library.xml file and find the following:

Code: Select all

  <sound id="wpn_impulse_player_muzzle" description="Laser sound" repeat="1" is3d="1" preload="1" amount="64" >
    <sample selection="random">
      <select start="sfx\weapons\laser\wpn_impulse_muzzle_01"/>
      <select start="sfx\weapons\laser\wpn_impulse_muzzle_02"/>
    </sample>
    <volume start="0.9" distance="10"/>
  </sound>
Those two wpn_impulse_muzzle_01/02 files that are being referenced are the puny "pew" sounds you hear as follow up to the first shot.

What i have done to fix this:

In weapon_arg_l_destroyer_01_mk1_macro.xml i removed the sound entry so we do not have two "sources" of firing sounds:

Code: Select all

<diff>
	<remove sel="//macros/macro[@name='weapon_arg_l_destroyer_01_mk1_macro']/properties/sounds/firing[@ref='wpn_impulse_l']"/>

</diff>
In effects.xml i changed the reference to the puny laser sound with the proper sound reference:

Code: Select all

<diff>
	<replace sel="//effects/effect[@name='muzzle_gen_l_laser_01_mk1']/elements/element[@id='4']/sound[@ref='wpn_impulse_player_muzzle']">
		<sound ref='wpn_impulse_l'/>
	</replace>
</diff>
I hope you folks at Egosoft can use this to patch this little bug. If not, then i'll consider just turning this into a mod. Destroyers are just more fun when the big guns make big booms. 8)

|K.O.S.H.
Posts: 3724
Joined: Fri, 19. Dec 03, 10:36
x3tc

Re: [4.20] I believe i have fixed the destroyer main battery sound bug

Post by |K.O.S.H. » Thu, 20. Jan 22, 16:48

It's not a bug, it's feature.
I explained it in another thread.

Btw, I did the same as you, some months ago ;)
Wing Commander Mod - German Topic
06.07.11 - v1.1 RELEASED!

Post Reply

Return to “X4: Foundations - Technical Support”