Changing/removing gate connections issue.

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

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

Random_Tank
Posts: 15
Joined: Sat, 13. Feb 16, 19:56
x3tc

Changing/removing gate connections issue.

Post by Random_Tank » Wed, 22. May 24, 00:19

I've been editing the Farnham's Legend sector mod to edit the connections a little to my liking (namely changing the gate connection from Silent Witness 1 to Windfall 1 to connect to Farnham's instead, and not have the Windfall 3 connection it comes with default) but even carbon copying the code and just editing it to the correct numbers it just won't work, it won't remove the existing connection, nor add the new one. The xml I have doing it is this:

Code: Select all

<?xml version="1.0" encoding="utf-8"?>
<diff>

  <!--Remove Gate Connection from Windfall I Union Summit to Silent Witness I-->
  <remove sel="//macros/macro[@name='XU_EP2_universe_macro']/connections/connection[@name='ClusterGate501To008']"/>

  <!--Add Gate connection from Farnham's Legend to Windfall I Union Summit Jumpgate-->
  <add sel="//macros/macro[@name='XU_EP2_universe_macro']/connections">
    <connection name="ClusterGateMFL01To501" ref="destination" path="../Cluster_Mod_FarnhamLegend_01_connection/Cluster_Mod_FarnhamLegend_01_Sector001_connection/Zone006_Cluster_Mod_FarnhamLegend_01_Sector001_connection/connection_ClusterGateMFL01To501">
      <macro connection="destination" path="../../../../../Cluster_501_connection/Cluster_501_Sector001_connection/Zone002_Cluster_501_Sector001_connection/connection_ClusterGate501To008" />
    </connection>
  </add>
</diff>
I thought it's because it's mid-save it might not be working, but the same code to remove the Silent Witness > Hatikvah's Choice connection which Farnham's sits between works absolutely fine mid-save, and another sector mod I have (icon sector) that sits between Argon Prime and Second Contact Flashpoint that does the same thing using the same lines of code also works fine too... but I noticed another sector mod I have that adds extra sectors between Zyarth's Dominion and Fires of Defeat fails to remove the connection between Fires and Two Grand (as it tries to put a new sector, Split Fire, between them), and that uses the same line of code yet again, so it seems there might be an issue with DLC sectors? Does something different need to be done with them? Or have I done something wrong? Both mods are after the DLCs alphabetically, so it shouldn't be a load order issue.... help?

sprIder
Posts: 96
Joined: Sat, 3. Jul 10, 23:23
x4

Re: Changing/removing gate connections issue.

Post by sprIder » Wed, 22. May 24, 19:13

Hi,

Do I understand correctly, you want to remove the connections between
a) Silent Witness I to Windfall I &
b) Farnham's Legend V to Windfall III
and you want to add a connection from Windfall I to Farnham's Legend V?

1. Did you set a dependency to the Farnham's Legend mod in your content.xml? The alphabetical order doesn't do anything.

Code: Select all

<dependency name="Sector Farnham's Legend" id="ws_2929776994" optional="false"/>
"ws_2929776994" is the mod id from steam, the most important part. Put this right before the closing "</content>" (I hope, this is the correct mod!)
You can find the ids in the corresponding content.xml of the mods and DLCs in their first line.

1a. The dependency on the pirate DLC wouldn't hurt either.

Code: Select all

<dependency name="Tides of Avarice" id="ego_dlc_pirate" optional="false" />
Since it is an official DLC, it doesn't have a "ws_*" steam number.

2. I think you forgot to remove the second gate connection, the "Gate connection from Farnham's Legend to Windfall III The Hoard Jumpgate".

3. If you want to reuse the gates, you should refer to them. You can name your new connection "ClusterGateMFL01To501" but you have to use the gate of connection_ClusterGateMFL01To502.

All in all, your galaxy.xml:
Spoiler
Show

Code: Select all

