[MOD] Station Engineers

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

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

Post Reply
w.evans
Posts: 2963
Joined: Tue, 18. Nov 14, 16:23
x4

[MOD] Station Engineers

Post by w.evans » Sun, 1. Feb 15, 12:42

This tiny mod alters only two parameters to make it possible to assign Engineers to Stations. They should then act in exactly the same way as NPC Engineers in NPC Stations -- repair hull up to 100%, repair surface elements, and use Construction URVs to hasten repairs. Speed of repair will depend on the Engineer's Engineering skill, and the number of Construction URVs available.

Just checked, and it looks like the vanilla scripts are set to repair Stations to 100% by default.

edit: Huh. Didn't realize that you can't ask a CV to redeploy.

_____
What's New?

5.Jul.2015 - v0.05 is up.

Compatibility update. Now compatible with Linux and Mac versions. (v0.04 didn't work. This one should.)

Thanks to CulunTse for verifying and testing the linux update.

_____
As of v0.03, this is the mod in its entirety:

Code: Select all

<?xml version="1.0" encoding="utf-8"?>
<diff>
	<replace sel="//cue[@name='OnBoardComm']/actions/do_elseif[@value='not player.platform']/add_player_choice[@text='{1002,3008}']/@choiceparam">[0, 0, 'zone', player.primaryship.zone, null, null, 'selectplayerobject', ['cEngineer_worksomewhere_objectselected', null, null, true, false, false, false, true]]</replace>

	<replace sel="//cue[@name='OnBoardComm']/actions/do_if[@value='@player.platform.container.isplayerowned and @player.platform.container.isclass.ship']/@value">@player.platform.container.isplayerowned</replace>
</diff>
in md\NPC_Engineer.xml

_____
The file is available here:

http://www.nexusmods.com/xrebirth/mods/442/?

_____
Compatibility:

This mod is current as of X:R 4.00
Compatible with X:R 3.61

Compatible with Windows, Linux, and Mac versions of X Rebirth.

Fairly early in this little mod's development, eMYNOCK very graciously contributed code that was used in this mod. That code has since been published in eMYNOCK's two mods:

Player Shipyards and Enhancements
and Give us more Cloth please!

This mod is therefore incompatible with eMYNOCK's two mods. However, since eMYNOCK's mods are superior, I suggest that anyone interested in one of the two above mods drop this one and use that instead.

Also incompatible with:

mihaib's Repack Construction Vessel
Vim Razz' Human Resources

_____
Check out my other mods for X Rebirth:
MarineRebalance,
BetterAutoAim,
SmalltalkHack,
Epic Capital Ship Shields,
Engineer Drone Fix,
Slightly More Useful Plot Station,
DockAllDrones,
Miscellaneous OOZ Combat Tweaks,
Miscellaneous IZ Combat Tweaks,
DifficultyHack
Last edited by w.evans on Tue, 1. Mar 16, 08:17, edited 39 times in total.

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

Post by Sparky Sparkycorp » Sun, 1. Feb 15, 13:04

Epic 8)

Smallest, lovely mod ever? Hehe

w.evans
Posts: 2963
Joined: Tue, 18. Nov 14, 16:23
x4

Post by w.evans » Sun, 1. Feb 15, 13:12

Enjoy! (Hope it works.) *Fingers crossed*

User avatar
YorrickVander
Posts: 2689
Joined: Tue, 29. Oct 13, 21:59
x4

Post by YorrickVander » Sun, 1. Feb 15, 13:20

Nice one :) You have any plans to add ware useage to the engineers? I did some experiments with limiting npc faction budgets a while back which would tie in well with that for actual economic warfare. I'll pm you the very early test scripts if you're interested as I barely have time to bug fix my current stuff atm without a new large project.
X Rebirth - A Sirius Cybernetics Corporation Product

Split irritate visiting pilot with strange vocal patterns.

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

Post by Sparky Sparkycorp » Sun, 1. Feb 15, 13:36

Ware usage would lilely have Scoob dancing in front of his monitor :)

Is the general idea for that sort of think to automate/semi-automate it via buy orders?

w.evans
Posts: 2963
Joined: Tue, 18. Nov 14, 16:23
x4

Post by w.evans » Sun, 1. Feb 15, 13:41

Not at the moment, but doable. Mod won't be so tiny then, though.

Alter the NPC engineers to use wares as well?

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

Post by alexalsp » Sun, 1. Feb 15, 13:43

Great mod and idea. Is it possible to improve the mod , what would the engineer repaired the station up to 100 %. That would be great.

