Odd MD script error on save/load

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

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

Mysterial
Posts: 665
Joined: Wed, 6. Nov 02, 20:31
x4

Odd MD script error on save/load

Post by Mysterial »

I have an MD script like so:

Code: Select all

<mdscript name="HijackedFleets" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="md.xsd">
  <cues>
    <library name="FactionHijackedFleet">
      <params>
        <param name="Faction" comment="the faction we're working with"/>
        <param name="IsShipyardFleet" comment="true - use shipyards; false - use wharfs"/>
      </params>
      <cues>
        ...
      </cues>
    </library>
    <cue name="ArgonHijackersLarge" ref="FactionHijackedFleet">
      <param name="Faction" value="faction.argon"/>
      <param name="IsShipyardFleet" value="true"/>
    </cue>
    <cue name="ArgonHijackersSmall" ref="FactionHijackedFleet">
      <param name="Faction" value="faction.argon"/>
      <param name="IsShipyardFleet" value="false"/>
    </cue>
    <cue name="ParanidHijackersLarge" ref="FactionHijackedFleet">
      <param name="Faction" value="faction.paranid"/>
      <param name="IsShipyardFleet" value="true"/>
    </cue>
    <cue name="ParanidHijackersSmall" ref="FactionHijackedFleet">
      <param name="Faction" value="faction.paranid"/>
      <param name="IsShipyardFleet" value="false"/>
    </cue>
    <cue name="TeladiHijackersLarge" ref="FactionHijackedFleet">
      <param name="Faction" value="faction.teladi"/>
      <param name="IsShipyardFleet" value="true"/>
    </cue>
    <cue name="TeladiHijackersSmall" ref="FactionHijackedFleet">
      <param name="Faction" value="faction.teladi"/>
      <param name="IsShipyardFleet" value="false"/>
    </cue>
  </cues>
</mdscript>
This script runs fine and the various library instances work as intended when run completely in a single game instance. There are no errors in the debug log (aside from the usual signature stuff, of course)

However, when I save the game and reload it, I get these errors:

Code: Select all

[=ERROR=] 13799.51 Error on MD script import: Root cue 'ArgonHijackersLarge' with temp ID 238299 in script 'HijackedFleets' has invalid attribute(s)
[General] 13799.51 ======================================
[General] 13799.51 ======================================
[=ERROR=] 13799.51 Error on MD script import: Root cue 'ArgonHijackersSmall' with temp ID 238300 in script 'HijackedFleets' has invalid attribute(s)
[General] 13799.51 ======================================
[General] 13799.51 ======================================
[=ERROR=] 13799.51 Error on MD script import: Root cue 'ParanidHijackersLarge' with temp ID 238301 in script 'HijackedFleets' has invalid attribute(s)
[General] 13799.51 ======================================
[General] 13799.51 ======================================
[=ERROR=] 13799.51 Error on MD script import: Root cue 'ParanidHijackersSmall' with temp ID 238302 in script 'HijackedFleets' has invalid attribute(s)
[General] 13799.51 ======================================
[General] 13799.51 ======================================
[=ERROR=] 13799.51 Error on MD script import: Root cue 'TeladiHijackersLarge' with temp ID 238303 in script 'HijackedFleets' has invalid attribute(s)
[General] 13799.51 ======================================
[General] 13799.51 ======================================
[=ERROR=] 13799.51 Error on MD script import: Root cue 'TeladiHijackersSmall' with temp ID 238304 in script 'HijackedFleets' has invalid attribute(s)
[General] 13799.51 ======================================
[General] 13799.51 ======================================
[=ERROR=] 13799.51 Error on MD script import (2): No cue of temp ID 238299
[General] 13799.51 ======================================
[General] 13799.51 ======================================
[=ERROR=] 13799.51 Error on MD script import (2): No cue of temp ID 238300
[General] 13799.51 ======================================
[General] 13799.51 ======================================
[=ERROR=] 13799.51 Error on MD script import (2): No cue of temp ID 238301
[General] 13799.51 ======================================
[General] 13799.51 ======================================
[=ERROR=] 13799.51 Error on MD script import (2): No cue of temp ID 238302
[General] 13799.51 ======================================
[General] 13799.51 ======================================
[=ERROR=] 13799.51 Error on MD script import (2): No cue of temp ID 238303
[General] 13799.51 ======================================
[General] 13799.51 ======================================
[=ERROR=] 13799.51 Error on MD script import (2): No cue of temp ID 238304
[General] 13799.51 ======================================
Unsurprisingly, the cues are all recreated, so if subcues were in progress in the save all their stuff is left in whatever state it was forever. But again, if I let the entire script run without reloading, it'll work fine.