<?xml version="1.0" encoding="utf-8"?>
<diff>
  <!--Remove Gate Connection from Windfall I Union Summit to Silent Witness I-->
  <remove sel="//macros/macro[@name='XU_EP2_universe_macro']/connections/connection[@name='ClusterGate501To008']"/>
  
  <!--Remove Gate connection from Farnham's Legend to Windfall III The Hoard Jumpgate-->
  <remove sel="//macros/macro[@name='XU_EP2_universe_macro']/connections/connection[@name='ClusterGateMFL01To502']"/>

  <!--Add Gate connection from Farnham's Legend to Windfall I Union Summit Jumpgate-->
  <!-- Reusing gates connection_ClusterGateMFL01To502 and  connection_ClusterGate501To008 -->
  <add sel="//macros/macro[@name='XU_EP2_universe_macro']/connections">
    <connection name="ClusterGateMFL01To501" ref="destination" path="../Cluster_Mod_FarnhamLegend_01_connection/Cluster_Mod_FarnhamLegend_01_Sector001_connection/Zone006_Cluster_Mod_FarnhamLegend_01_Sector001_connection/connection_ClusterGateMFL01To502">
      <macro connection="destination" path="../../../../../Cluster_501_connection/Cluster_501_Sector001_connection/Zone002_Cluster_501_Sector001_connection/connection_ClusterGate501To008" />
    </connection>
  </add>
 </diff>
I hope, this helps.

Random_Tank
Posts: 15
Joined: Sat, 13. Feb 16, 19:56
x3tc

Re: Changing/removing gate connections issue.

Post by Random_Tank » Thu, 23. May 24, 00:27

sprIder wrote:
Wed, 22. May 24, 19:13
Hi,

Do I understand correctly, you want to remove the connections between
a) Silent Witness I to Windfall I &
b) Farnham's Legend V to Windfall III
and you want to add a connection from Windfall I to Farnham's Legend V?

1. Did you set a dependency to the Farnham's Legend mod in your content.xml? The alphabetical order doesn't do anything.
You are absolutely correct on what I'm aiming to do, but I wasn't making a mod for Farnham's Legend, more directly editing the files in the existing mod (just for personal use), would you suggest not doing that?
I had already added the dependancy for the pirate dlc in content, and flat out removed the gate in windfall 3 that this mod adds, and edited its existing connection in zones to this:

Code: Select all

  <!--Windfall I Union Summit Gate-->
  <macro name="Zone006_Cluster_Mod_FarnhamLegend_01_Sector001_macro" class="zone">
    <component ref="standardzone" />
    <connections>
      <connection name="connection_ClusterGateMFL01To501" ref="gates">
        <offset>
          <position x="-41242.138671875" y="0" z="-40647.4609375" />
          <quaternion qx="0" qy="-0.2164397687" qz="0" qw="0.9762960076" />
        </offset>
        <macro ref="props_gates_anc_gate_macro" connection="space" />
      </connection>
    </connections>
  </macro>
Is it something to do with the co-ordinates? I had assumed they were for the the gate in Farnham's Legend V so didn't need to be edited (as the gate is unchanged. just the connection).

Also one thing I've realised, I'd forgotten to add entries to the index file, would that break it?

Many thanks for your help!

sprIder
Posts: 96
Joined: Sat, 3. Jul 10, 23:23
x4

Re: Changing/removing gate connections issue.

Post by sprIder » Thu, 23. May 24, 18:58

Random_Tank wrote:
Thu, 23. May 24, 00:27
You are absolutely correct on what I'm aiming to do, but I wasn't making a mod for Farnham's Legend, more directly editing the files in the existing mod (just for personal use), would you suggest not doing that?
Ok, good to know. Yes, I suggest not doing that with mods which can get auto-updates. Like all mods from the Steam Workshop. With an update, you will very probably (almost certainly) lose all your changes. Probably not because the content/code has changed, but simply because the files are overwritten.
You could prevent this by either modifying the other with your own mod. Or you change the ID of the Steam mod in its content.xml and unsubscribe it in the workshop. But then, of course, you will no longer receive updates. Not recommended!

