[HELP] replace ware owner from another mod with different faction

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

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

Post Reply
Rothank
Posts: 38
Joined: Mon, 11. Aug 14, 22:48
x4

[HELP] replace ware owner from another mod with different faction

Post by Rothank » Sun, 21. May 23, 17:22

I am working on a supplementing mod to an existing shippack that would make a whole new faction selling these ships exclusively.
The mod's scope is rather large, however, my current issue is with replacing the ships owner faction. I am planning to do this by setting the original mod as dependency and writing a suitable wares.xml patch.
The original file follows this sctructure:

Code: Select all

<add sel="/wares">
		<ware id="SHIPNAME" name="{998107,2}" description="{998107,3}" group="ships_terran" transport="ship" volume="1" tags="ship">
			<price min="20099943" average="25413426" max="28309471" />
			<production time="320" amount="1" method="default" name="{998107,4}">
				<primary>
					<ware ware="computronicsubstrate" amount="120" />
					<ware ware="energycells" amount="8000" />
					<ware ware="metallicmicrolattice" amount="550" />
				</primary>
			</production>
			<component ref="SHIPNAME_macro" amount="1" />
			<restriction licence="capitalship" />
			<owner faction="pioneers" />
		</ware>
</add>
(for ~20 ware entries, with changing IDs, ofc)

How do I write wares.xml patch file to leave everything as is, but REPLACE

Code: Select all

<owner faction="pioneers" />
with

Code: Select all

<owner faction="CUSTOMFACTION" />
without making any more changes?
Image Image
Image

Gomboc
Posts: 11
Joined: Tue, 9. Jan 07, 14:43
x4

Re: [HELP] replace ware owner from another mod with different faction

Post by Gomboc » Sun, 21. May 23, 19:38

Code: Select all

<diff>
 <replace sel="//wares/ware[@id='SHIPNAME']/owner/@faction">CUSTOMFACTION</replace>
</diff>

Rothank
Posts: 38
Joined: Mon, 11. Aug 14, 22:48
x4

Re: [HELP] replace ware owner from another mod with different faction

Post by Rothank » Mon, 22. May 23, 01:02

thank you! That was much simpler than I expected.
Turns out I was using just the ID instead of node name, hence why it did not work earlier.
Image Image
Image

Post Reply

Return to “X4: Foundations - Scripts and Modding”