I even tried starting a new game, saving, then immediately loading. Same errors as above.

There's no indication of what "invalid attributes" there are and since the script runs fine if I don't save and reload, I don't know what to look for. Anyone have any ideas of what might be wrong or what I can try?
7ate9tin11s
Posts: 813
Joined: Fri, 11. Nov 05, 23:18
x4

Re: Odd MD script error on save/load

Post by 7ate9tin11s »

Just a thought (and probably wrong!), is it overloading the cue on game start due to it not being instantiated, thus passing in lists/groups of parameters?
morbideth
Posts: 391
Joined: Sun, 9. Nov 08, 03:07
x3tc

Re: Odd MD script error on save/load

Post by morbideth »

I'm no expert on MD scripts, but I do know that it saves the cue state when you save a game. And none of your cues are resetting. They are all saved as complete, that means they will not run a 2nd time. You cut out whatever conditions you have to trigger your cues, so I can't be sure what is going on.
Mysterial
Posts: 665
Joined: Wed, 6. Nov 02, 20:31
x4

Re: Odd MD script error on save/load

Post by Mysterial »

7ate9tin11s wrote: Thu, 3. Jan 19, 23:45 Just a thought (and probably wrong!), is it overloading the cue on game start due to it not being instantiated, thus passing in lists/groups of parameters?
I don't think it's due to instantiation - some vanilla MD scripts have top level cues that don't instantiate - but that did make me wonder if there might be an issue with library refs at top level. So I encapsulated the cues using the library inside another cue, like this:

Code: Select all

    <cue name="Container">
      <cues>
        <cue name="ArgonHijackersLarge" ref="FactionHijackedFleet">
          <param name="Faction" value="faction.argon"/>
          <param name="IsShipyardFleet" value="true"/>
        </cue>
        <cue name="ArgonHijackersSmall" ref="FactionHijackedFleet">
          <param name="Faction" value="faction.argon"/>
          <param name="IsShipyardFleet" value="false"/>
        </cue>
        <cue name="ParanidHijackersLarge" ref="FactionHijackedFleet">
          <param name="Faction" value="faction.paranid"/>
          <param name="IsShipyardFleet" value="true"/>
        </cue>
        <cue name="ParanidHijackersSmall" ref="FactionHijackedFleet">
          <param name="Faction" value="faction.paranid"/>
          <param name="IsShipyardFleet" value="false"/>
        </cue>
        <cue name="TeladiHijackersLarge" ref="FactionHijackedFleet">
          <param name="Faction" value="faction.teladi"/>
          <param name="IsShipyardFleet" value="true"/>
        </cue>
        <cue name="TeladiHijackersSmall" ref="FactionHijackedFleet">
          <param name="Faction" value="faction.teladi"/>
          <param name="IsShipyardFleet" value="false"/>
        </cue>
      </cues>
    </cue>
That seems to have resolved the issue. I no longer get the error message (existing savegames do but after a save/load cycle they stop complaining) and I need to do more testing to be sure but the script definitely still runs and appears to save/load correctly now.

@morbideth: Thanks, but you actually read the issue backwards :) - the symptoms weren't that the cue state was being saved, but rather the opposite - every time I loaded my savegame it'd blow away the existing state and start over, as if I had reset the cues. Rereading my post I can see how it could be misread that way, so sorry about that.

Return to “X4: Foundations - Scripts and Modding”