(bug) - partially resolved - Capital ships stuck at gates

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

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

Post Reply
Realspace
Posts: 1391
Joined: Wed, 15. Nov 06, 10:21
x4

(bug) - partially resolved - Capital ships stuck at gates

Post by Realspace » Thu, 18. Apr 24, 18:48

So, I've had this bug exploding with my mod XRSGE, which in last version makes sectors huge (35.000km) and adds SUPERhighways that connect 2 points inside the same sector (so NO sector001 to sector002, but sector001 to sector001).
While S and M ships use these new connections totally fine and fly everywhere, the L and XL ships sometimes get stuck at gate's entrance. This happens not only at new superhighways' gates, also at normal superhighways and gates/accelerators. But mostly at superhighways.

After various tests, the bug happens only with L/XL trade ships and miner ships. All patrols seem to cross fine. Also, this is identical for player's ships or other factions.
Player' ship (npc pilot), if commanded to go to a point beyond the connection's exit, flies normally and crosses the gates. If left alone calculating route for a trade (autotrade), it gets stuck.

After messing a lot with move.generic and move.gate I seem to have managed to partially resolve the issue by editing move.generic (and leaving move.gate alone)

I practically removed all the parts that exclude capital ships from highway usage (the script database seems not to differentiate between local highways and super highways). Capital ships won't use normal highways anyway, so I thought that maybe the engine considers my Sector001toSector001 superhighways as normal internal highways.
I also removed all the exclusions of capital ships from force steering.
This is the file:

Code: Select all

