[MOD] Improved (full rewrite) Engineer

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

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

Mad_Joker
Posts: 274
Joined: Sun, 14. May 06, 11:21
x3

Post by Mad_Joker »

Jey123456 wrote:There might be an incompatibility between the hullengineer mod and the improved engineer mod (as they both affect the same file).

You might need to disable the hull engineer (the improved engineer also repair the hull anyway). But since its en extension, youll most likely have to remove the mod from your save for it to work (or it wont let you load it).

With this mod (improved engineer) properly running, the engineer doesnt need anything to do emergency repairs/rebuild on every components up to a certain limit (depend on your engineer skill but for components its around 50%).

Its not made to fully replace shipyard for repairs (altho its a single value to modify for it to repair to 100% hull). Nor is it made to allow engineer to work fully without construction drones. Engineer on its own without construction drone, is able to get your ship back moving with about 10% hull and 50% on each components.

To see if the improved engineer mod is currently active / working (not in conflict with another mod), fly very close to the center of your ship (touch the ship in its center so to speak). If the improved engineer is working you will receive a realtime status report in the bottom right of your screen.
A suggestion for you to increase compatibility with other mods (by making the game ignore them):

Since you rewrote the whole engineer.ai script anyways, you could just create a fully new script and called it 'engineer.ai.improved'. Then make a diff which changes only line 243 in NPC_Engineer.xml in the md folder to

Code: Select all

<start_script object="$actor" name="'engineer.ai.improved'"/>
The diff code is also very easy (didn't test this though):

Code: Select all

<replace sel="//start_script[@name='&apos;engineer.ai&apos;']/@name">'engineer.ai.improved'</replace>
This way, if a player has another mod installed that changes the existing engineer.ai script, that change will simply be ignored.

Note, that if you do this, you should on first load (use event_player_created without resetting the cue) go over all the player's ships and start your script on all engineers. I think the CSE mod does something similar for defence officers, so you should be able to copy their code for this.
Jey123456
Posts: 259
Joined: Sat, 23. Nov 13, 09:48
x4

Post by Jey123456 »

While its true that it would cause my mod to work no matter the other engineering mod, it wouldnt really solve anything heh. It would simply hide the problem (the user expect both mod to work, and only one is working).

I rather both not work so that the user can see there is a problem and fix his configuration instead.
iankemp
Posts: 22
Joined: Sat, 24. Feb 07, 16:20
xr

Post by iankemp »

Thanks for reply.
This freeplay is my mod testing ground 8)
I've found the incompatible mod!
Upclose Detailed monitor: http://xrebirth.nexusmods.com/mods/80/
Without it he starts repairing! Works great! Great mod.
He repaired in this order: turrets, shields, engines
Jey123456
Posts: 259
Joined: Sat, 23. Nov 13, 09:48
x4

Post by Jey123456 »

strange that this mod would conflict in your case... i just had a look at what file the mod affect and it didnt touch ai.engineer

Also, it is weird that it would had started by the turrets then shield... engine should definitly be the #1 priority, followed by jump drive... mmmm
User avatar
Jack08
Posts: 2993
Joined: Sun, 25. Dec 05, 10:42
x3tc

Post by Jack08 »

Jey123456 wrote: Also, it is weird that it would had started by the turrets then shield... engine should definitly be the #1 priority, followed by jump drive... mmmm
Because you patched the script directly, and didn't create a new one with an MD cue to replace the existing, there is a chance that its state would be corrupted apon installation on any ship that already had an engineer. That seems to be what is happening to me as my engineer is doing nothing, will have to re-assign him i think.
Jey123456
Posts: 259
Joined: Sat, 23. Nov 13, 09:48
x4

Post by Jey123456 »

My script is made to not care about that, thats why my initialization is done directly in the loop and use the most recent variable state as a way to know if it need to be reinitialized (from patch) or not.
swatti
Posts: 1278
Joined: Sun, 7. Dec 03, 12:03
x4

Post by swatti »

SUGGESTION: Start from normal engines, then jumpdrive, then rest. Gets the poor tub moving faster.

EDIT: or maybe dronebay first to "get some backup" if aviable.


PS: still havent found a way to add constructor-drones to ships.
Jey123456
Posts: 259
Joined: Sat, 23. Nov 13, 09:48
x4

Post by Jey123456 »

The order its supposed to go in the improved engineer is

engine > jumpdrive > dronebay > shield > weapon > components > shiphull

as said in the first post, but something might be wrong in the code that determine which next component to work on. Destroyed components are slightly lower priority than the still functional ones.
swatti
Posts: 1278
Joined: Sun, 7. Dec 03, 12:03
x4

Post by swatti »

Oh, ok. Just kep getting a message about guns etc when engines were busted. Didnt take too long for them to come back on tho.

Someone needs to ficure out how to transfer drones now. Constructor/repair-drones arent sold in the shipyards.
Jey123456
Posts: 259
Joined: Sat, 23. Nov 13, 09:48
x4

Post by Jey123456 »

My current "new" project is to fix the economy globally. I already have some pretty good steps toward it (i fixed most if not all cases of ships ending up stuck mid trade) but its still too raw to be made into mod / patch and there are still issues i want to fix / test before pushing it public heh (like the code that freetrader use to determine what to buy / sell etc so that the economy can work as a whole again).

Right now my freeplay universe economy is down the drain with barely any production, mostly due to the inability of the ai tradeship to move enough of the initial commodity around.

