[MOD] Station Engineers

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

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

w.evans
Posts: 2962
Joined: Tue, 18. Nov 14, 17:23
x4

Post by w.evans » Sun, 1. Feb 15, 19:20

Progress, of a sort.

Engineers repair so:

Code: Select all

<set_object_hull object="$Defensible" exact="$Defensible.hullpercentage + $addedhullpercentage" />
...
<set_object_hull object="$CurrentElement" exact="$CurrentElement.hullpercentage + $addedhullpercentage" />
While architects repair so:

Code: Select all

<repair_object buildmodule="$BuildModule" sequence="$sequence" stage="$stage" hullfraction="$fraction" buildlimit="$buildlimit" updatebuild="true"/>
...
<repair_component buildmodule="$BuildModule" component="$component" hullfraction="$fraction" />
and the variables used by the architect's repair function are defined so:

Code: Select all

              <set_value name="$component" exact="event.param2.{1}" />
              <set_value name="$sequence" exact="event.param2.{2}" />
              <set_value name="$stage" exact="event.param2.{3}" />
              <set_value name="$fraction" exact="event.param2.{4}" />
              <set_value name="$buildlimit" exact="event.param2.{5}" />
bloody parameters.

News: changing this:

Code: Select all

<set_object_hull object="$Defensible" exact="$Defensible.hullpercentage + $addedhullpercentage" />
to this:

Code: Select all

<repair_component buildmodule="$Defensible" component="$Defensible" hullfraction="$Defensible.hullpercentage" />
produced lots and lots of these errors:
debuglog wrote:[=ERROR=] Error in AI script engineer.ai on entity 0x4f640: Evaluated component 0x4f5e2 'Unknown Station' is not of class buildmodule
* Expression: $Defensible
which I think to mean that:
changes in engineer.ai.xml are immediately active requiring no further in-game changes,
and that ships and stations need to be defined as buildmodules.

_____
and so as to not scare the tourists: this applies to a little experiment I'm doing prompted by an idea by a couple of folks here to make the engineers, particularly station-based engineers (all of them, including those working for NPC factions) use resources to initiate repairs. The file uploaded works as advertised in the OP.

User avatar
alexalsp
Posts: 1044
Joined: Fri, 18. Jul 14, 05:28
x4

Post by alexalsp » Sun, 1. Feb 15, 21:53

I destroyed the station completely. And began to follow the repair. The engineer repairing the station.But this process is very long )) Only 4 module repaired by 30-60 % . It took only 2 hours .

How much time engineer will repair all stations )))

How to transfer engineer drones?
Is there a way to speed up the repair without drones?

w.evans
Posts: 2962
Joined: Tue, 18. Nov 14, 17:23
x4

Post by w.evans » Sun, 1. Feb 15, 22:11

alexalsp wrote:I destroyed the station completely. And began to follow the repair. The engineer repairing the station.But this process is very long )) Only 4 module repaired by 30-60 % . It took only 2 hours .
You completely destroyed your own station? Awesome testing! Thanks!
alexalsp wrote:How much time engineer will repair all stations )))
Really no idea. The actual repair function is from the vanilla engineer script, and repair rate and frequency are both dependent on the engineer's skill, but is much slower without Construction drones. (10 times slower than with a single drone)
alexalsp wrote:How to transfer engineer drones?
I use the "transfer wares" function. I believe that selecting the station via the map works. Even having just 1 construction drone will make it much faster.

Not sure, but just from memory, I think this is done by:

[Enter -> 2 -> 2 -> (Select freighter)] Select freighter with Construction URVs ,
[3] "Comm",
[2 -> 5] "New Orders" -> "Transfer Wares",
[1] "Use the map",
(Select station),
[4] "Select" (?)

should bring up the trade screen.

edit: just checked in-game:
[Enter -> 2 -> 2 -> (Select freighter) -> 3 -> 2 -> 5 -> 1 -> (Select station) -> 4]
alexalsp wrote:Is there a way to speed up the repair without drones?
Other than training your engineer? None that I know of.

User avatar
alexalsp
Posts: 1044
Joined: Fri, 18. Jul 14, 05:28
x4

Post by alexalsp » Sun, 1. Feb 15, 23:01

Thank you. Now, I do to buy somewhere drones .))

=================

May, alternatively, if possible, through the mod to add the required number of drones 10-30 -50. ?

Or just buy the drones?

w.evans
Posts: 2962
Joined: Tue, 18. Nov 14, 17:23
x4

