[Question] SETA-related events in MD

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

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

Post Reply
ns88ns
Posts: 90
Joined: Sun, 11. Sep 11, 22:00
x4

[Question] SETA-related events in MD

Post by ns88ns » Wed, 6. Nov 19, 09:13

Hi, community and scripting experts.

I would like to perform some actions via a Mission Director script when SETA is activated/deactivated. I checked all X4 built-in scripts as weel as all *.XSD but there are no any SETA-related events. Is there a way to capture them in MD?

Thank you.

jan12342203
Posts: 65
Joined: Sat, 14. May 16, 22:13
x4

Re: [Question] SETA-related events in MD

Post by jan12342203 » Wed, 6. Nov 19, 10:20

i think you can do it like this:

but this will fire every second... as long as SETA is active

Code: Select all

    <cue name="JP_TestMod_MD" instantiate="true" checkinterval="1s">
      <conditions>
        <check_value value="player.timewarp.active"/>
      </conditions>
      <actions>
        <show_help custom="'TEST'" duration="1s"/>
      </actions>
    </cue>
    

SirNukes
Posts: 546
Joined: Sat, 31. Mar 07, 23:44
x4

Re: [Question] SETA-related events in MD

Post by SirNukes » Wed, 6. Nov 19, 18:35

At a glance, it looks like there are "setaActivated" and "setaDeactivated" events available in lua. See "Crosshair Handling.lua" for code that listens to these events. If you can hook into that, then you can set up the signals for md cues.

Xenon_Slayer
EGOSOFT
EGOSOFT
Posts: 13093
Joined: Sat, 9. Nov 02, 11:45
x4

Re: [Question] SETA-related events in MD

Post by Xenon_Slayer » Wed, 6. Nov 19, 20:37

There's not an event and no, you can't hook into that UI event from MD unless you want to try modding a new UI event.
As it's a simple enough check, just having a cue check every frame if the 'player.timewarp.active' value has changed is probably good enough.

Code: Select all

<cue name="SETA_Toggled" instantiate="true" checkinterval="1ms">
  <conditions>
    <check_value value="not $SETA_Active? or player.timewarp.active != $SETA_Active"/>
  </conditions>
  <actions>
    <set_value name="$SETA_Active" exact="player.timewarp.active" comment="Save the new state"/>
    <do_if value="$SETA_Active">
      <signal_cue cue="SETA_Activated" comment="Signal the cue which deals with activating SETA"/>
    </do_if>
  </actions>
</cue>

<cue name="SETA_Activated" instantiate="true">
  <conditions>
    <event_cue_signalled/>
  </conditions>
  <actions>
    <debug_text text="'SETA was activated'"/>
  </actions>
</cue>
Come watch me on Twitch where I occasionally play several of the X games

teleportationwars
Posts: 158
Joined: Fri, 12. Jul 19, 14:03

Re: [Question] SETA-related events in MD

Post by teleportationwars » Wed, 6. Nov 19, 22:13

Xenon_Slayer wrote:
Wed, 6. Nov 19, 20:37
There's not an event and no, you can't hook into that UI event from MD unless you want to try modding a new UI event.
As it's a simple enough check, just having a cue check every frame if the 'player.timewarp.active' value has changed is probably good enough.

Code: Select all

<cue name="SETA_Toggled" instantiate="true" checkinterval="1ms">
  <conditions>
    <check_value value="not $SETA_Active? or player.timewarp.active != $SETA_Active"/>
  </conditions>
  <actions>
    <set_value name="$SETA_Active" exact="player.timewarp.active" comment="Save the new state"/>
    <do_if value="$SETA_Active">
      <signal_cue cue="SETA_Activated" comment="Signal the cue which deals with activating SETA"/>
    </do_if>
  </actions>
</cue>

<cue name="SETA_Activated" instantiate="true">
  <conditions>
    <event_cue_signalled/>
  </conditions>
  <actions>
    <debug_text text="'SETA was activated'"/>
  </actions>
</cue>
If you were going to check on an interval then I think 1ms is a bad idea but vanilla gets it this way:

Code: Select all

    
    <cue name="Mode_SETA" instantiate="true">
      <conditions>
        <event_object_signalled object="player.entity" param="'startactivity'" param2="activity.seta" />
      </conditions>

Xenon_Slayer
EGOSOFT
EGOSOFT
Posts: 13093
Joined: Sat, 9. Nov 02, 11:45
x4

Re: [Question] SETA-related events in MD

Post by Xenon_Slayer » Thu, 7. Nov 19, 00:42

Right, I forgot this is an activity now.

As for 1ms checks, that essentially just means check each frame because you ain't gonna have the game running in less that 1ms. And it's a simple call to make for one frame.
Come watch me on Twitch where I occasionally play several of the X games

ns88ns
Posts: 90
Joined: Sun, 11. Sep 11, 22:00
x4

Re: [Question] SETA-related events in MD

Post by ns88ns » Thu, 7. Nov 19, 14:45

Yes, I found this in built-in scripts:
<event_object_signalled object="player.entity" param="'stoptactivity'" param2="activity.seta" />
to catch deactivation of SETA. But is there a way to get reason on deactivation? I mean is there a way to know whether SETA was disabled by player or by side-event like notification ans something else?

Post Reply

Return to “X4: Foundations - Scripts and Modding”