However, there are also examples where it makes sense to change things in the mod directly. E.g. FOCW, which contains a file that you should customize for your own needs. However, this is also a mod that does not receive updates automatically.
[...] and flat out removed the gate in windfall 3
It would be more sustainable to simply comment it out, so that the game no longer reads/processes it. With "<!--" and "-->". Just like

Code: Select all

<!--Windfall I Union Summit Gate-->
[...] and edited its existing connection in zones to this:
Ok. That should work.
Also one thing I've realised, I'd forgotten to add entries to the index file, would that break it?
Yes, you have to add the macro to the index file, this breaks it.
Is it something to do with the co-ordinates?
Nope.

Question: Have you actually removed the .cat and .dat files from the mod folder? These would overwrite the unpacked files.

For the future, I recommend that you have a debug log created by the game if you want to continue modding. This can help you and others: viewtopic.php?f=181&t=402452#p4768514

Random_Tank
Posts: 15
Joined: Sat, 13. Feb 16, 19:56
x3tc

Re: Changing/removing gate connections issue.

Post by Random_Tank » Fri, 24. May 24, 03:35

sprIder wrote:
Thu, 23. May 24, 18:58
Ok, good to know. Yes, I suggest not doing that with mods which can get auto-updates.
Ah, this is just a nexus download, so no worries there.
sprIder wrote:
Thu, 23. May 24, 18:58
Question: Have you actually removed the .cat and .dat files from the mod folder? These would overwrite the unpacked files.
The mod never came packaged as one, just straight files, so I know it's not that.
sprIder wrote:
Thu, 23. May 24, 18:58
It would be more sustainable to simply comment it out, so that the game no longer reads/processes it. With "<!--" and "-->". Just like
The gate addition was in a seperate file by itself (in a sub folder, extensions>ego_dlc_pirate>etc) so I just deleted it, and was only referenced in that connection I posted earlier, which I just changed to 501, the windfall 1 gate.
sprIder wrote:
Thu, 23. May 24, 18:58
Yes, you have to add the macro to the index file, this breaks it.
On checking, it seems nothing I've changed creates a new macro, it's just using the existing mod ones which are already in the index, so as far as I can tell I don't actually need to do anything there.

I dunno what I did though, but on the latest restart, the Farnham's to Windfall connection works... but it hasn't deleted the Windfall to Silent Witness connection, so the Windfall gate now leads 2 places (though it always sends you to SW if you fly through it, you can just fly to it from SW and FL). On starting a new game it works as intended (no connection between Windfall and SW). This is the exact same issue I had with the ZYA/FAF/ARG sector mod I downloaded that puts Split Fire between Two Grand and Fires of Defeat, on existing savegame it doesn't delete the old connection, new one it does. This is even more frustrating, as if you look at the full galaxy file for the Farnham's mod:

Code: Select all

<?xml version="1.0" encoding="utf-8"?>

