Wiki
Clone wikiX4 MobileShipProduction / Making new ships capable of mobile production
Making new ships capable of mobile production
Introduction
Adding building capabilities to new ships is fairly easy. This guide will give a general overview of the process.
Adding Dependencies
The first step is to make sure your extension has Mobile Ship Production as a dependency by adding the following line to your content.xml, inside the <content>
tag:
#!xml <dependency id="AMSP" version="LATESTVERSION" optional="false" />
Make sure you replace LATESTVERSION
with the latest version number of Mobile Ship Production.
Component
In order for anything to be able to build ships in X4, a macro of class buildmodule
is required. This buildmodule
macro, in turn, provides the required buildprocessor
macros, which are the entities that actually build/modify the ships.
The first step to make ships be able to build is to provide a connection for the buildmodule. This is done in the component file of the ship. An example of such connection is shown below:
#!xml <connection name="con_buildmodule" tags="buildmodule"> <offset> <position x="0" y="329.2903" z="332.8564"/> </offset> </connection>
Make sure you adjust the position and rotation of the buildmodule to a suitable position. Please, do note that this will influence the location of the ships being built on the map. If you use one of the two provided buildmodules, you can set the position to x="0" y="0" z="0"
as the provided buildmodules are invisible. More advanced setups not covered by this guide might require adition tweaking.
Macro
Now that a connection has been supplied, the next step will be referencing the correct macro for the buildmodule inside the macro of the ship. Mobile Ship Production provides two basic invisible buildmodules capable of working with M, S and XS ships. These are the names of the provided macros:
This macro is only capable of modifying and repairing ships:
#!xml buildmodule_gen_resupplier_equip_sm_macro
#!xml buildmodule_gen_resupplier_ships_sm_macro
These macros can be added to new ships by simply filling the previously created connection with either of them. An example using the equipment only macro is shown below:
#!xml <connection ref="con_buildmodule"> <macro ref="buildmodule_gen_resupplier_ships_sm_macro" connection="object" /> </connection>
It is very important that the connection
attribute of the <macro>
tag is set to object
as otherwise the game will be unable to find the ship's buildprocesor
macros.
Docks
By default, the buildmodule
of the ship will be able to build ships in any of the ship's docks. As such, the ship will need to have at least one M size and one S size dock in order to properly function. This requirement is fulfilled by all the player obtainable ships in the base game as of version 1.50.
If you would like to disable a dock from being used for ship building, the allowbuild="0"
parameter of the <dock>
tag inside any macro of class dockingbay
can be used to disable this functionality.`
An example of such usage is provided below:
#!xml <macro name="dockingbay_gen_m_nobuild_macro" class="dockingbay"> <component ref="dockingbay_arg_m_01_hightech" /> <properties> <identification unique="0" /> <dock external="1" allowbuild="0" /> <docksize tags="dock_m" /> </properties> </macro>
Updated