Post by w.evans » Sun, 1. Feb 15, 23:06

alexalsp wrote:May, alternatively, if possible, through the mod to add the required number of drones 10-30 -50. ?

Or just buy the drones?
I'll think about it. I'm inclined to say no, though. Making a UI to magic the drones in will take too much work for very little gain, I think (editing a save or using nemesis1982's new editor would be much easier), and getting them to buy the drones will most likely require editing trade.station.player.xml and trade.station.xml. Tried modifying those for a different project, and I'm not looking forward to revisiting them anytime soon. Sorry.

I wonder if it would be possible to get the drones from the Construction Vessel.

edit: just checked. I don't think it's possible to get your CV to transfer drones directly to the station, but it IS possible to have a freighter trade with the CV first to get the drones, then trade with the station to give them. The two trades could even be queued.

w.evans
Posts: 2962
Joined: Tue, 18. Nov 14, 17:23
x4

Post by w.evans » Mon, 2. Feb 15, 12:41

2.Feb.2015 - v0.01_alexalsp is up!

alexalsp reported that stations were taking too long to repair. (longer than ~8 hours for fully destroyed stations.) v0.01_alexalsp increases the amount by which Engineer skill of player-owned station-based Engineers increases the rate of repair. (was a factor of 0.8 to 4.0, now a straight multiplier from 20 to 100)

Rather cheaty at the moment. Would prefer to find a decent balance which would then be applied to all station-based Engineers -- player-owned and NPC.

........
The alexalsp variant adds:

Code: Select all

<?xml version="1.0" encoding="utf-8"?>
<diff>
    <remove sel="/aiscript/attention/actions/set_value[@exact='$repairratefactor * this.combinedskill / 25']"/>

    <add sel="/aiscript/attention/actions/set_value[@name='$repairrate']" pos="before">
        <do_if value="this.defensible.isclass.station and (this.owner == faction.player)">
            <set_value name="$repairratefactor" operation="add" exact="$repairratefactor * this.combinedskill"/>
            <show_notification caption="'=== Station Repair Rate ==='" details="'%5 \n Repairing: %6 \n Raw Repair Rate: %2 \n Engineer Skill: %3 \n Repair Rate Factor: %1 \n Resultant Repair Rate: %4'.[$repairratefactor, $baserepairrate, this.combinedskill, ($baserepairrate * $repairratefactor), this.station.name, (100f * ($baserepairrate * $repairratefactor) / $Defensible.maxhull)]" queued="true" priority="7" sound="notification_generic"/>
            <write_to_logbook category="general" text="'%5 STATION REPAIR RATE: \n Repairing: %6 \n Raw Repair Rate: %2 \n Engineer Skil: %3 \n Repair Rate Factor: %1 \n Resultant Repair Rate: %4'.[$repairratefactor, $baserepairrate, this.combinedskill, ($baserepairrate * $repairratefactor), this.station.name, (100f * ($baserepairrate * $repairratefactor) / $Defensible.maxhull)]"/>
        </do_if>
        <do_else>
            <set_value name="$repairratefactor" operation="add" exact="$repairratefactor * this.combinedskill / 25" comment="engineer speeds up repair by up to 400% (meaning a fifth of the normal repair time)" />
            <!--<show_notification caption="'=== Ship/NPC Repair Rate ==='" details="'Repairing: %5 \n Raw Repair Rate: %2 \n Engineer Skill: %3 \n Repair Rate Factor: %1 \n Resultant Repair Rate: %4'.[$repairratefactor, $baserepairrate, this.combinedskill, ($baserepairrate * $repairratefactor), (100f * ($baserepairrate * $repairratefactor) / $Defensible.maxhull)]" queued="true" priority="7" sound="notification_generic"/>
            <write_to_logbook category="general" text="'SHIP REPAIR RATE: \n Repairing: %5 \n Raw Repair Rate: %2 \n Engineer Skill: %3 \n Repair Rate Factor: %1 \n Resultant Repair Rate: %4'.[$repairratefactor, $baserepairrate, this.combinedskill, ($baserepairrate * $repairratefactor), (100f * ($baserepairrate * $repairratefactor) / $Defensible.maxhull)]"/>-->
        </do_else>
    </add>
</diff>
to aiscripts/engineer.ai.xml

Still a lot of PDA and logbook spew at the moment to verify that the alteration is indeed working. Will be taken out once the increase is found to be satisfactory. If you want to take it out, simply comment out the <show_notification ... /> and <write_to_logbook ... /> lines.

edit: Also verified that the vanilla bug with Construction URVs failing to dock/docked Construction URVs not being made available is causing repair slowdowns -- subsequent repairs do not count those Construction URVs. Working on a fix now.

edit 2: fixed the problem mentioned in "edit:" here. Decided to implement the fix in a separate mod (and do tiny mods in general) to maintain modularity. (Is that a word? Modularness? Modulärheit?)

w.evans
Posts: 2962
Joined: Tue, 18. Nov 14, 17:23
x4

Post by w.evans » Thu, 5. Feb 15, 17:36

Was wondering why there are more people downloading Station Engineers than Engineer Drone Fix. Would have expected the opposite since Station Engineers adds something which isn't in vanilla (which, I imagine, not everyone would want), while Engineer Drone Fix is really nothing more than a workaround for a vanilla bug.

So, on the off-chance that this is due to a failure to communicate on my part, I would like to clarify that the Fix in Engineer Drone Fix is NOT included in Station Engineers.

I did it this way to maintain modularity -- so you could decide what you want in your game and what not. It's your game, so your call. Not for me to decide how you should play.

Rubini
Posts: 452
Joined: Mon, 7. May 07, 05:17
xr

Post by Rubini » Thu, 5. Feb 15, 17:57

Probably because Station Engineers have a mod "sattatus". I´m using both and they are great and working as intend. :wink:

Sparky Sparkycorp
Moderator (English)
Moderator (English)
Posts: 7650
Joined: Tue, 30. Mar 04, 12:28
x4

Post by Sparky Sparkycorp » Mon, 9. Feb 15, 01:36

Hi there,

Just to note, whilst I could assign an Engineer to my plot station from space, I wasn't able to while docked via remote conversation. Not a big deal but might be worth mentioning in the OP (I've no idea yet if plot-specific).

