How can I make a weapon available at all stations?

The place to discuss scripting and game modifications for X4: Foundations.

Moderators: Scripting / Modding Moderators, Moderators for English X Forum

user1679
Posts: 1088
Joined: Fri, 20. Jul 18, 23:20

How can I make a weapon available at all stations?

Post by user1679 »

What field in a weapon macro determines where the weapon is sold? I wanted to allow some of the faction specific weapons to be available at Argon Wharf/Shipyard but I don't see anything that says "build this at XYZ faction stations". Most wares have an "owner" tag that you can specify multiple factions but this doesn't seem the case for weapons.
sprIder
Posts: 135
Joined: Sat, 3. Jul 10, 23:23
x4

Re: How can I make a weapon available at all stations?

Post by sprIder »

This is determined in the wares.xml. For every ware, like equipments, modules and ships.

Let's say, you want to have the SPL M Neutron Gatling Mk1 available at the Argon Shipyard:

Create a mod, like "YourMod", set a dependency in the content.xml

Code: Select all

<dependency id="ego_dlc_split" optional="false" name="Split Vendetta"/>
Search for the correct ware id. Maybe with the weapon macro. In X4 Foundations\extensions\ego_dlc_split\libraries.xml: weapon_spl_m_gatling_01_mk1

Create your own wares.xml, but not in the dlc path(!):
X4 Foundations\extensions\YourMod\libraries.xml

Code: Select all

<?xml version="1.0" encoding="utf-8"?>
<diff>
	<add sel="//ware[@id='weapon_spl_m_gatling_01_mk1']">
		<owner faction="argon" />
	</add>
</diff>
That should be all.

Best regards
sprIder
user1679
Posts: 1088
Joined: Fri, 20. Jul 18, 23:20

Re: How can I make a weapon available at all stations?

Post by user1679 »

sprIder wrote: Tue, 7. Jan 25, 17:02 This is determined in the wares.xml. For every ware, like equipments, modules and ships.

Let's say, you want to have the SPL M Neutron Gatling Mk1 available at the Argon Shipyard:

Create a mod, like "YourMod", set a dependency in the content.xml

Code: Select all

<dependency id="ego_dlc_split" optional="false" name="Split Vendetta"/>
Search for the correct ware id. Maybe with the weapon macro. In X4 Foundations\extensions\ego_dlc_split\libraries.xml: weapon_spl_m_gatling_01_mk1

Create your own wares.xml, but not in the dlc path(!):
X4 Foundations\extensions\YourMod\libraries.xml

Code: Select all

<?xml version="1.0" encoding="utf-8"?>
<diff>
	<add sel="//ware[@id='weapon_spl_m_gatling_01_mk1']">
		<owner faction="argon" />
	</add>
</diff>
That should be all.

Best regards
sprIder
Thanks, for some reason when I extracted the game files to try and figure it out, wares.xml was not included, I was looking at the actual weapon macros. I extracted wares.xml and looked at some of the basic weapons and as I mentioned in my OP, they have several "owner" tags. Is there no way to add it to all factions without listing them one at a time? I wanted to make it so they were automatically available when new factions get added.
sprIder
Posts: 135
Joined: Sat, 3. Jul 10, 23:23
x4

Re: How can I make a weapon available at all stations?

Post by sprIder »

There is a way: remove all factions at that specific ware.

Code: Select all

<remove sel="//ware[@id='weapon_spl_m_gatling_01_mk1']/owner[@faction='court']"/>
<remove sel="//ware[@id='weapon_spl_m_gatling_01_mk1']/owner[@faction='split']"/>
<remove sel="//ware[@id='weapon_spl_m_gatling_01_mk1']/owner[@faction='freesplit']"/>
EDIT:
As DeadAirRT mentioned and to be clear: This is a very unsafe solution! This can break factions if, for example, shipyards have build orders for ships with "new" weapons or for "new" ships with old weapons, but they lack materials or compatibility.
E.g. Xenon ships are available for Argons without the resources or compatible weapons being available there.
Or Hullparts needed at a Terran shipyard.
This prevents other ship orders and will destroy the economy.

I don't know if there is any way via a md-script.
Last edited by sprIder on Sat, 11. Jan 25, 13:15, edited 1 time in total.
user1679
Posts: 1088
Joined: Fri, 20. Jul 18, 23:20

Re: How can I make a weapon available at all stations?

Post by user1679 »

Great, thank you!
DeadAirRT
Posts: 1124
Joined: Fri, 25. Jan 19, 03:26
x4

Re: How can I make a weapon available at all stations?

Post by DeadAirRT »

sprIder wrote: Thu, 9. Jan 25, 18:33 There is a way: remove all factions at that specific ware.

Code: Select all

<remove sel="//ware[@id='weapon_spl_m_gatling_01_mk1']/owner[@faction='court']"/>
<remove sel="//ware[@id='weapon_spl_m_gatling_01_mk1']/owner[@faction='split']"/>
<remove sel="//ware[@id='weapon_spl_m_gatling_01_mk1']/owner[@faction='freesplit']"/>
I don't know if there is any way via a md-script.
and break factions that don't have the appropriate build method or materials
sprIder
Posts: 135
Joined: Sat, 3. Jul 10, 23:23
x4

Re: How can I make a weapon available at all stations?

Post by sprIder »

Yes, that's right. And the same problem also exists/can exist if I (blindly) add every faction to a ware.

So, adding factions is much safer, if I am aware of missing build method or materials. But removing all factions solves users problem ?easier?
DeadAirRT
Posts: 1124
Joined: Fri, 25. Jan 19, 03:26
x4

Re: How can I make a weapon available at all stations?

Post by DeadAirRT »

sprIder wrote: Fri, 10. Jan 25, 08:34 Yes, that's right. And the same problem also exists/can exist if I (blindly) add every faction to a ware.

So, adding factions is much safer, if I am aware of missing build method or materials. But removing all factions solves users problem ?easier?
Removing all factions to make it easier for user doesn't justify breaking xenon
sprIder
Posts: 135
Joined: Sat, 3. Jul 10, 23:23
x4

Re: How can I make a weapon available at all stations?

Post by sprIder »

You are basically right. I have edited my post.

But what interests me is whether this specific case would really break the xenon. Because the weapons, turrets & shields of the Community of Planets and Borons are not compatible with the Xenon ships. Therefore, the AI would not use them for shipbuilding. The other way around could be a bigger problem. Like Xenon ships at Argon or Terran wharf. Although it's questionable whether the AI will try to build ships if they don't even meet the minimum requirements for engines and shields...
The same applies to the Boron, like Boron ships at a Terran/Argon shipyard.
But yes, you never know how a possibly new race and their ships and equipment will function technically.
user1679
Posts: 1088
Joined: Fri, 20. Jul 18, 23:20

Re: How can I make a weapon available at all stations?

Post by user1679 »

I don't want the AI to actually use the weapon, I just wanted to be able to buy them for my ship at any shipyard/wharf.

And I'm not talking about anything that needs a license, only basic weapons that might be specific to one faction or another but that I might mod slightly. I don't have a lot of time to play lately and it's annoying to find a ship and then spend 1/2 an hour flying across the galaxy just to see if I want to put a certain weapon that only ARG or TEL sells, and then to lose that ship from a Xenon swarm in Hat. Choice while I'm trying to get to Argon Prime.

Return to “X4: Foundations - Scripts and Modding”