make engineers repair engines and jumpdrive of captured ships

The place to discuss scripting and game modifications for X Rebirth.

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

Central
Posts: 1143
Joined: Sat, 1. May 04, 15:15
x4

make engineers repair engines and jumpdrive of captured ships

Post by Central »

as the title says: is it possible to make engineers repair engines and jumpdrives of my captured ships? if yes: can somebody tell me how its done?
Ruiner82
Posts: 85
Joined: Thu, 28. Jul 11, 08:32
x3tc

Post by Ruiner82 »

They need construction drones and a working drone launcher.
Central
Posts: 1143
Joined: Sat, 1. May 04, 15:15
x4

Post by Central »

the drone launcher ist destroyed too. and how do i give construction drones to them?
wwdragon
Posts: 3759
Joined: Mon, 1. Oct 07, 02:18
x4

Post by wwdragon »

Ruiner82 wrote:They need construction drones and a working drone launcher.
I think repairs should still happen even if you don't have drone launcher or even drones, Otherwise some ships will NEVER repair.

Maybe just slower repair rate would work.
Editing posts since long before I remember.
Kierk
Posts: 115
Joined: Wed, 30. Oct 13, 16:38

Post by Kierk »

from looking into the engineer.ai script it looks like even with 0 repair chance (no drones, no launcher) there is supposed to be a 1/100 chance per second that a repair tic will occur. Looking into changing that as part of hull engineers mod.
User avatar
Gazz
Posts: 13244
Joined: Fri, 13. Jan 06, 16:39
x4

Post by Gazz »

The drone launcher is the only system that needs a decent chance to be repaired "from the inside".

The other systems (engines would probably be a priority) can live with a tiny chance to get any repairs done at all.
Last edited by Gazz on Sat, 23. Nov 13, 19:57, edited 1 time in total.
My complete script download page. . . . . . I AM THE LAW!
There is no sense crying over every mistake. You just keep on trying till you run out of cake.
swatti
Posts: 1278
Joined: Sun, 7. Dec 03, 12:03
x4

Post by swatti »

Repairing one engine, drone launcher and jump-drive to 1% hp upon capturing would be quite nice. Enables the ship to atleast move slowly and jump to escape.
Central
Posts: 1143
Joined: Sat, 1. May 04, 15:15
x4

Post by Central »

Kierk wrote:from looking into the engineer.ai script it looks like even with 0 repair chance (no drones, no launcher) there is supposed to be a 1/100 chance per second that a repair tic will occur. Looking into changing that as part of hull engineers mod.
actually its a 10% chance per second that a random component goes from status wrecked (destroyed) to 1% hull (status damaged)

<do_if value="$wreckedelements.count gt 0" chance="10">
<set_value name="$restoreindex" min="1" max="$wreckedelements.count" />
<restore_object object="$wreckedelements.{$restoreindex}" hull="1" />
<add_to_group groupname="$damagedelements" object="$wreckedelements.{$restoreindex}" />
<debug_text text="'Restoring ' + $wreckedelements.{$restoreindex}.knownname" chance="$debugoutputchance"/>
<remove_value name="$wreckedelements.{$restoreindex}"/>
</do_if>

it would make more sense to first repair critical systems like engines/jumpdrive/dronelauncher instead of a random component
Central
Posts: 1143
Joined: Sat, 1. May 04, 15:15
x4

Post by Central »

swatti wrote:Repairing one engine, drone launcher and jump-drive to 1% hp upon capturing would be quite nice. Enables the ship to atleast move slowly and jump to escape.
my point exactly :D

edit:
@gazz: and what if the ship has no repair drones? then the drone-launcher would be no help at all
swatti
Posts: 1278
Joined: Sun, 7. Dec 03, 12:03
x4

Post by swatti »

Wasnt there a tiny passive auto-repair too?

I'd say a small if not tiny passive auto-repair should be there "just in case" or if you have no drones or even crew in hand.
User avatar
Gazz
Posts: 13244
Joined: Fri, 13. Jan 06, 16:39
x4

Post by Gazz »

Yeah. If there is an engineer to repair things, they can be repaired. Or at least jury-rigged to get to the next space port.

No-drone repairs should definitely be possible but it should take considerable time for a system to re-activate.
I can also see a max % to which systems can be repaired without drones.

It's never a good idea to create a situation where a ship is permanently stuck.
My complete script download page. . . . . . I AM THE LAW!
There is no sense crying over every mistake. You just keep on trying till you run out of cake.
Central
Posts: 1143
Joined: Sat, 1. May 04, 15:15
x4

Post by Central »

i changed the engineer.ai.xml to increase the chance that a random component gets repaired.