w.evans
Posts: 2963
Joined: Tue, 18. Nov 14, 16:23
x4

Post by w.evans » Sun, 1. Feb 15, 13:46

@alexalsp, yup. Just checked the vanilla engineer script and it looks like it'll repair to 100% by default.

Code: Select all

      <do_if value="this.defensible.isclass.station">
        <set_value name="$hulldamagelimit" exact="100" comment="below what percentage hull is a component considered damaged"/>
      </do_if>

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

Post by alexalsp » Sun, 1. Feb 15, 14:02

w.evans wrote:@alexalsp, yup. Just checked the vanilla engineer script and it looks like it'll repair to 100% by default.

Code: Select all

      <do_if value="this.defensible.isclass.station">
        <set_value name="$hulldamagelimit" exact="100" comment="below what percentage hull is a component considered damaged"/>
      </do_if>
Thank you. 'll check.

w.evans
Posts: 2963
Joined: Tue, 18. Nov 14, 16:23
x4

Post by w.evans » Sun, 1. Feb 15, 14:44

YorrickVander wrote:I'll pm you the very early test scripts if you're interested as I barely have time to bug fix my current stuff atm without a new large project.
Would love to see your test scripts. No guarantees on implementing them though. I'll have to understand them first, and I don't know if I can!

w.evans
Posts: 2963
Joined: Tue, 18. Nov 14, 16:23
x4

Post by w.evans » Sun, 1. Feb 15, 14:49

Also, would anyone happen to know where the ware usage of Architects are to be found? Looked in NPC_Architect.xml (architects don't seem to have an aiscript), and the only relevant things I could find there are blocks for making ware lists for drones and ammunition, and to turn those ware lists to order lists, and order lists to buy orders.

User avatar
euclid
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 13288
Joined: Sun, 15. Feb 04, 20:12
x4

Post by euclid » Sun, 1. Feb 15, 15:09

To my best knowledge the architect only deals with ammo & drones. He also handles the wares required for repairs & extension but this is done seperately.

So I'm not sure why someone would have the engineer handling wares.

Cheers Euclid
"In any special doctrine of nature there can be only as much proper science as there is mathematics therein.”
- Immanuel Kant (1724-1804), Metaphysical Foundations of the Science of Nature, 4:470, 1786

w.evans
Posts: 2963
Joined: Tue, 18. Nov 14, 16:23
x4

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

Hi euclid,

didn't notice that you're a mod before now. Congratulations?

It's to make the engineer use wares to repair stations, the way that architects use wares to repair stations in vanilla.

User avatar
euclid
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 13288
Joined: Sun, 15. Feb 04, 20:12
x4

Post by euclid » Sun, 1. Feb 15, 15:27

w.evans wrote:Hi euclid,

didn't notice that you're a mod before now. Congratulations?
Heheh, cheers, they kind of forced me into that. Let's see how it goes ;-)
w.evans wrote: It's to make the engineer use wares to repair stations, the way that architects use wares to repair stations in vanilla.
The engineer will repair a station to 100% and that includes destroyed subsystems. So there is no need for him to acquiring wares for that.

However, if you want to alter that then it'll be a major "hack" because you need the corresponding repair list from the architect and hence the associated UI part. Also the wares buy offer is usually issued at the CV so you need to change that to the station.

In short: this would require quite some script & "hack" work. Not sure it's worth it.

Cheers Euclid
"In any special doctrine of nature there can be only as much proper science as there is mathematics therein.”
- Immanuel Kant (1724-1804), Metaphysical Foundations of the Science of Nature, 4:470, 1786

w.evans
Posts: 2963
Joined: Tue, 18. Nov 14, 16:23
x4

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

Thinking about it, would provide a nice additional resource sink if all stations required wares to repair, though, if it works. Although it could also cripple the economy with NPC stations requiring wares which the economy is unable to provide.

w.evans
Posts: 2963
Joined: Tue, 18. Nov 14, 16:23
x4

Post by w.evans » Sun, 1. Feb 15, 18: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: 1820
Joined: Fri, 18. Jul 14, 05:28
x4

Post by alexalsp » Sun, 1. Feb 15, 20: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: 2963
Joined: Tue, 18. Nov 14, 16:23
x4

Post by w.evans » Sun, 1. Feb 15, 21: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: 1820
Joined: Fri, 18. Jul 14, 05:28
x4

Post by alexalsp » Sun, 1. Feb 15, 22: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: 2963
Joined: Tue, 18. Nov 14, 16:23
x4

Post by w.evans » Sun, 1. Feb 15, 22: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.

Post Reply

Return to “X Rebirth - Scripts and Modding”