resume on added label produces error

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

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

User avatar
Deadly_Shadow
Posts: 61
Joined: Thu, 13. May 04, 17:44
x3

resume on added label produces error

Post by Deadly_Shadow » Sat, 17. Jun 23, 22:06

Tried to disable the "order complete" notification if fly and wait is the default command with the following patch:

Code: Select all

<diff>
  <add sel='//aiscript[@name="order.move.wait"]/attention/actions/do_if/run_script[@name="&apos;player.interaction&apos;"]' pos="before">
    <do_if value="this.assignedcontrolled.defaultorder.id == 'MoveWait'">
      <resume label="zDS_skip_play_notification" />
    </do_if>
  </add>
  <add sel='//aiscript[@name="order.move.wait"]/attention/actions/do_if/run_script[@name="&apos;player.interaction&apos;"]' pos="after">
    <label name="zDS_skip_play_notification" />
  </add>
</diff>
for the script "order.move.wait.xml":

Code: Select all

<aiscript name="order.move.wait" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="aiscripts.xsd" version="6">
...
  <attention min="unknown">
...
    <actions>
...
      <do_if value="this.isplayerowned and not this.isclass.computer and not this.assignedcontrolled.nextorder and (not this.assignedcontrolled.commander or (this.assignedcontrolled.commander == player.occupiedship)) and notification.npc_await_orders.active">
        <set_value name="$speakline" exact="10304" comment="Awaiting orders."/>
        <run_script name="'player.interaction'">
...
        </run_script>
      </do_if>
But the debug log then gives me the error:

Code: Select all

[gamestart: 10] - [Sat Jun 17 19:57:13 2023]: Error: Error in AI script order.move.wait on entity 0x21c6396: Trying to resume at non-existing label 'zDS_skip_play_notification'
Replacing the inserted nodes with logbook writes produces the expected result. So the selectors seem ok.
Somebody knows if there is a restriction on inserting labels via patch, or spots an error at my code?

Return to “X4: Foundations - Scripts and Modding”