Regards,
Sparks

w.evans
Posts: 2962
Joined: Tue, 18. Nov 14, 17:23
x4

Post by w.evans » Mon, 9. Feb 15, 01:41

Always fired them off from the Skunk myself. Thanks for the report! Will update the op.

Sparky Sparkycorp
Moderator (English)
Moderator (English)
Posts: 7650
Joined: Tue, 30. Mar 04, 12:28
x4

Post by Sparky Sparkycorp » Mon, 9. Feb 15, 01:42

Me too normally. I tend not to be able to resist docking at the plot station though :)

w.evans
Posts: 2962
Joined: Tue, 18. Nov 14, 17:23
x4

Post by w.evans » Mon, 9. Feb 15, 01:48

Yeah. That is a special moment. Especially in the first playthrough. Although I shudder at the thought of the first playthrough of those who braved through X:R 1.0

I remember the very first time I got to that point, I literally sat there and occasionally flew around it in a drone to see it being built up close, until it was done. Then I docked, and there was no one there, which kind of sucked, but there was a special feeling knowing that those empty corridors were mine. Come to think of it, might have done that the second time too.

lubatomy
Posts: 214
Joined: Mon, 29. Dec 03, 16:22
x4

Post by lubatomy » Mon, 16. Feb 15, 15:36

w.evans wrote:Always fired them off from the Skunk myself. Thanks for the report! Will update the op.
this can be fixed in the <do_if....> line right above the one you change in the mod.

it does a check to see if the platform is player owned and isclassship. if you check for player owned and (isclassship or isclassstation) that should fix it to allow assigning an engineer to a station while you are in the station. I have not tested it myself but it seems like it should do the trick.

w.evans
Posts: 2962
Joined: Tue, 18. Nov 14, 17:23
x4

Post by w.evans » Mon, 16. Feb 15, 15:51

Thanks, lubatomy! Added:

Code: Select all

<replace sel="//cue[@name='OnBoardComm']/actions/do_if[@value='@player.platform.container.isplayerowned and @player.platform.container.isclass.ship']/@value">@player.platform.container.isplayerowned and (@player.platform.container.isclass.ship or @player.platform.container.isclass.station)</replace>
to NPC_Engineer.xml

Long time no see. How's your big project coming along?

w.evans
Posts: 2962
Joined: Tue, 18. Nov 14, 17:23
x4

Post by w.evans » Mon, 16. Feb 15, 16:41

16.Feb.2015 - v0.02 is up!

Now possible to call Engineers to work at a station platform when docked.

Thanks to Sparky Sparkycorp for reporting that this wasn't working before! Thanks to lubatomy for the fix!

Post Reply

Return to “X Rebirth - Scripts and Modding”