Difference between <ship> and <component class="ship">

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

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

Post Reply
Varghammer
Posts: 2
Joined: Wed, 17. Feb 21, 14:59
x4

Difference between <ship> and <component class="ship">

Post by Varghammer » Sat, 3. Dec 22, 14:40

Hey everyone,

I want to analyze my savefiles and wonder what the difference between both tags is. Any idea?

Take care
Alex

User avatar
euclid
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 13298
Joined: Sun, 15. Feb 04, 20:12
x4

Re: Difference between <ship> and <component class="ship">

Post by euclid » Sat, 3. Dec 22, 15:38

Welcome Varghammer :-)

A ship can be a component of an object, like a station. For example:

Code: Select all

  <find_object_component name="$DockedShips" object="$Station" class="class.ship" docked="true" checkoperational="true" multiple="true" />
in which case it is "tagged" as a component. I hope that answers your question.

Cheers Euclid
"In any special doctrine of nature there can be only as much proper science as there is mathematics therein.”
- Immanuel Kant (1724-1804), Metaphysical Foundations of the Science of Nature, 4:470, 1786

Varghammer
Posts: 2
Joined: Wed, 17. Feb 21, 14:59
x4

Re: Difference between <ship> and <component class="ship">

Post by Varghammer » Sun, 4. Dec 22, 20:10

Hey, thank you for your answer! Given the structure and the numbers below, this would mean that there are nearly ten as much docked ships compared to free floating ones (935 vs. 8837)? Are OOS ships also saved as component? Kind of hard to get through the structure of the XML due to their size...

Code: Select all

<ship> (starting on line ~1800)
</ship>
... (935 ocurrences)
<ship>
</ship> (the last on line 254,434)
...
<connection connection="ships"> (starting at 269,669)
	<component class="ship_s" ...>
	</component>
	... (8837 ocurrences)
...

User avatar
euclid
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 13298
Joined: Sun, 15. Feb 04, 20:12
x4

Re: Difference between <ship> and <component class="ship">

Post by euclid » Sun, 4. Dec 22, 20:50

It's possible that more are docked than flying. And, no, OOS ships are not component of a system. You can check that by coding a short script that finds all ships docked and not docked using

Code: Select all

 <find_ship name="$dockedships" space="player.galaxy" docked="true" unit="false" multiple="true"/>
with docked set to false to get all flying ships. Also note that drones, boarding pods etc. are considered as ships. Setting unit to false excludes those in the search.

Cheers Euclid
"In any special doctrine of nature there can be only as much proper science as there is mathematics therein.”
- Immanuel Kant (1724-1804), Metaphysical Foundations of the Science of Nature, 4:470, 1786

Post Reply

Return to “X4: Foundations - Scripts and Modding”