Ein Schiff in der Staffel führt standardmäßig move.follow aus. Es folgt mir also ständig.
Besser für Handelsschiffe wäre move.patrol oder move.idle, statt move.follow, finde ich.
Ich wollte das also ändern.
Fakten:
add_to_player_squad ist die einzige Möglichkeit, ein Schiff in meine Staffel und somit ins Handelsmenü zu bringen.
add_to_player_squad ruft player.default auf.
player.default führt move.follow aus.
abort_scripts kann player.default (inkl. move.follow) beenden, ohne das Shiff aus der Staffel zu entfernen.
start_script kann player.default wieder starten.
Lösung:
player.default erhält einen Parameter $wait, dessen Wert bestimmt, ob move.follow oder move.patrol gestartet wird.
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<diff xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<!--
The default command for ships in squad is command.follow. The following adds changes this default command to command.patrol, so
the pilot will not go out of his actual zone. He patrol the zone without searching for enemies.
Optional the variable $wait kann set to 0 when call the script. That will activate command.follow
-->
<add sel="/aiscript/params">
<param name="wait" default="1" />
</add>
<replace sel="/aiscript/attention/actions/do_if[@value='this.ship.commander']">
<!-- move.patrol or move.follow player. End if is not in squad -->
<do_if value="this.ship.commander" exact="player.primaryship">
<do_if value="$wait == 1">
<show_notification caption="'new command'" timeout="5s" details="'Wait there ! ... confirmed, sir'" queued="true"/>
<set_command command="command.patrol" />
<run_script name="'move.patrol'">
<param name="range" value="'zone'" />
<param name="engageenemies" value="false" />
</run_script>
</do_if>
<do_else>
<show_notification caption="'new command'" timeout="5s" details="'Follow the Skunk ! ... confirmed, sir'" queued="true"/>
<run_script name="'move.follow'">
<param name="target" value="player.primaryship" />
</run_script>
</do_else>
</do_if>
</replace>
</diff>
md/Orders.xml
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<!--
The orders submenu will be extended by this changes. The option "wait"/"follow" is placed on top left of the submenu.
-->
<diff xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<add sel="/mdscript/cues/cue/actions/do_if/add_player_choice_return[@text='{1002,20}']" pos="before">
<do_if value="event.object.command.value != command.patrol">
<add_player_choice_sub text="{1004,31}" section="gOrders_wait" position="top_right" choiceparam="[event.object.ship]" comment="wait"/>
</do_if>
<do_else>
<add_player_choice_sub text="{1004,7}" section="gOrders_follow" position="top_right" choiceparam="[event.object.ship]" comment="follow"/>
</do_else>
</add>
<add sel="/mdscript/cues/cue/actions">
<do_elseif value="event.param == 'gOrders_wait'">
<!--remove_from_player_squad object="event.param2.{1}" />
<set_value name="event.param2.{1}.commander" exact="player.primaryship" /-->
<abort_scripts entity="event.object" />
<start_script name="'player.default'" object="event.object">
<param name="wait" value="1" />
</start_script>
<show_notification caption="'new command'" timeout="5s" details="'Wait there ! ... '" queued="true"/>
</do_elseif>
<do_elseif value="event.param == 'gOrders_follow'">
<!--remove_from_player_squad object="event.param2.{1}" />
<set_value name="event.param2.{1}.commander" exact="player.primaryship" /-->
<abort_scripts entity="event.object" />
<start_script name="'player.default'" object="event.object">
<param name="wait" value="0" />
</start_script>
<show_notification caption="'new command'" timeout="5s" details="'Follow the Skunk ! ... '" queued="true"/>
</do_elseif>
</add>
</diff>
md/NPC_Staff.xml
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<diff xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<!--
The Main Menu offers on position "left" the orders submenu. Is the pilots command.patrol activ, the orders submenu is not available.
This following replacements activate the orders submenu for pilots on patrol too.
-->
<replace sel="/mdscript/cues/cue/cues/cue[@name='DefaultComm']/actions/do_else/do_if[@value='$actor.type == entitytype.pilot or $actor.type == entitytype.commander']/do_if/do_elseif[@value='$actor.ship.commander == player.primaryship']/do_if/@value">(event.object.command.value == command.follow) or (event.object.command.value == command.support) or (event.object.command.value == command.patrol)</replace>
<replace sel="/mdscript/cues/cue/cues/cue[@name='DefaultComm']/actions/do_else/do_if[@value='$actor.type == entitytype.pilot or $actor.type == entitytype.commander']/do_if/do_elseif[@value='$actor.ship.commander == player.primaryship']/do_if/add_player_choice_sub/@selectable">(not @event.object.$shiptrader_docking) and (not @event.object.$ship_parking) and (not event.object.ship.dockslot) and (not event.object.ship.docklink) and ((event.object.command.value == command.follow) or (event.object.command.value == command.patrol))</replace>
</diff>
Eigentlich muss ich noch herauskriegen, wodurch md/Conversations.xml angesprochen wird, denn da gibt es auch entsprechende Menü-Punkte.