<do_if value="$wreckedelements.count gt 0" chance="100">
<set_value name="$restoreindex" min="1" max="$wreckedelements.count"></set_value>
<restore_object object="$wreckedelements.{$restoreindex}" hull="1"></restore_object>
<add_to_group groupname="$damagedelements" object="$wreckedelements.{$restoreindex}"></add_to_group>
<debug_text text="'Restoring ' + $wreckedelements.{$restoreindex}.knownname" chance="$debugoutputchance"></debug_text>
<remove_value name="$wreckedelements.{$restoreindex}"></remove_value>
</do_if>


this should repair a random component every second, with a chance of 100%

but nothing happens :(
lubatomy
Posts: 236
Joined: Mon, 29. Dec 03, 15:22
x4

Post by lubatomy »

right now, for capital ships and only captial ships it seems, if there are no repair drones onboard then there is no repairs done.

base repair rate = 10

repair rate modifier = (1 per drone on board ) + ( num of drones * 0 to 4 depending on engineering skill of engineer)

actual repair rate = (base repair) * (repair rate modifier) / ( num wrecked items ) * ( num damaged items )

thus if drones = 0 then end repair rate = 0 no matter the skill of the engineer

zero or one star and the engineer gives no bonus to repair rate modifier.

without modding, a capital without drones never repairs.
Kierk
Posts: 115
Joined: Wed, 30. Oct 13, 16:38

Post by Kierk »

just uploaded a fix for the stuck issue when the ship does have drones but they're not working.

for the no drone case look at this part of the code

Code: Select all

<set_value name="$repairratefactor" exact="0" />
      <do_all exact="unitcategory.welder.maxmk" counter="$i">
        <debug_text text="this.container.units.{unitcategory.welder}.mk.{$i}.count + ' welders mk ' + $i" chance="$debugoutputchance" />
        <set_value name="$repairratefactor" operation="add" exact="this.container.units.{unitcategory.welder}.mk.{$i}.count * $i" />
      </do_all>
      <set_value name="$repairratefactor" operation="add" exact="$repairratefactor * this.combinedskill / 25" comment="skill factor between 1 and 5" />
      <do_if value="$repairratefactor == 0">
        <resume label="checkforrepair" />
      </do_if>
note that repair rate factor starts at 0 and has drone values added to it, no drones no adding. Then it gets multiplied by a skill factor, no help if its 0. Finally it checks if its 0 and if so aborts repair and goes to check on repair again.

replacing line 95

Code: Select all

<set_value name="$repairratefactor" exact="0" />
with

Code: Select all

<set_value name="$repairratefactor" exact="1" />
should give you a small chance for 0 drone engineers to fix components. Bigger the number higher the chance and faster the repairs.
lubatomy
Posts: 236
Joined: Mon, 29. Dec 03, 15:22
x4

Post by lubatomy »

problem is that if repairratefactor is 0 it still wont repair.

look under the "do repair"

final repair rate for any damaged module is:

[baserate] * [repairratefactor] / sum of wrecked and damaged components

if repairratefactor = 0 then it will cycle through the repairs doing nothing and never leaving the repair process to check for components again.
swatti
Posts: 1278
Joined: Sun, 7. Dec 03, 12:03
x4

Post by swatti »

Base repair-rate 0.1 per sec. Only engines & dronebay and only up to 10% hp

If engineer aboard WITHOUT drones, slightly increased repair-rate and priority to dronebay. Only up to 10% hp

Moddable / doable?

Also. If part is blown up, add a two min CD before the repair can start. By the time ive blown the engines its back to shooting the jumpdrive and then speed-shooting the engines again.
Jey123456
Posts: 259
Joined: Sat, 23. Nov 13, 09:48
x4

Post by Jey123456 »

http://forum.egosoft.com/viewtopic.php?t=354081

This will do what you want.

Altho the first time youll blow up something, it might repair somewhat quickly (due to how inverted the repair time is for performance reasons in my script). But its only the first time, after that, it cannot rebuild / repair anything for the next ~30secs (exact value depend on engineer skills).
TinkerToy
Posts: 195
Joined: Fri, 25. Dec 09, 17:41
x4

Post by TinkerToy »

The URV launcher should be able to be repaired by a ships engineer (get in a space suit, grab a welding torch and a wrench and get out there !). Perhaps it could be a 50% slower repair rate than a drone.


Similarly, ALL subsystems should be repairable by a spacesuited engineer, just at a much slower rate than by URV repair drones.


Perhaps in future the engineers could even have an additional skill for "Manual repairs" or something similar, to improve their repair rate in the absence of drones.
Jey123456
Posts: 259
Joined: Sat, 23. Nov 13, 09:48
x4

Post by Jey123456 »

well, my mod lack the "spacesuited" part visually speaking, but its exactly what it does

Return to “X Rebirth - Scripts and Modding”