<?xml version="1.0" encoding="UTF-8"?> 
<diff>
	<!-- remove the part regarding big ships for short range travel (superhighways go in same sector now-->
		 <replace sel="//aiscript/patch[@sinceversion='10']"> 
		   <patch sinceversion="10" early="true">
			<set_value name="$uselocalhighways" exact="true"/>
			</patch>
		 	</replace>
	
	 <replace sel="/aiscript/order/params/param[@name='uselocalhighways']"> 
	          <param name="uselocalhighways" default="true" type="internal" comment="Allow usage of local highways as appropriate. Note that L and XL ships will still not use local highways. Do not set to false when destination is a local highway or in a local highway.">
        <!--DISABLED: patch value="not this.ship.iscapitalship" sinceversion="10" early="true"/-->
      </param>
	</replace>
	
		 <add sel="//aiscript/order/params"> 
	          <param name="usesuperhighways" default="true" type="internal" comment="THIS PARAM DOES NOT EXIST">
              </param>
	</add>
	
		 <replace sel="/aiscript/interrupts/library/actions/do_if[@value='$uselocalhighways and not $bigship and not this.assignedcontrolled.isformationleader']"> 
	    <do_if value="$uselocalhighways and not this.assignedcontrolled.isformationleader">
          <set_value name="$canuselocalhighways" exact="true"/>
        </do_if>
	</replace>
	
	
	
			 <replace sel="//aiscript/attention/actions/do_if[@value='this.sector != $targetsector or (this.zone != $targetzone and (not @$endzone or this.zone != $endzone) and ($endintargetzone or @$targetzone.isclass.highway or this.ship.bboxdistanceto.[$positionspace, $position, $destination] gt 10km))']">
		<!---->			 
		<do_if value="this.sector != $targetsector or (this.zone != $targetzone and (not @$endzone or this.zone != $endzone) and ($endintargetzone or @$targetzone.isclass.highway or this.ship.bboxdistanceto.[$positionspace, $position, $destination] gt 10km))">
        <debug_text text="'moving long distance.\n this zone: %1,\n targetzone: %2,\n endzone: %9,\n positionspace: %3 %4 (%5),\n target sector: %6 (%7),\n distance to target position: %8'.[this.zone, $targetzone, $positionspace.class, $positionspace.knownname, $positionspace, @$targetsector.knownname, $targetsector, @this.ship.bboxdistanceto.[$positionspace, $position, $destination], @$endzone]" chance="$debugchance"/>
        <do_if value="(this.sector == $targetsector) and $endintargetzone and @$endzone.exists and (this.zone == @$endzone)">
          <debug_text text="'endintargetzone is set and we are in endzone, but we are still about to move to endzone. this movement should be skipped!'" filter="error"/>
        </do_if>

        <!-- clear $intersector in case script loops back before it could be cleaned up. it will be re-evaluated. -->
        <remove_value name="$intersector"/>

        <do_if value="$targetsector and this.sector and (this.sector != $targetsector)">
          <!-- reset or clean up variables first in case earlier movement was interrupted and we are re-evaluating. -->
          <do_if value="$resetstrictblacklist?">
            <set_value name="$strictblacklist" exact="not $strictblacklist"/>
            <remove_value name="$resetstrictblacklist"/>
          </do_if>
          <remove_value name="$blacklistoverride"/>

          <set_value name="$intersector"/>

          <do_if value="$strictblacklist and this.assignedcontrolled.commander and ($targetsector == @this.assignedcontrolled.commander.sector)">
            <!-- NB: subordinates are always allowed to operate in their commander's current sector. -->
            <set_value name="$strictblacklist" exact="false"/>
            <set_value name="$resetstrictblacklist"/>
          </do_if>

          <!-- determine if we have a path to the destination. if not and the order is explicit, plot another path ignoring the sector blacklist. -->
          <do_if value="$canuselocalhighways">
            <get_jump_path component="$jumppath" multiple="true" uselocalhighways="true" useblacklist="$blacklistgroup" refobject="this.assignedcontrolled" useknownpath="this.isplayerowned">
              <start object="this.ship"/>
              <end object="$targetsector"/>
            </get_jump_path>
          </do_if>
          <do_else>
            <get_jump_path component="$jumppath" multiple="true" uselocalhighways="false" useblacklist="$blacklistgroup" refobject="this.assignedcontrolled" useknownpath="this.isplayerowned">
              <start object="this.ship"/>
              <end object="$targetsector"/>
            </get_jump_path>
          </do_else>

          <do_if value="$jumppath.count lt 2">
            <!-- if strict blacklist enforcement is active, only exception is to leave a blacklisted sector. -->
            <do_if value="not $strictblacklist or (this.assignedcontrolled.commander and this.assignedcontrolled.gatedistance.{this.assignedcontrolled.commander}.{$blacklistgroup}.{this.assignedcontrolled} lt 0 and this.assignedcontrolled.commander.gatedistance.{$targetsector}.{$blacklistgroup}.{this.assignedcontrolled} ge 0) or (this.sector.isblacklisted.{blacklisttype.sectortravel}.{$blacklistgroup}.{this.assignedcontrolled} and not $targetsector.isblacklisted.{blacklisttype.sectortravel}.{$blacklistgroup}.{this.assignedcontrolled})">
              <debug_text text="'no path found from %s %s to %s %s and order was explicit, it is accessible to our commander who is not accessible to us, or we are leaving a blacklisted sector for one that is not. overriding blacklist.\ncurrent order: %s\ngatedistance: %s\njumppath count: %s'.[this.sector.class, this.sector.knownname, $targetsector.class, $targetsector.knownname, this.assignedcontrolled.order.id, this.gatedistance.{$targetsector}, $jumppath.count]" chance="$debugchance"/>
              <do_if value="$canuselocalhighways">
                <get_jump_path component="$jumppath" multiple="true" uselocalhighways="true" useknownpath="this.isplayerowned">
                  <start object="this.ship"/>
                  <end object="$targetsector"/>
                </get_jump_path>
              </do_if>
              <do_else>
                <get_jump_path component="$jumppath" multiple="true" uselocalhighways="false" useknownpath="this.isplayerowned">
                  <start object="this.ship"/>
                  <end object="$targetsector"/>
                </get_jump_path>
              </do_else>
              <set_value name="$blacklistoverride" comment="used in the smallship case"/>
            </do_if>
            <do_else>
              <debug_text text="'no path found from %s %s to %s %s and order was not explicit. possible that all paths are covered by a blacklist. current order: %s'.[this.sector.class, this.sector.knownname, $targetsector.class, $targetsector.knownname, this.assignedcontrolled.order.id]" chance="$debugchance"/>
              <resume label="cleanup"/>
            </do_else>
          </do_if>
        </do_if>

        <set_value name="$loctargetzone" exact="null"/>
        <do_if value="$positionspace.isclass.zone">
          <set_value name="$loctargetzone" exact="$positionspace"/>
        </do_if>
        <do_elseif value="$positionspace.isclass.sector">
          <get_zone_at_position name="$loctargetzone" value="$position" sector="$positionspace"/>
        </do_elseif>
        <do_elseif value="$positionspace.zone">
          <set_value name="$loctargetzone" exact="$positionspace.zone"/>
        </do_elseif>
        <!-- Inform subordinates of long distance travel (use this.$recalling_subordinates to avoid repetitions on nested calls to move.generic)
              Ordering subordinates to go on ahead is deprecated as of 3.0. lib.recall.subordinates will call in all drones, and will call in any subordinates that can dock. -->
        <do_if value="$recallsubordinates and this.assignedcontrolled.subordinates.count and (@this.assignedcontrolled.order.state != orderstate.critical) and not this.$recalling_subordinates? and (not this.isplayerowned or not $loctargetzone or ($loctargetzone != this.zone and not this.zone.adjacentzones.indexof.{$loctargetzone}))">
          <!-- There are cases where all subordinates are already docked but dock orders didn't come from RecallSubordinates. Without the handling below, this case will result in an infinite loop. -->
          <do_for_each name="$locsub" in="this.assignedcontrolled.subordinates">
            <do_if value="$locsub.isoperational and this.assignedcontrolled.dockingallowed.{$locsub} and (not $locsub.dock or not $locsub.hascontext.{this.assignedcontrolled})">
              <set_value name="$recall"/>
              <break/>
            </do_if>
          </do_for_each>
          <do_if value="$recall?">
            <set_value name="$locdest" exact="$destination"/>
            <set_value name="$locpos" exact="$pos_input"/>
            <do_if value="$destination.isclass.cluster">
              <set_value name="$locdest" exact="$positionspace"/>
              <set_value name="$locpos" exact="$position"/>
            </do_if>
            <do_elseif value="not $locpos">
              <set_value name="$locpos" exact="position.[0, 0, 0]"/>
            </do_elseif>

            <debug_text text="'recalling subordinates. subordinateorders: %s, recalling_subordinates: %s'.[$subordinateorders?, this.$recalling_subordinates?]" chance="$debugchance"/>
            <create_order id="'RecallSubordinates'" object="this.ship" immediate="true">
              <!--<param name="timeout" value="20s"/>-->
              <param name="destination" value="[$locdest, $locpos]"/>
              <param name="activepatrol" value="$activepatrol"/>
              <param name="debugchance" value="$debugchance"/>
            </create_order>
            <wait exact="1s" sinceversion="8"/>
            <remove_value name="$locpos"/>
            <remove_value name="$locdest"/>
            <remove_value name="$recall"/>
          </do_if>
        </do_if>
        <remove_value name="$loctargetzone"/>

        <do_if value="(not $destination.exists) or (not $allowwreck and $destination.iswreck)">
          <debug_text text="'ERROR: destination does not exist! destination is: %1 CHECK 3'.[$destination]" filter="error" comment="could be a valid case because if it's an object or a tempzone" chance="$debugchance"/>
          <resume label="cleanup"/>
        </do_if>

        <!-- Determine if we have to wait for subordinates -->
        <do_for_each name="$locship" in="this.assignedcontrolled.subordinates">
          <do_if value="$locship.isoperational and (not $locship.dock or not $locship.hascontext.{this.assignedcontrolled}) and ((@$locship.formationleader == this.assignedcontrolled) or ((@$locship.order.id == 'Escort' or @$locship.order.id == 'SupplyFleet') and ($locship.order.$target == this.assignedcontrolled)))">
            <set_value name="$waitforsubordinates"/>
            <break/>
          </do_if>
        </do_for_each>

        <!-- in the bigship case, unify inter-sector and inter-cluster movements to move.gate.
              TODO:
                DONE  add reservation system, similar to that of jump gates, to superhighway gates,
                DONE  rename move.jumpgate to move.gate and adapt to two cases: jump gates and superhighway gates (should be largely identical),
                DONE  route to move.gate here, parameters depending on inter-sector or inter-cluster as appropriate if necessary. -->
        <!-- lots and lots of small ships moving at the exact same frame to a distant place causes the game to stutter. -->
        <!-- NB: orders can cancel orders and orders can be interrupted, so this script can validly be started while this.ship is in a highway.
                it not being in a highway is only absolutely necessary within this do_if and, if it already is in a highway, it simply moves to the highway. (caught in the else case) -->
        <do_if value="$intersector? and not @this.zone.isclass.highway and (@$waitforsubordinates or $waitforatgate)">
          <!-- determine where we're going in this step, and how we're getting there. -->
          <!-- non-capital ships bypass this check. same case caught when they try to do a long-distance move_to action. -->
          <do_if value="$jumppath.count lt 2">
            <debug_text text="'ERROR: we are not at the target sector, but no jump path found from %s %s to %s %s. aborting.'.[this.sector.knownname, this.sector, $targetsector.knownname, $targetsector]" filter="error" chance="$debugchance"/>
            <do_all exact="$jumppath.count" counter="$pathindex">
              <debug_text text="'jumppath entry %s: %s %s %s'.[$pathindex, $jumppath.{$pathindex}.class, $jumppath.{$pathindex}.knownname, $jumppath.{$pathindex}]"/>
            </do_all>
            <resume label="cleanup"/>
          </do_if>

          <do_if value="$jumppath.{1}.isclass.gate or $jumppath.{1}.isclass.highwayentrygate">
            <set_value name="$gate" exact="$jumppath.{1}"/>
            <set_value name="$gatedestination" exact="$gate.destination"/>
            <set_value name="$exitgate" exact="$gate.exit"/>
          </do_if>

          <do_if value="not @$gate.exists">
            <debug_text text="'no gate or superhighway found from sector %s %s to sector %s %s.'.[@this.sector.knownname, this.sector, $targetsector.knownname, $targetsector]" filter="error"/>
            <resume label="cleanup"/>
          </do_if>

          <debug_text text="'using %1 %2 from %3, %4 to %5, %6.'.[$gate.class, $gate, this.sector.knownname, this.cluster.knownname, $gatedestination.sector.knownname, $gatedestination.cluster.knownname]" chance="$debugchance"/>

          <!-- go there. -->
          <set_value name="$nextsector" exact="$gatedestination.sector"/>
          <debug_text text="'moving through the gate from sector %s to sector %s. waiting for subordinates: %s, waiting for: %s %s %s'.[this.sector.knownname, $nextsector.knownname, $waitforsubordinates?, @$waitforatgate.idcode, @$waitforatgate.knownname, $waitforatgate]" chance="(this.isplayerowned and ($waitforsubordinates? or $waitforatgate)) * 0"/>
         
<!-- ================================================================-->
	<do_if value="(this.zone != $targetzone) and (this.ship.distanceto.[$destination, $position] gt 1000km)">
        <!-- long distance -->
        <do_if value="$bigship">
          <do_if value="(this.sector == $destination.sector)">
  
            <!--Move through gate  -->
           <do_if value="$jumppath.{1} == this.sector">
			<debug_text text="'Long distance trip. Using jump drive...'" chance="$debugchance" />
			
			<!--
			<get_safe_pos result="$destpos" sector="$destsector" min="this.ship.size" max="10km + (this.ship.size / 2.0)" radius="this.ship.size / 2.0" />
			    <warp object="this.ship" zone="$destination.zone">
				<position value="$safepos" />
          		</warp>
			-->
              <run_script name="'move.jump'" result="$jumpresult">
               </run_script>
              <do_if value="$jumpresult" exact="false">
                <debug_text text="'ERROR: Jump to %1(%2) failed'.[$destination.knownname, $position]" />
                <set_value name="$nojump" exact="true" />
                <wait min="10s" max="1min" />
              </do_if>
             </do_if>
        
            <debug_text text="'Jump/move gate complete. Moving into final position.'" chance="$debugchance" />
            <resume label="check" />
          </do_if>
        </do_if>
    </do_if>
<!-- ================================================================-->

		 <run_script name="'move.gate'">
            <param name="gate" value="$gate"/>
            <param name="recallsubordinates" value="false" comment="if move.gate calls move.generic, this passes the parameter to the new instance of move.generic"/>
            <param name="waitfor" value="$waitforatgate"/>
            <param name="noboost" value="$noboost or (@this.assignedcontrolled.order.id == 'Attack')"/>
            <!--<param name="debugchance" value="($waitforsubordinates? or $waitforatgate) * 100"/>-->
            <param name="debugchance" value="$debugchance"/>
          </run_script>

          <!-- we should have gone through the gate and be in the correct sector now -->
          <do_if value="$gatedestination.sector != this.sector">
            <debug_text text="'failed going through gate!'" filter="error"/>
          </do_if>
          <remove_value name="$nextsector"/>
          <remove_value name="$gatedestination"/>
          <remove_value name="$gate"/>

          <!-- if we waited for someone after crossing the gate, we are no longer blocking the gate or will directly proceed. movement to clear gate exit done in move.gate in this case. -->
          <do_if value="not $waitforsubordinates? and not $waitforatgate.isoperational and not this.zone.isclass.highway">
            <!-- move forward to a safepos to make sure the gate exit area is clear -->
            <get_safe_pos result="$safepos" zone="this.zone" object="this.assignedcontrolled" direction="quadrant.front" radius="this.assignedcontrolled.size" angle="45deg"/>
            <!-- locendzone -->
            <move_to endzone="$locendzone" object="this.assignedcontrolled" destination="this.zone" uselocalhighways="false" finishonapproach="true" abortpath="true" commandaction="$changecommandaction">
              <position value="$safepos"/>
            </move_to>
            <remove_value name="$safepos"/>
            <do_if value="$locendzone? and ($locendzone == null)">
              <remove_value name="$locendzone"/>
              <debug_text text="'1: no path generated.'" chance="$debugchance"/>
              <set_value name="$failedattempts" exact="@$failedattempts + 1"/>
              <do_if value="$failedattempts ge 3">
                <debug_text text="'aborting movement.'" chance="$debugchance"/>
                <resume label="cleanup"/>
              </do_if>
              <debug_text text="'plotting new position.'" chance="$debugchance"/>
              <set_value name="$position" exact="null"/>
              <resume label="move"/>
            </do_if>
            <remove_value name="$locendzone"/>
          </do_if>
          <remove_value name="$waitforsubordinates"/>
        </do_if>
        <do_else>
          <set_value name="$locblacklistgroup" exact="if ($intersector? and not $blacklistoverride?) then $blacklistgroup else null"/>

          <wait max="5.1 - (this.ship.pilot.skill.piloting / 3)s"/>

          <include_interrupt_actions ref="CheckCanUseLocalHighways"/>
          <do_if value="$resetsignalled?">
            <remove_value name="$resetsignalled"/>
            <wait exact="1ms" sinceversion="6"/>
          </do_if>

          <do_if value="$debugchance gt 0">
            <do_if value="this.zone.isclass.highway">
              <!-- we are in a highway -->
              <debug_text text="'location info for object=%2 at %1\n highway: %3, position: %4\n enroute to: %5'.[player.age, this.ship, this.zone, this.ship.position, this.zone.destination]"/>
              <debug_text text="'move_to(363) destination=%1 position=%2 distance=%3'.[$positionspace, $position, @this.ship.distanceto.[$positionspace, $position]]"/>
            </do_if>
            <do_else>
              <create_position name="$debug_sector_pos" object="this.ship" space="this.ship.sector"/>
              <debug_text text="'location info for object=%2 at %1\n zone: %3, position: %4\n sector: %5, position: %6'.[player.age, this.ship, this.zone, this.ship.position, this.sector, $debug_sector_pos]"/>
              <debug_text text="'move_to(363) destination=%1 position=%2 distance=%3'.[$positionspace, $position, @this.ship.distanceto.[$positionspace, $position]]"/>
            </do_else>
          </do_if>
          <!-- clear endzone so it can be used for the following check after the move_tos below have run -->
          <remove_value name="$endzone"/>
          <debug_text text="'Long distance trip. Using highways: %s'.[$canuselocalhighways]" chance="$debugchance" />

          <do_if value="$position">
            <move_to endzone="$endzone" object="this.ship" destination="$positionspace" uselocalhighways="$canuselocalhighways" useknownpath="this.isplayerowned" abortpath="$abortpath" forcesteering="$forcesteering" forceposition="false" travel="not $noboost" useblacklist="$locblacklistgroup" commandaction="$changecommandaction">
              <position value="$position"/>
              <interrupt>
                <conditions>
                  <event_object_changed_zone object="this.ship" zone="$endzone"/>
                  <debug_text text="'%s %s %s changed zones. current zone: %s, endzone: %s. not iszonechangepending: %s'.[@this.assignedcontrolled.idcode, @this.assignedcontrolled.knownname, this.assignedcontrolled, this.zone, $endzone, not this.assignedcontrolled.iszonechangepending]" debugchance="$debugchance"/>
                  <check_value value="not this.ship.iszonechangepending"/>
                </conditions>
                <actions>
                  <debug_text text="'interrupting move_to of %1(%2) because we just arrived in endzone %3(%4) in sector %6, $targetzone = %5, previous sector %7'.[this.ship.knownname, this.ship, $endzone.knownname, $endzone, $targetzone, @event.param.sector.macro.id, @event.param2.sector.macro.id]" chance="$debugchance"/>
                </actions>
              </interrupt>
            </move_to>
            <debug_text text="'movement ended. distance to position: %s, destination: %s %s\nin endzone: %s'.[this.assignedcontrolled.distanceto.[$positionspace, $position], $destination.class, $destination.knownname, this.assignedcontrolled.hascontext.{$endzone}]" chance="$debugchance"/>
          </do_if>
          <do_else>
            <!-- if no position is defined, we simply move to $destination and stop when we get to $destination's zone. in the cases now supported:
              $destination is a highway and $destination == zone,
              or $destination is an object and $destination.zone is a highway.
              NB: endzone is a return value! -->
            <move_to endzone="$endzone" object="this.ship" destination="$destination" uselocalhighways="$canuselocalhighways" useknownpath="this.isplayerowned" abortpath="$abortpath" forcesteering="$forcesteering" forceposition="false" travel="not $noboost" useblacklist="$locblacklistgroup" radius="10km + this.assignedcontrolled.size" commandaction="$changecommandaction">
              <interrupt>
                <conditions>
                  <check_any>
                    <check_all>
                      <event_object_changed_zone object="this.ship" zone="$endzone"/>
                      <check_value value="$destination.isclass.highway"/>
                      <check_value value="not this.ship.iszonechangepending"/>
                      <debug_text text="'interrupting move_to of %1(%2) because we just arrived in endzone %3(%4) in sector %6, $targetzone = %5, previous sector %7'.[this.ship.knownname, this.ship, $endzone.knownname, $endzone, $targetzone, @event.param.sector.macro.id, @event.param2.sector.macro.id]" debugchance="$debugchance"/>
                    </check_all>
                    <check_all>
                      <event_object_changed_zone object="this.ship"/>
                      <check_value value="$destination.isclass.object"/>
                      <check_value value="not this.ship.zone.isclass.highway"/>
                      <debug_text text="'was moving long-distance to %s %s %s which was in a highway. no longer in a highway. ending movement and proceeding. attention level: %s'.[$destination.idcode, $destination.knownname, $destination, this.ship.attention]" debugchance="$debugchance"/>
                    </check_all>
                  </check_any>
                </conditions>
              </interrupt>
            </move_to>
          </do_else>
          <remove_value name="$locblacklistgroup"/>
          <!-- locendzone -->
          <do_if value="$endzone == null">
            <debug_text text="'2: no path generated.\ndestination: %s %s %s\npositionspace: %s %s %s\nposition: %s'.[$destination.class, $destination.knownname, $destination, $positionspace.class, $positionspace.knownname, $positionspace, $position]" chance="$debugchance"/>
            <set_value name="$failedattempts" exact="@$failedattempts + 1"/>
            <do_if value="$failedattempts ge 3">
              <debug_text text="'aborting movement.'" chance="$debugchance"/>
              <resume label="cleanup"/>
            </do_if>
            <debug_text text="'plotting new position.'" chance="$debugchance"/>
            <set_value name="$position" exact="null"/>
            <resume label="move"/>
          </do_if>
        </do_else>

        <do_if value="$resetstrictblacklist?">
          <set_value name="$strictblacklist" exact="not $strictblacklist"/>
          <remove_value name="$resetstrictblacklist"/>
        </do_if>
        <remove_value name="$blacklistoverride"/>
        <remove_value name="$intersector"/>
        <resume label="check"/>
      </do_if>
	  <!-- -->
	</replace>
					
				
				 <replace sel="//aiscript/attention/actions/do_if/do_if[@value='this.ship.distanceto.[$positionspace, $safepos] gt this.ship.size']"> 
	                 <do_if value="this.ship.distanceto.[$positionspace, $safepos] gt this.ship.size">
          <move_to endzone="$locendzone" object="this.ship" destination="$positionspace" uselocalhighways="$canuselocalhighways" abortpath="$abortpath" forcesteering="$forcesteering" forceposition="false" forcerotation="false" finishonapproach="false" commandaction="$changecommandaction">
            <position value="$safepos"/>
          </move_to>
        </do_if>
	</replace>
	
	 <replace sel="//aiscript/attention/actions/do_else/move_to[@endzone='$locendzone']"> 
	                   <move_to endzone="$locendzone" object="this.ship" destination="$positionspace" uselocalhighways="$canuselocalhighways" abortpath="$abortpath" forcesteering="$forcesteering" forceposition="false" forcerotation="true" finishonapproach="false" commandaction="$changecommandaction">
          <position value="$safepos" />
          <rotation value="$rotation" />
        </move_to>     
	</replace>

</diff> 
Now, maybe a lucky hit but I want to firstly understand where the issue was. Do the capital ships send some signal before crossing the gate? Or is the steering what stopped them?
Also because I still get some errors in the log. These errors are now mostly this:

Code: Select all

[=ERROR=] 23.87 Error in AI script move.flee.highway on entity 0x151e83: Evaluated value 'null' is not of type component
* Expression: $highway.destination
* Action: <move_to>, line 49
Which I think is simply related to the NORMAL highways that could have some issue (not what we discuss).
And this other one that seems related instead:

Code: Select all

[General] 1699.08 ======================================
[=ERROR=] 1699.08 Error in AI script move.gate on entity 0x116228: Move-to action got a very large position (zone) (11134839.000000 37072.507813 9605710.000000). [Matthias]
* Action: <move_to>, line 435
[General] 1699.08 ======================================
All the errors related to move.generic instead have gone

Post Reply

Return to “X4: Foundations - Scripts and Modding”