<!--Galaxy-->
<diff>
  <!--Add Farnham's Legend Cluster to the standard universe-->
  <add sel="/macros/macro[@name='XU_EP2_universe_macro']/connections">
    <connection name="Cluster_Mod_FarnhamLegend_01_connection" ref="clusters">
      <offset>
        <position x="-15000000" y="0" z="43300000" />
      </offset>
      <macro ref="Cluster_Mod_FarnhamLegend_01_macro" connection="galaxy" />
    </connection>
  </add>

  <!--Remove Gate Connection from Hatikvah's Choice I to Silent Witness I-->
  <remove sel="//macros/macro[@name='XU_EP2_universe_macro']/connections/connection[@name='ClusterGate008To029']"/>

 <!--Remove Gate Connection from Windfall I Union Summit to Silent Witness I-->
  <remove sel="//macros/macro[@name='XU_EP2_universe_macro']/connections/connection[@name='ClusterGate501To008']"/>

  <!--Add Gate connection from Farnham's Legend to Silent Witness I-->
  <add sel="//macros/macro[@name='XU_EP2_universe_macro']/connections">
    <connection name="ClusterGateMFL01To008" ref="destination" path="../Cluster_Mod_FarnhamLegend_01_connection/Cluster_Mod_FarnhamLegend_01_Sector001_connection/Zone002_Cluster_Mod_FarnhamLegend_01_Sector001_connection/connection_ClusterGateMFL01To008">
      <macro connection="destination" path="../../../../../Cluster_08_connection/Cluster_08_Sector001_connection/Zone004_Cluster_08_Sector001_connection/connection_ClusterGate008To029" />
    </connection>
  </add>

  <!--Add Gate connection from Farnham's Legend to Hatikvah's Choice I-->
  <add sel="//macros/macro[@name='XU_EP2_universe_macro']/connections">
    <connection name="ClusterGateMFL01To029" ref="destination" path="../Cluster_Mod_FarnhamLegend_01_connection/Cluster_Mod_FarnhamLegend_01_Sector001_connection/Zone003_Cluster_Mod_FarnhamLegend_01_Sector001_connection/connection_ClusterGateMFL01To029">
      <macro connection="destination" path="../../../../../Cluster_29_connection/Cluster_29_Sector001_connection/Zone002_Cluster_29_Sector001_connection/connection_ClusterGate029To008" />
    </connection>
  </add>

  <!--Add Gate connection from Farnham's Legend to Windfall I Union Summit Jumpgate-->
  <add sel="//macros/macro[@name='XU_EP2_universe_macro']/connections">
    <connection name="ClusterGateMFL01To501" ref="destination" path="../Cluster_Mod_FarnhamLegend_01_connection/Cluster_Mod_FarnhamLegend_01_Sector001_connection/Zone006_Cluster_Mod_FarnhamLegend_01_Sector001_connection/connection_ClusterGateMFL01To501">
      <macro connection="destination" path="../../../../../Cluster_501_connection/Cluster_501_Sector001_connection/Zone002_Cluster_501_Sector001_connection/connection_ClusterGate501To008" />
    </connection>
  </add>

</diff>
The first connection removal works totally fine midsave to create the gap the new sector sits in, but my one just below it doesn't, only on fresh save... but they're the same? Is there an additional reference here I need to edit/remove?

sprIder
Posts: 96
Joined: Sat, 3. Jul 10, 23:23
x4

Re: Changing/removing gate connections issue.

Post by sprIder » Fri, 24. May 24, 19:08

I have now recreated and adapted everything as you have described here. And so far everything seems to be working.
Random_Tank wrote:
Fri, 24. May 24, 03:35
... but it hasn't deleted the Windfall to Silent Witness connection, so the Windfall gate now leads 2 places (though it always sends you to SW if you fly through it, you can just fly to it from SW and FL). On starting a new game it works as intended (no connection between Windfall and SW).
Interesting, I don't have this problem.
Have you checked whether it disappears when you save an existing game after your changes and then load the new savegame?

Random_Tank
Posts: 15
Joined: Sat, 13. Feb 16, 19:56
x3tc

Re: Changing/removing gate connections issue.

Post by Random_Tank » Sat, 25. May 24, 04:55

sprIder wrote:
Fri, 24. May 24, 19:08
Have you checked whether it disappears when you save an existing game after your changes and then load the new savegame?
I hadn't tried that up to this point, but having tried it now, that didn't work either unfotunately.

One thing I did try that was weird though; I created a new save with the mod disabled, saved but hadn't discover any of the modded sectors; I then added the mod, loaded the save and flew to windfall and it was working as intended... (only exception was the Silent Witness gate wasn't inactive, it looked active, but didn't lead anywhere, you could just fly through it), so it seems to be the issue in when the gate is discovered?

Very confusing, seems like there is not a good solution to this without just starting a new save; unless you know a safe way to delete the connection from my save? When I've attempted to try save editing before it breaks a lot of stuff (like sectors becoming undiscovered again, resetting all plots, and all military ships losing their commands, very broken).

Return to “X4: Foundations - Scripts and Modding”