Thanks, that was very useful. ‘improved engineer’ here is some of that code. You can get this off ‘nexus mods - xrebirth’
content.xml authors info page
<?xml version=“1.0” encoding=“utf-8”?>
<content id=“ImprovedEngineer” name=“Improved Engineer” description="Complete rewrite of the engineer ai.
Include support for emergency repairs and repair using in flight drones, as well as engineer skills and morale.
See mod forum post on egosoft for more details" author=“Jey123456” version=“0.98” date=“2013-11-23”>
<text language=“44” name=“Improved Engineer” description="Complete rewrite of the engineer ai.
Include support for emergency repairs and repair using in flight drones, as well as engineer skills and morale.
See mod forum post on egosoft for more details" author=“Jey123456” version=“0.98” />
</content>
<interrupt_after_time time="(0+@$iterationSpeed) + 1s"/> ??
<set_value name="$EngineerWreckRestoreDelay" exact=“30”/> $EngineerWreckRestoreDelay=“30” (DEC) Right?
<set_value name="$overallRepairRate" exact=“45f” /> $overallRepairRate=“45.00” (FLOAT)
set_value name="$moralInc" exact="(1f+this.skill.morale)/5f"/> <!-- how much morale is added for every cycle where the engineer is not busy →
$moralInc= (1.00 + this.skill.morale) / 5.00" this->skill->morale
<do_if value="not $accumulatedPerc?"> if value nonzero?
<set_value name="$lastEngineerWreckRestore" exact="player.age"/>
<set_value name="$lastEngineerRepair" exact="player.age"/>
<set_value name="$lastEngineerDrone" exact="player.age - $EngineerRepairRate"/>
<set_value name="$lastEngineerStatus" exact="player.age - $EngineerCheckStatus"/>
<set_value name="$lastEngineerMorale" exact="player.age"/>
<set_value name="$welderdronesScore" exact="0"/>
<set_value name="$welderdronesLaunched" exact="0"/>
<set_value name="$morallevel" exact="100f"/> <!-- A value from 125 to 25 that slowly increase when not busy, and decrease when busy, the rate at which it increase and decrease is affected by morale skill 125 mean 25% better at everything. 25 mean 1/4 as good at everything-->
<set_value name="$nextRepairTargetValue" exact="0"/>
<create_group groupname="$damagedelements" />
<create_group groupname="$wreckedelements" />
<set_value name="$lastEngineerMessage" exact="'Setting up'"/>
<set_value name="$lastEngineerDebugDelta" exact="''"/>
<set_value name="$lastEngineerDebug" exact="''"/> <!-- used to output all sort of debug info depending on what we want. Just set the value and uncomment the line that print it to the info panel -->
<set_value name="$lastEngineerMessageTime" exact="player.age - 30"/>
<set_value name="$accumulatedPerc" exact="0f"/>
</do_if>
<do_if value="$welderdronesScore ge 1"> <!-- We have welding drones on board, so we can repair the hull a lot more -->
<set_value name="$EngineerRepairHullMaxPerc" exact="50"/>
</do_if>
if $welderdronesScore >= 1 then
$EngineerRepairHullMaxPerc"=“50”
endif
<do_if value="this.ship != null">
<do_if value="(this.ship.exists) and (this.ship.isplayerowned)">
<set_value name="$distanceToPlayerShip" exact="player.primaryship.distanceto.{this.ship}"/>
<set_value name="$withinDecentRange" exact="($distanceToPlayerShip != null) and ($distanceToPlayerShip le 60000m)" /> <!-- beyond 60km... we can slowdown our iteration rate a bit and it wouldnt really matter, average repair will be the same just not as smooth -->
<set_value name="$withinCommRange" exact="($distanceToPlayerShip != null) and ($distanceToPlayerShip le 1500m)" />
<set_value name="$extremelyClose" exact="($distanceToPlayerShip != null) and ($distanceToPlayerShip le 150m)" />
</do_if>
</do_if>
if this->ship != null # valid ship?
if (this.ship.exists != 0) and (this.ship.isplayerowned != 0)">
<set_value name="$withinDecentRange" exact="($distanceToPlayerShip != null) and ($distanceToPlayerShip le 60000m)" />
Both values true.