[Scripts] move.flee method assignment

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

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

PublicSynechism
Posts: 4
Joined: Thu, 14. Apr 22, 17:38
x4

[Scripts] move.flee method assignment

Post by PublicSynechism »

7.5 - All DLC

Questions:
- How is $method assigned in move.flee? Is it being passed from some global setting?
- How should I diff move.flee if I want to force test 'leavecluster' as default method?

Context:
I'd like help understanding the assignment of $method in /aiscripts/move.flee.xml

Code: Select all

  <order id="Flee" name="{1041, 551}" description="{1041, 552}" category="internal" allowinloop="false">
    <params>
      <param name="method" default="1" type="number" text="{1041, 10064}" advanced="true" comment="number. Methods: 'boost','maneuver','highway','dock', 'leavecluster'">
        <input_param name="min" value="1" />
        <input_param name="max" value="5" />
      </param>
In my diff, I tried to force assign 'leavecluster':

Code: Select all

<?xml version="1.0" encoding="utf-8"?>
<diff xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <replace sel="//order/params/param[@name='debugchance']/@default">100</replace>
  <replace sel="//order/params/param[@name='method']/@default">5</replace>
  <add sel="//init" pos="prepend">
    <debug_text text="'move.flee has started running on the ship %s'.[this.ship.knownname]" chance="$debugchance"/>
  </add>
  <add sel="//label[@name='leavecluster']/following-sibling::set_value[@name='$exitgates']" pos="after">
    <debug_text text="'$exitgates initialized: count=%s'.[$exitgates.count]" chance="$debugchance"/>
  </add>
</diff>
In the debug, you can see that the ship still started with 'boost' and then tried move.flee.boost. In all my tests, the ships defaulted to 'boost' (although I've seen them 'leavecluster' in regular playthrough)

Code: Select all

[Scripts] 448035.95 *** aicontext<move.flee,0x96f3c>: move.flee has started running on the ship Deimos
[Scripts] 448035.95 *** aicontext<move.flee,0x96f3c>: method boost, type: string
[Scripts] 448035.95 *** aicontext<move.flee,0x96e1f>: chance to drop stuff: 30. $method != maneuver: 1, not this.ship.isplayerowned: 0, this.ship.cargo.count: 0
[Scripts] 448035.95 *** aicontext<move.flee,0x96e1f>: optimal duration: 0, my maxspeed: 2005, attacker maxspeed: null, attacker radar range: null, should be: 0
[Scripts] 448035.95 *** aicontext<move.flee,0x96e1f>: Flee using method 3 (attacker sector Tharka's Cascade XV 0x94a63)
[Scripts] 448035.95 *** aicontext<move.flee,0x96e1f>: attempting to flee by boost
[Scripts] 448035.95 *** aicontext<move.flee,0x96f3c>: chance to drop stuff: 18. $method != maneuver: 1, not this.ship.isplayerowned: 0, this.ship.cargo.count: 0
[Scripts] 448035.95 *** aicontext<move.flee,0x96f3c>: 448035.947: deploying lasertower
[Scripts] 448035.95 *** aicontext<move.flee,0x96f3c>: optimal duration: 0, my maxspeed: 229.593, attacker maxspeed: null, attacker radar range: null, should be: 0
[Scripts] 448035.95 *** aicontext<move.flee,0x96f3c>: Flee using method 3 (attacker sector Tharka's Cascade XV 0x94a63)
[Scripts] 448035.95 *** aicontext<move.flee,0x96f3c>: attempting to flee by boost
[Scripts] 448035.95 *** aicontext<move.flee.boost,0x96e1f>: only set spline on high attention
[Scripts] 448035.95 *** aicontext<move.flee.boost,0x96e1f>: 448035.947 Mako S-Widow ALPHA (0x96e1b) starting flee boost.
[Scripts] 448035.95 *** aicontext<move.flee.boost,0x96f3c>: only set spline on high attention
[Scripts] 448035.95 *** aicontext<move.flee.boost,0x96f3c>: 448035.947 Deimos (0x96e8a) starting flee boost.

Return to “X4: Foundations - Scripts and Modding”