which well, over multiple production steppe, you end up with like 3 drone built for the whole shipyard (which are bought pretty quickly by ai)


If i can fix my ai trader code to bring the economy back to some sort of balance, then it will be worth a mod !
dez505
Posts: 172
Joined: Wed, 6. Nov 02, 20:31
x4

Post by dez505 »

Jey your an epic guy, thanks for brining over your skillz :P
User avatar
MartinSGill
Posts: 128
Joined: Tue, 10. Feb 04, 02:08
x4

Re: [MOD] Improved (full rewrite) Engineer

Post by MartinSGill »

Jey123456 wrote:http://xrebirth.nexusmods.com/mods/204/?
the repair priorities are engine > jumpdrive > dronebay > shield > weapon > components > shiphull
I love this mod! :D

I'm generally very happy with this repair order, it makes good sense.

One thing though is do you need sub-light engines to jump? If you don't shouldn't jumpdrive be first?

If I'm under attack, I want the option to get the hell out of there fast, and if I've already lost my engines and cannot manoeuvre then I'd want to jump out.

Of course, this might require someone to write an excellent Captain AI :P
redshift690
Posts: 35
Joined: Tue, 26. Feb 13, 20:43
x4

Post by redshift690 »

Jey123456 wrote:My current "new" project is to fix the economy globally. I already have some pretty good steps toward it (i fixed most if not all cases of ships ending up stuck mid trade) but its still too raw to be made into mod / patch and there are still issues i want to fix / test before pushing it public heh (like the code that freetrader use to determine what to buy / sell etc so that the economy can work as a whole again).

Right now my freeplay universe economy is down the drain with barely any production, mostly due to the inability of the ai tradeship to move enough of the initial commodity around.

which well, over multiple production steppe, you end up with like 3 drone built for the whole shipyard (which are bought pretty quickly by ai)


If i can fix my ai trader code to bring the economy back to some sort of balance, then it will be worth a mod !
Very nice to see someone working on this! Thank you! I can't wait to try it out! :)
User avatar
Vespy
Posts: 27
Joined: Tue, 19. Nov 13, 01:28

Post by Vespy »

oh my gawd...

I just spent about 3 hours trying to figure out why this mod wasn't working for me, read through every comment, searched a bunch of sites, started a new game save, reset engineers in the savefile, everything...

Finally, I finally see that I had installed the mod to extensions/Improved Engineer-204-0-98/ImprovedEngineer/content.xml instead of
extensions/ImprovedEngineer/content.xml .

:headbang:


And it's like the 10th mod I installed...


:lol:

Works great now, thanks for a great mod :)
Find the mods that make X:Rebirth work for you: xrebirth.nexusmods.com
User avatar
Jack08
Posts: 2993
Joined: Sun, 25. Dec 05, 10:42
x3tc

Post by Jack08 »

My game has started throwing this error at me, at intervals of about 5 seconds.

Code: Select all

[General] ======================================
[=ERROR=] Script error: Division by zero!
* Expression: 100f * $repairrate / $nextRepairTarget.maxhull
[General] ======================================
Gotta love DivZero :D
AndersCW
Posts: 45
Joined: Thu, 29. Apr 10, 03:15
x3tc

Post by AndersCW »

love it! :)

but!!! i think it's working backwards - in my case it started with the guns :)
To infinity and beyond!
G3n0c1de
Posts: 11
Joined: Tue, 26. Nov 13, 08:48

Post by G3n0c1de »

I can't tell if the mod is working.

Immediately after I activated it two of my ships with light damage immediately gave me reports of things being repaired.

The two ships with almost all components destroyed due to boarding aren't giving me any reports, even when I'm close enough for the 'real time' ones.

They both have engineers.
Jey123456
Posts: 259
Joined: Sat, 23. Nov 13, 09:48
x4

Post by Jey123456 »

mmm, its the first time i hear of a case where it doesnt work on a ship with an engineer.

What ship model is it ? i noticed some ships are too large for you to get in range of realtime message heh. (since its the center of the ship not the border).
swatti
Posts: 1278
Joined: Sun, 7. Dec 03, 12:03
x4

Post by swatti »

GIEF DRONEZ!

Right, anyone know how to edit the save-file?

Just got an idea. Ive got 20 cargolifter-drones on one of my ships. THOSE can be added via shipayards, SOOO, if i add "specifig" amount of them, search that number on the save-file and replace them with "units_size_xs_welder_drone_macro" that is supposedly the builder-drone, would that work?

Problem is, what is the name of the cargo-drone in the save? Where or how do i add "welder_drone" in the save-file or can i just swap it with the cargo-drone?
Logain Abler
Posts: 2255
Joined: Mon, 31. Oct 05, 08:44
x4

Post by Logain Abler »

swatti wrote:GIEF DRONEZ!

Right, anyone know how to edit the save-file?

Just got an idea. Ive got 20 cargolifter-drones on one of my ships. THOSE can be added via shipayards, SOOO, if i add "specifig" amount of them, search that number on the save-file and replace them with "units_size_xs_welder_drone_macro" that is supposedly the builder-drone, would that work?

Problem is, what is the name of the cargo-drone in the save? Where or how do i add "welder_drone" in the save-file or can i just swap it with the cargo-drone?
Search the save for owner="player" with Notepad++, you'll find your ships listed. Drones are under <ammunition><available><available/><ammunition/>

LA

Return to “X Rebirth - Scripts and Modding”