Activating a inactive gate

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

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

00NightHunter00
Posts: 19
Joined: Wed, 8. Apr 20, 21:08
x4

Activating a inactive gate

Post by 00NightHunter00 »

How would you go about activating a inactive gate between 2 dlcs i turned off the gate between antigone and seg and want to use a md script to activate it is it possible?
sprIder
Posts: 135
Joined: Sat, 3. Jul 10, 23:23
x4

Re: Activating a inactive gate

Post by sprIder »

Yes, that is possible. We had this topic nearly a year ago: viewtopic.php?f=181&t=454245&p=5178735#p5178735.

So you need to know your gate macro and you have to define a condition. Almost anything is possible. Completed plot/story, research, a killed enemy. What ever. https://wiki.egosoft.com:1337/X%20Rebir ... Conditions (X:Rebirth MD is same as X4).
00NightHunter00
Posts: 19
Joined: Wed, 8. Apr 20, 21:08
x4

Re: Activating a inactive gate

Post by 00NightHunter00 »

sprIder wrote: Fri, 14. Jun 24, 14:14 Yes, that is possible. We had this topic nearly a year ago: viewtopic.php?f=181&t=454245&p=5178735#p5178735.

So you need to know your gate macro and you have to define a condition. Almost anything is possible. Completed plot/story, research, a killed enemy. What ever. https://wiki.egosoft.com:1337/X%20Rebir ... Conditions (X:Rebirth MD is same as X4).

Code: Select all

<?xml version="1.0" encoding="utf-8"?>
<mdscript name="GS_Xepocalypse" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <cues>
    <cue name="Start" namespace="this" >
      <conditions>
        <event_cue_signalled cue="md.Setup.Start" />
      </conditions>
      <actions>
        <debug_text text="'Starting Xepocalypse gamestart'"/>
      </actions>
    </cue>

    <cue name="xenonwar_States" namespace="this" version="1">
      <conditions>
        <event_universe_generated />
        <check_value value="player.galaxy.macro == macro.xu_ep2_universe_macro" comment="only in main-galaxy" />
      </conditions>
      <actions>
        <find_sector macro="macro.cluster_28_Sector001_macro" space="player.galaxy" name="$AntigoneSector" />
        <find_sector macro="macro.cluster_113_Sector001_macro" space="player.galaxy" extension="'ego_dlc_terran'" required="true" name="$SegarisSector" />


        <!-- 
        <find_highway name="$SoDHighways" space="$SoDSector" multiple="true" />
        <do_for_each name="$highway" in="$SoDHighways">
          <set_object_active object="$highway" activate="false" />
        </do_for_each>-->

        <!-- Find Gates -->
        <find_gate name="$AntigoneGates" multiple="true" space="$AntigoneSector" />
        <do_for_each name="$g" in="$AntigoneGates">
          <do_if value=" ($g.exit.exists) and ($g.exit.sector == $SegarisSector)">
            <set_value name="$Segaris_AntigoneGate" exact="$g.exit" />
            <set_value name="$Antigone_SegarisGate" exact="$g" />
          </do_if>
        </do_for_each>
        <remove_value name="$AntigoneGates" />
        <debug_text text="'Found Antigone Gates'" filter="savegame"/>

        <find_gate name="$SegarisGates" multiple="true" space="$SegarisSector" active="false" />
        <do_for_each name="$g" in="$SegarisGates">
          <do_if value=" ($g.exit.exists) and ($g.exit.sector == $AntigoneSector)">
            <set_value name="$Segaris_AntigoneGate" exact="$g" />
            <set_value name="$Antigone_SegarisGate" exact="$g.exit" />
          </do_if>
        </do_for_each>
        <remove_value name="$SegarisGates" />
        <debug_text text="'Found Segaris Gates'" filter="savegame"/>
      </actions>
      </cue>

      <cue name="Activate_Gate" version="1"><conditions>
        <check_any>
          <event_cue_completed cue="Start" />
          <event_cue_completed cue="Game_Loaded" />
        </check_any>
        <check_value value="player.galaxy.macro.ismacro.{macro.xu_ep2_universe_macro}" comment="only in main-galaxy" />
      </conditions>
      <delay exact="30s" comment="Give the game more than enough time to set up x4ep1_mentor_subscription" />
              <actions>
                <do_if value="$Segaris_AntigoneGate_S1?">
                  <destroy_object object="$Segaris_AntigoneGate_S1"/>
                </do_if>
                <create_object name="$Segaris_AntigoneGate_S1" sector="$Segaris_AntigoneGate.sector" macro="macro.landmarks_gen_gatestation_01_stage_01_macro" owner="faction.terran">
                  <position object="$Segaris_AntigoneGate" x="0m" y="0" z="0"/>
                  <rotation value="$Segaris_AntigoneGate.rotation"/>
                </create_object>
              </actions>
      </cue>

     </cues>
</mdscript>
this is what i have cant seem to get it to work im prob missing something simple
Realspace
Posts: 1638
Joined: Wed, 15. Nov 06, 10:21
x4

Re: Activating a inactive gate

Post by Realspace »

Not at the pc now so just an hint, did you see in the boron dlc's md? I added some more inactive gates that get opened at stages of the plot by simply replicating the scripts that are in setup_dlc_boron or boron_story, don't remember which one. You find the added md in my xrsge mod.

Return to “X4: Foundations - Scripts and Modding”