[WIP-MOD] PHQ in another sector

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

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

jmattspartacus2
Posts: 73
Joined: Wed, 5. Dec 18, 07:04

[WIP-MOD] PHQ in another sector

Post by jmattspartacus2 »

I managed to reverse engineer a way to find the name of the sector using one of my saves, this should (if it works as intended) make the PHQ appear in The Reach when it is created

https://www.nexusmods.com/x4foundations/mods/59/

And if you don't like nexus, here's the git

https://github.com/jmattspartacus/X4-Mod-PHQ-Location

Enjoy, and let me know if you have any problems.

Edit: When I originally released I didn't test it enough, but it is functioning now!
Edit: Now it seems to be randomly choosing a sector...
Last edited by jmattspartacus2 on Sun, 9. Dec 18, 22:56, edited 4 times in total.
BoostHungry
Posts: 122
Joined: Sat, 23. Nov 13, 20:33

Re: [MOD] PHQ in another sector (for now just Nopileous Fortune VI)

Post by BoostHungry »

Did you copy the entire file and then just change the location?
https://github.com/jmattspartacus/X4-Mo ... iption.xml

That seems dangerous if the devs change something here and you don't update it. You should consider patching the file and only changing the location which looks like just two clean lines that can be replaced easily.
Barons
Posts: 50
Joined: Wed, 13. Aug 14, 04:20
x4

Re: [MOD] PHQ in another sector (for now just Nopileous Fortune VI)

Post by Barons »

+1

I'd love to be able to choose which system the phq goes in by default.
jmattspartacus2
Posts: 73
Joined: Wed, 5. Dec 18, 07:04

Re: [MOD] PHQ in another sector (for now just Nopileous Fortune VI)

Post by jmattspartacus2 »

I should edit this and say that they patched it and it broke literally on the next build, (to be fair I also didn't test more than once and I seem to have gotten lucky because I can't recreate it functioning) I'm trying to fix it using patches, but having a bit of trouble getting the patch to point at the right place in the xml file (I've not done a ton of modding in the past and have fairly limited programming experience) if any of you can point me in the right direction I'll upload a version that uses patches.

Code: Select all

<diff> 
	<replace sel="/mdscript/cues/cue/actions/find_sector[@macro="macro.cluster_01_sector001_macro"]">
		<find_sector name="$HQSector" macro="macro.cluster_04_Sector002_macro"/>
	</replace>
</diff>
Is my 3rd or so attempt, I've been reading the documentation some on patching, but maybe this can't be touched with a mod for some reason...

The original code has a form like this below, so I think I have everything else except the last part of the patching right, if anyone can give me advice on fixing this, or wants to post a fix, I'll put it in the mod.

Code: Select all

<mdscript name="X4Ep1_Mentor_Subscriptions" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="md.xsd">
  <cues>

    <cue name="Start" namespace="this" version="4">
      <conditions>
        <event_cue_signalled cue="md.Setup.Start" />
      </conditions>
      <actions>
        <set_value name="$DebugChance" exact="0"/>

        <!--data used for thread missions relating to md.MC_Management.Thread_Manager-->
        <set_value name="$ThreadOffers" exact="[]"/>
        <set_value name="$ThreadDefinitions" exact="table[]"/>
        <set_value name="$ActiveThreads" exact="[]" comment="List of active instanced thread cues of md.MC_Management.Thread_Manager"/>

        <!--data used for non-thread missions which reference the GM definitions directly-->
        <set_value name="$MissionOffers" exact="[]"/>
        <set_value name="$ActiveMissions" exact="[]" comment="List of active non-thread missions"/>
        <set_value name="$MissionDefinitions" exact="table[]"/>

        <set_value name="$Page" exact="30201" comment="Mentor Mission page"/>
        <set_value name="$MissionGroup" exact="missiongroup.mentor_plot"/>
        <set_value name="$CurrentPhase" exact="null"/>
        <set_value name="$PreviousPhase" exact="null"/>

        <find_sector name="$HQSector" macro="macro.cluster_01_sector001_macro"/>
jmattspartacus2
Posts: 73
Joined: Wed, 5. Dec 18, 07:04

Re: [MOD] PHQ in another sector (for now just Nopileous Fortune VI)

Post by jmattspartacus2 »

I have it working, but it seems to be randomly selecting a sector for whatever reason. I'm gonna put it down and just enjoy playing for a day or two and come back to it.

Return to “X4: Foundations - Scripts and Modding”