With some help, I spend today making sense of the file structure used by X4. Some of you might have seen the X4 tracer world mod (thanks for that awesome mod rjtwins!) and wonder how to edit and or add weapons in X4. To get you started I have set up this basic guide to file structure. I hope this help people in understanding what files are related to gun damage, gun FX etc.
Note that this guide does not include how to make XML Patch files if there is enough demand I might make this.
First, you need to extract the needed files, for this, I refer you to this guide: viewtopic.php?f=181&t=402452
Next, we need to make sense of the file structure that is used in X4, this will help us find the right files in the right folders. Disclaimer I'm not an expert on file types.
We will be looking into files from the following folders: We will start in libraries/wares.xml
This file contains all wares in the game including weapon systems. I like to use this file as a guide directing me to all the files I need to edit or add.
We will take a look at the medium laser turret from the Argon:
Code: Select all
<!-- Example of a weapon ware -->
<ware id="turret_arg_m_beam_01_mk1" name="{20105,4164}" description="{20105,4161}" group="turrets" transport="equipment" volume="1" tags="equipment noplayerblueprint turret">
<!-- The number in name and discriptoin refer to page and id number found in t/001-L044(for eng). These names are shown in the shopping list and only there-->
<price min="45385" average="50428" max="55471" />
<production time="10" amount="1" method="default" name="{20206,101}">
<primary>
<ware ware="advancedelectronics" amount="6" />
<ware ware="energycells" amount="10" />
<ware ware="turretcomponents" amount="10" />
</primary>
</production>
<component ref="turret_arg_m_beam_01_mk1_macro" amount="1" />
[b]<!-- this refers a macro, the linked macro in:
Assets/props/weaponsystems/energy/macros-->[/b]
<restriction licence="militaryequipment" />
<use threshold="0.65" />
<owner faction="argon" />
</ware>
For this, we have to go to the linked macro file: Assets/props/weaponsystems/energy/macros/turret_arg_m_beam_01_mk1_macro.xml
We will find the following file in there:
Code: Select all
<macros>
<macro name="turret_arg_m_beam_01_mk1_macro" class="turret" alias="turret_arg_m_beam_02_mk1_macro">
<component ref="turret_arg_m_beam_01_mk1" />
<!-- this refers to the component linked to this weapon listed in Assets/props/weaponsystems/energy information about the model of the weapon indicated in these
files -->
<properties>
<identification name="{20105,4164}" basename="{20105,4161}" shortname="{20105,4165}" makerrace="argon" description="{20105,4161}" mk="1" />
<!-- The name here will show up everywhere but the shoppinglist -->
<bullet class="bullet_gen_turret_m_beam_01_mk1_macro" />
[b]<!-- This refers to the FX of the weapon,the bullet/beam etc, leaving the weapon. Found in Assets/fx/macros-->[/b]
<rotationspeed max="90" />
<reload rate="0.5" time="1" />
<!-- not sure what this does yet -->
<hull threshold="0.2" integrated="1" />
</properties>
</macro>
</macros>
Code: Select all
<macros>
<macro name="bullet_gen_turret_m_beam_01_mk1_macro" class="bullet">
<component ref="bullet_gen_s_beam_01_mk1" />
<!-- this referst to a XML file in the weaponFx folder. This xml file has fx information about the projectie, however it also indicates where the weapn is fired from this
will become more importand later->
<properties>
<bullet speed="7000" lifetime="1" range="2550" amount="1" barrelamount="1" icon="weapon_beam_mk1" maxhits="1" ricochet="0" scale="1" attach="1" />
<reload time="3" />
<damage value="58" repair="0" />
<!-- properties of the projectile, this is differnt for bullet or beam weapons -->
<effects>
<impact ref="impact_gen_m_beam_01_mk1" />
<launch ref="muzzle_gen_m_beam_01_mk1" />
<!-- referst to fx for impact and muzzle blast -->
</effects>
<weapon system="turret_shortrange" />
<!--for any non turret weapons use weapon_standart here. For turrets you can use turret_shortrange/ turret_midrange/ turret_longrange or turret_mining.
This value needs to reflect the type of weapon you are attaching the bullet to for turrets use turret_xxxx for mining use mining and or everything else use
Weapon_standard-->
</properties>
</macro>
</macros>
Beam:
Code: Select all
<properties>
<bullet speed="7000" lifetime="1" range="2550" amount="1" barrelamount="1" icon="weapon_beam_mk1" maxhits="1" ricochet="0" scale="1" attach="1" />
<!-- speed= m/s, lifetime= beam length in sec, range = max range for beam weapon -->
<reload time="3" />
<damage value="58" repair="0" />
Beam weapons are the only weapons on the game that have the scale=1 and attach=1 value if you create a new beam weapon make sure to set these to the right value.
Gatling:
Code: Select all
<properties>
<ammunition value="21" reload="1" /> <!-- rounds in clip, reload time of clip in sec. -->
<bullet speed="1920" lifetime="2.5" amount="1" barrelamount="1" icon="weapon_gatling_mk1" timediff="0.025" angle="0.25" maxhits="2" ricochet="0.01"
restitution="0.3" scale="0" attach="0" /> <!-- speed= ms/s, lifetime= sec alive., amount=rounds at the same time, barrel=how many barrels -->
<heat value="43" /> <!-- heat generated per shot -->
<reload rate="14" /> <!-- rounds per sec. -->
<damage value="23" repair="0" />
If you are still here, thanks for reading and I hope you learned something from this. Feel free to ask questions