[SOLVED]Ship editing question from a beginner

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

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

Post Reply
BigGreenThugs
Posts: 89
Joined: Thu, 26. Mar 20, 16:50
x4

[SOLVED]Ship editing question from a beginner

Post by BigGreenThugs » Wed, 16. Sep 20, 03:52

I posted this question in the Tutorial for XML patching (viewtopic.php?t=354310) and after a week of no response I thought I would post here.
First thing is I'm not real modder. I have successfully edited a few mods but my understanding of how is very limited. The folks that make these mods are doing the heavy lifting.

The first question is How do I turn this: (from ship_arg_s_trans_container_02.xml)

Code: Select all

<components>
	<component>
		<connections>
			<connection name="con_weapon_005" tags="weapon small standard missile platformcollision symmetry symmetry_right symmetry_top ">
				<offset>
					<position x="2.485125" y="2.050091" z="4.118674"/>
				</offset>
			</connection>
		</connections>
	</component>
</components>	
into:

Code: Select all

<components>
	<component>
		<connections>
			<connection name="con_weapon_005" tags="weapon small standard mining missile platformcollision symmetry symmetry_right symmetry_top ">
				<offset>
					<position x="2.485125" y="2.050091" z="4.118674"/>
				</offset>
			</connection>
		</connections>
	</component>
</components>	
?
What I want is the Callisto to be able to mount a mining laser for more early game money via crystal mining. With crystals being rarer, my thought was, while looking for crystals, (which I'll shoot off with a pulse laser) I could also pulverize the rocks looking for spacefly eggs, lodestones, and unstable crystals. This can be done with the Theseus but the Callisto is much more readily available and cheaper.

Second question is will changing that connection tag by adding the word mining to the list make the mining laser mountable in one of the small weapon slots?

Thanks in advance for reading and any help.
Last edited by BigGreenThugs on Mon, 21. Sep 20, 21:48, edited 1 time in total.

linolafett
EGOSOFT
EGOSOFT
Posts: 3356
Joined: Mon, 26. Mar 12, 14:57
x4

Re: Ship editing question from a beginner

Post by linolafett » Wed, 16. Sep 20, 10:33

I cant say anything about the XML patching, but adding the tag "mining" will make that weapon slot indeed compatible with the mining weapon.
01001100 01101001 01101110 01100101 01110011 00100000 01101111 01100110 00100000 01110100 01101001 01101101 01100101 01110011 00101110 00101110 00101110

My art stuff

BigGreenThugs
Posts: 89
Joined: Thu, 26. Mar 20, 16:50
x4

Re: Ship editing question from a beginner

Post by BigGreenThugs » Sat, 19. Sep 20, 19:14

The mod Personnel Shuttles (https://www.nexusmods.com/x4foundations ... ?tab=files) is a good example of making a small tweak to a specific ship stat. The whole mod is:

Code: Select all

<?xml version="1.0" encoding="utf-8"?>
<diff> 
    <replace sel="//macros/macro/properties/people/@capacity">21</replace>
</diff>
Looking at examples is my best method of learning specific syntax for things is. In the in the XML patch tutorial thread they have several examples of changing an atrribute with a single value as above but not anything where the atribute has several values seperated by spaces
I've been thinking that this could be a simple as:

Code: Select all

<?xml version="1.0" encoding="utf-8"?>
<diff> 
    <add sel="//components/component/connections/connection[48]/@tags">mining </add>
    <add sel="//components/component/connections/connection[49]/@tags">mining </add>
</diff>
(tried it, still could not equip mining weapons)
I don't know how to debug if it's wrong. I feel like I'm just missing something minor that would make this click but I've yet to have an "A HA!" moment.

User avatar
Axeface
Posts: 2943
Joined: Fri, 18. Nov 05, 00:41
x4

Re: Ship editing question from a beginner

Post by Axeface » Sat, 19. Sep 20, 21:42

BigGreenThugs wrote:
Sat, 19. Sep 20, 19:14
The mod Personnel Shuttles (https://www.nexusmods.com/x4foundations ... ?tab=files) is a good example of making a small tweak to a specific ship stat. The whole mod is:

Code: Select all

<?xml version="1.0" encoding="utf-8"?>
<diff> 
    <replace sel="//macros/macro/properties/people/@capacity">21</replace>
</diff>
Looking at examples is my best method of learning specific syntax for things is. In the in the XML patch tutorial thread they have several examples of changing an atrribute with a single value as above but not anything where the atribute has several values seperated by spaces
I've been thinking that this could be a simple as:

Code: Select all

<?xml version="1.0" encoding="utf-8"?>
<diff> 
    <add sel="//components/component/connections/connection[48]/@tags">mining </add>
    <add sel="//components/component/connections/connection[49]/@tags">mining </add>
</diff>
(tried it, still could not equip mining weapons)
I don't know how to debug if it's wrong. I feel like I'm just missing something minor that would make this click but I've yet to have an "A HA!" moment.
How are you testing the mod? Are you loading into the game with the ship ready to test with? I think you might need to build a new ship because xmls are kind of baked into ships in the savegame (I dunno what im talking about, just a guess). Also is the patch file packaged in a ext_01 dat/cat?

BigGreenThugs
Posts: 89
Joined: Thu, 26. Mar 20, 16:50
x4

Re: Ship editing question from a beginner

Post by BigGreenThugs » Sun, 20. Sep 20, 16:21

Axeface wrote:
Sat, 19. Sep 20, 21:42
How are you testing the mod? Are you loading into the game with the ship ready to test with? I think you might need to build a new ship because xmls are kind of baked into ships in the savegame (I dunno what im talking about, just a guess). Also is the patch file packaged in a ext_01 dat/cat?
First thing, thanks for responding and I'm really liking the Cyclops. Awesome ship.

Testing the mod the only way I know how and that is in game. Is there another way to test? I looked at the "[TOOL] Verify your XML patching without running the game." and it had the word "compile" in the instructions. I have no experience compiling anything. Sorry if that's a needle jump moment.
I have both a ship in place that I tried to modify and tried to build new with the same results. I did not try a new game to test.
The patch is not in ext_01 dat/cat, just correct folder paths.

BigGreenThugs
Posts: 89
Joined: Thu, 26. Mar 20, 16:50
x4

Re: [SOLVED]Ship editing question from a beginner

Post by BigGreenThugs » Mon, 21. Sep 20, 21:55

I posted this in the XML Patch Tutorial as well.
I was able to ask the question in the unofficial discord and got an answer pretty swiftly.
The answer is quoted below. All credit to UniTrader for answering the question.

@BigGreenThugs you can only replace the full content of an attribute

Code: Select all

<replace sel="//connection[@name='con_weapon_005']/@tags">weapon small standard mining missile platformcollision symmetry symmetry_right symmetry_top</replace>
So the full change looks like:

Code: Select all

<?xml version="1.0" encoding="utf-8"?>
<diff> 
    <replace sel="//connection[@name='con_weapon_005']/@tags">weapon small standard missile mining platformcollision symmetry symmetry_right symmetry_top</replace>
    <replace sel="//connection[@name='con_weapon_006']/@tags">weapon small standard missile mining platformcollision symmetry symmetry_left symmetry_top</replace>
</diff>

Post Reply

Return to “X4: Foundations - Scripts and Modding”