X4: Foundations
0 of 0

File information

Last updated

Original upload

Created by

Walk

Uploaded by

TheGreatWalk

Virus scan

Safe to use

Tags for this mod

Documentation

Readme

View as plain text

mod folder name: weapon_mod_template_walk
mod name: weapon mod template walk
mod description: Adds 1 weapon and 1m turret - the idea is to give a basic template for modders to learn from and add their own weapon and effects, not for actual in-game use! Mod is unpacked by default for ease of editing!
author=Walk
version=1
date=2023-11-02

install: copy/paste/extract folder into X4/extensions/
enable in main menu

Adds the following weapon:
Medium Weapon: Template Medium Weapon
Medium weapon template - GAU-20 from BRRT_Weapon_Pack_Walk : https://www.nexusmods.com/x4foundations/mods/1250

Adds the following turret:

Medium Turret: Template Medium Turret
Basic medium turret template, using vanilla assets

File structure is as follows: See each individual file for details, including comments explaining variables, structures, etc.
I would recommend editing in the following order: context.xml, 0001.xml, wares.xml, weapon_macro.xml, bullet_macro.xml, effects.xml, sound_library.xml, macros.xml
weapon.xml, components.xml are only needed if you plan on editing connections, animations, or weapon model. For L models, you will need component weapon.xml if you plan on changing connections to allow you to equip it to other faction ships - by default they are limited. For that, you do NOT need the weapons_data folder or .ani file, you can point to defaults in your .xml file. See the individual files in the template for more detailed comments!

all filenames are case sensitive, I recommend using all lowercase except otherwise specified.
extensions\weapon_mod_template_walk\
content.xml: Contains Information about your mod, including author name, mod name, version numbers, requirements, etc. Must be setup correctly for mod to show on main menu and to function in game. Make sure you rename the parent folder for your new weapons mod and update context.xml.
t\
0001.xml: Contains names and descriptions of your weapons, including encyclopedia entries.
sfx\weapons\
audio.wav: Custom sound effect file. Existing assets do not need to be copied here. Must be in .wav or .ogg file format, I recommend .wav format. .mp3 files DO NOT work.
libraries\
effects.xml: contains effects(muzzle flash, impacts, etc). Can point to default effects in most cases.
icons.xml: contains icons, if applicable(not used in my mod, but included it as this is how you would get store icons)
sound_library.xml: Contains functions which link to your audio files in sfx\weapons\
wares.xml: Contains all wares information - this is how your weapon will show up in wharfs, shipyards, or blueprints, as well as encyclopedia, using entries from 0001.xml.
index\
components.xml: contains links to your weapon assets - NOT macros.
macros.xml: contains links to every single _macro.xml file in all your directory
assets\
props\weaponsystems\heavy\
weapon_gen_m_gau20.xml: This is your weapon connection file. It contains information needed for the weapon to attach and appear correctly in-game, as well as tags to determine what can use it. If using default, you don't need these files and can just reference existing/vanilla ones!
WEAPON_GEM_M_GAU20_DATA.ANI: contains animation files for the weapon. Only needed if you are using a non-default model and/or renaming an existing one.
weapon_gen_m_gau20_data\: Contains blender files for custom weapons. Only needed if you are using a non-default model or renaming an existing one.
macros\
weapon_gen_m_gau20_macro.xml: The weapon macro will link to its asset as well as its bullet. Contains some parameters which determine weapon tracking effectiveness. For "full-auto" weapons, will link to audio. Single fire weapons might rely on the bullet macro for audio.
fx\weaponfx\
macros\bullet_gen_m_gau20_macro.xml: The bullet macro will determine the effects, as well as damage, fire rate, reload, accuracy/moa, and a few other variables. For "single fire" weapons, it can also contain SFX.

(same for turrets, but didn't list them above)


Process for adding a custom weapon model to X4, in-case you are interested in making your own model, as I did for the included example gau20

1)install egosoft blender tools: https://forum.egosoft.com/viewtopic.php?t=453487 Link is in here
2)Unpack game files using xcat tool: https://www.egosoft.com:8444/confluence/pages/viewpage.action?pageId=76316994 Link is in here
3)Export to .dae using xconverter: https://forum.egosoft.com/viewtopic.php?f=181&t=404786 Link is in here, another guide as well to supplement this writeup.
3a)put exported .dae in p1[assets] folder
4a)import into blender - re-scale to 1.0 scale, then apply scale only. Some assets may need repositioning, but it shouldn't be needed for this step.
4b)rename tex0 to uv1 for every node
4c)rename colo0 to col for every node
4d)delete nodes called Xcollision
5a)convert(use regular convert) with egosoft addon
5b)delete nodes called xxx.col if any remain
6a)Make any further model, texture, color changes
6b)If resizing, resize using scale. Multiply positions by scale values(may not be required). Apply scale only. Only scale topmost node and in object mode. If resized, remember the value you scaled by, you will need this later!
7)apply hull with egosoft addon
8)export with egosoft addon
9a)run P1 Converter Local (egosoft tool)
9b)move from folder p1data into your asset folder
note: you will *only* use the _data folder generated, NOT the .ani files or the .xml. You will use the original .ani and .xml file, and edit them with the new values. Rename these two files to your new weapons name. For .ani file, make sure to keep the name UPCASE as you rename it.
10a)update the original .xml part_names with correct center & max attributes, from blender(y, z axis are swapped) and use that file. For offset, multiply the values by the same scale factor you used to resize earlier. Double check connection names. If you can't move on the ship the weapon is equipped too, it means broken collisions. If you can't shoot, but everything else works, broken xml "laser" connection. If the mesh is invisible, either incorrect connection names in XML, botched up mesh, or incorrect naming in weapon .xml file.
10b)If you made model changes, you might need to manually adjust offsets further. These offsets are based on the parent offsets, not relative to 0,0,0. Remember that y, z axis are swapped!(seriously this will fuck you up a few times!)
11)Done. Probably. If things are fucked up try again and make a small blood sacrifice to a minor demon of your choice. I would avoid major demons, as they tend to be assholes.