[Mod] Hull Engineer v.6 released 12-3-13

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

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

Pendraco
Posts: 152
Joined: Sun, 5. Sep 04, 04:56
x4

Post by Pendraco »

I am excited to test this mod, thank you very much for all your work!
wwdragon
Posts: 3766
Joined: Mon, 1. Oct 07, 02:18
x4

Post by wwdragon »

I think that ship was just bugged. I captured a new taranis and crewed it; it's working great! :)

Thanks for the help.

I have one more question. How do I set it so that the .5 version will repair to 100 percent? :?
Thanks!
Editing posts since long before I remember.
Kierk
Posts: 115
Joined: Wed, 30. Oct 13, 16:38

Post by Kierk »

Still having troubles with uploading to rebirth nexus, looks like they're still setting stuff up.

To wwdragon. That sounds like the old vanilla bug where after the first time the script runs it doesn't properly count damaged or wrecked components. My component fix should get that to work again but its kind of a kludge. basically every time the script cycles (around 20-25 seconds) there is a 33% chance that it will redo its component list, categorizing things as damaged wrecked etc. Version .5 includes this fix automatically so it should work, how long are you giving it? I'd expect at least 2-3 minutes before stuff starts showing up again, plus you have to meet the damage threshold, how many turrets do you blow up?

To astaldion capping the repairs should be pretty simple, just a matter of adding an and this.ship.hullpercentange lt (whatever value) to each of the do_ifs handling hull repair. Fixing it to undamaged would require a new tracking variable and a do_if to set it to undamaged when hull is 100%. However its not something that I feel like including for wide release, as it doesn't meet the vision I have in mind for the mod. If you'd like PM me and I can tell you how to make the changes or see about sending you a custom version.

I personally have no problem with limiting hull repairs at all to shipyards, my issue was that pricing was based on the x3 style combat model where hull damage meant you did something wrong, and combat is done on the Rebirth model where cap shields only protect components. I happen to love the new combat model, but with the old repair pricing plans in place it meant that actually taking cap ships into combat got ridiculously expensive.

Regarding component repair, I actually didn't touch any of that code other than to fix the scanning for broken components, all the repairs with turrets and shields popping up again and again is default behavior. Changing it is possible but I kinda like the tactical decisions it forces you to make, take out the drone bay and lose out on drones or deal with a ship repairing itself in combat.

Basic vanilla component repair behavior is based on the number of drones on board, the number of elements destroyed or damaged and the max hp of the elements destroyed. If all you take out is a shield generators and a few flak turrets they'll repair up quickly since they have low hp. If you take out more components the repair rate will slow dramatically.
wwdragon
Posts: 3766
Joined: Mon, 1. Oct 07, 02:18
x4

Post by wwdragon »

Kierk wrote:To wwdragon. That sounds like the old vanilla bug where after the first time the script runs it doesn't properly count damaged or wrecked components.
Yeah :(


Anyway, what part of the .5 mod do I change to make it repair everything to 100?
Editing posts since long before I remember.
NBCDumb
Posts: 246
Joined: Fri, 7. Nov 08, 10:47
x4

Post by NBCDumb »

Hi, I've read the script version 0.40c and something bothers me:
<do_if value="this.container.isplayerowned">
<do_if value="$dronevalue == 0">
<set_value name="$hullrepairrate" exact=".01" />
</do_if>
<do_else>
<set_value name="$hullrepairrate" exact="$dronevalue * .03" />
</do_else>
[...]
The code that could set $dronevalue before that point is commented out.
Seems like using an uninitialized variable, no?

Sorry if I'm wrong or annoying.
Kierk
Posts: 115
Joined: Wed, 30. Oct 13, 16:38

Post by Kierk »

to wwdragon to repair hulls to 100% open the engineer.ai file in the mod folder in notepad, search for $hulldamagelimit. This should take you to a line that reads <do_if value="this.container.hullpercentage lt $hulldamagelimit">.
delete everything in quotes and replace it with the word true. When done it should read <do_if value="true">. Save the file and ships will repair up until the 100% limit.

NBCDumb don't worry about asking questions! Version .1 of hull engineer marks the first time I had even looked at XML stuff, so there is lots of messy stuff in there. The key is that this is a script that runs continuously, a fact that you can't see in just the mod file. The basic engineer.ai runs kind of like a BASIC file, where they label a section with a particular name and then later on in the script they use resume to go back to that particular label. On the first run through $dronevalue is in fact null and isn't even calculated until the very end of the script. For whatever reason when I tried to do it earlier in the script it failed and wouldn't work. Putting it at the end meant the first pass would fail, but from pass 2 onward it would work perfectly, so I figured good enough :).

Edit: Oh and in other news I finally got .6 loaded onto the NExus, way to bury the lede.
wwdragon
Posts: 3766
Joined: Mon, 1. Oct 07, 02:18
x4

Post by wwdragon »

Kierk wrote:to wwdragon to repair hulls to 100% open the engineer.ai file in the mod folder in notepad, search for $hulldamagelimit. This should take you to a line that reads <do_if value="this.container.hullpercentage lt $hulldamagelimit">.
delete everything in quotes and replace it with the word true. When done it should read <do_if value="true">. Save the file and ships will repair up until the 100% limit.
Thank you for the fast response. :)

Erm.... if it's always true, doesn't that mean the script will always run and always be repairing?
Editing posts since long before I remember.
Kierk
Posts: 115
Joined: Wed, 30. Oct 13, 16:38

Post by Kierk »

Yup, but the game hard codes in max values for hull, repair past 100% doesn't happen. Earlier versions had code to test for 100% but turned out not to be needed.
wwdragon
Posts: 3766
Joined: Mon, 1. Oct 07, 02:18
x4

Post by wwdragon »

Kierk wrote:Yup, but the game hard codes in max values for hull, repair past 100% doesn't happen. Earlier versions had code to test for 100% but turned out not to be needed.
Ah ok. Thank you! :)

Oh no! Now my new Taranis has stopped repairing itself too.
The only thing I've changed is that I added Manual Command Extension and used it's commands.
Does using those cause hull repair tasks to stop?
Editing posts since long before I remember.
KRM398
Posts: 1556
Joined: Wed, 6. Nov 02, 20:31
xr

Post by KRM398 »

A silly question: can this mod with a 4 star engineer on board fix destroyed objects like jump drives and engines? Got a gem sitting full of stuff for my station, dropped a 4 star engineer on it and a captain, then went over it with the repair laser, but it says that one engine is destroyed and the jump drive too, so it wont move at all, just hoping it took a long time...thats my station stuff sitting there...lol. :wink:
User avatar
Ringo7
Posts: 42
Joined: Fri, 29. Feb 08, 17:34
x3tc

Post by Ringo7 »

Hull engineer not working for me either. Also causing the buttons to not respond in the UI when viewing map or ship details. The buttons are enabled but not clickable. Using the keyboard (1,2,3 or 4) works though.

Rahanas has 66% hull damage, engines are damaged and been that way for 2 hours and nothing is being repaired. Engineer has been assigned, 11 construction drones, just nothing happening :/

Is there another mod that actually repairs damage to hull and engines?
Pendraco
Posts: 152
Joined: Sun, 5. Sep 04, 04:56
x4

Post by Pendraco »

I am currently using version .6, LOVE IT! I had 2 Rahanas that were basically stranded (Engines & jump drive damaged) No drones on boar, I docked with the skunk and with the 6 drones I have in the skunk mt 3 star engineer first repaired turrets. He then moved to engines, make repair on engine was to about 75% It took about 30 mins to repair the engines.

1 Hull is at 2% the other at 54% - My engineers are not skilled enough to start repairs on the hull. I really like this mod, actually has me out looking to hire better Engineer's!
Kierk
Posts: 115
Joined: Wed, 30. Oct 13, 16:38

Post by Kierk »

Ok after looking through a save file sent to me to research it looks like for some reason the engineer.ai script had stopped entirely. Some of his ships had engineers on board with job listing of 'none' others listed 'repair' but the script wasn't running. I set up a quick edit of CSE to force all engineers to the proper script. I'll put it on nexus as an optional file.
wwdragon
Posts: 3766
Joined: Mon, 1. Oct 07, 02:18
x4

Post by wwdragon »

Ringo7 wrote:Also causing the buttons to not respond in the UI when viewing map or ship details. The buttons are enabled but not clickable. Using the keyboard (1,2,3 or 4) works though.
That is a Rebirth bug, not to do with this mod.
Kierk wrote:Ok after looking through a save file sent to me to research it looks like for some reason the engineer.ai script had stopped entirely. Some of his ships had engineers on board with job listing of 'none' others listed 'repair' but the script wasn't running. I set up a quick edit of CSE to force all engineers to the proper script. I'll put it on nexus as an optional file.
Thank you. I'll give it a shot. :)

Edit:
Ok I've installed it tonight, but it does not appear to be repairing.
Does the CSE style fix require CSE to be installed?
I removed CSE before, when I thought it was conflicting with hull repairs and the author of it has blocked it being d/l'ed on nexus. :shock:

Does it require .6 or does it work with .5c?
Editing posts since long before I remember.
spartanheyho
Posts: 162
Joined: Sun, 24. Nov 13, 16:06

Post by spartanheyho »

Won't this conflict with the similar implementations the UFO mod author has made to defense officers which basically made CSE obsolete to begin with?
KRM398
Posts: 1556
Joined: Wed, 6. Nov 02, 20:31
xr

Post by KRM398 »

I have the .60 version installed and the new patch you mentioned, and after a fight and boarding attempt, my particle gun is at 50% and stays there, the rest of the ship is ok, but thats not being repaired. I see a few others asking something similar...please dont tell me that what little the engineer was doing has stopped, I have a couple saves since then...lol :wink:
Kierk
Posts: 115
Joined: Wed, 30. Oct 13, 16:38

Post by Kierk »

What CSE did was to search for all player owned ships with defence officers and set their script. My alteration was to change that to search for engineers and set their script to engineer.ai. UFO doesn't touch engineers, so no problem there. It was just a quick way to fix it while looking for a more complete solution. I realized later on last night that it won't work for anyone who used CSE before, since it was designed as a run once thing. I'll be working on a specific solution but don't expect to have it done until friday since I'm taking a bit of a break today.
wwdragon
Posts: 3766
Joined: Mon, 1. Oct 07, 02:18
x4

Post by wwdragon »

Kierk wrote:What CSE did was to search for all player owned ships with defence officers and set their script. My alteration was to change that to search for engineers and set their script to engineer.ai. UFO doesn't touch engineers, so no problem there. It was just a quick way to fix it while looking for a more complete solution. I realized later on last night that it won't work for anyone who used CSE before, since it was designed as a run once thing. I'll be working on a specific solution but don't expect to have it done until friday since I'm taking a bit of a break today.
Ah so it wasn't just me. Good to know. :)

Thanks for working on this at all!

I'm so frustrated with rebirth right now, because I can't leave the system where I'm building the plot factory!

I might just give up on rebirth for now, like the guys who made cse and ufo have. :(
Editing posts since long before I remember.
KRM398
Posts: 1556
Joined: Wed, 6. Nov 02, 20:31
xr

Post by KRM398 »

Yep, can confirm it, he stopped altogether, got into a fight and nearly lost my plasma cannon, and the particle gun was low too, so finished it fast and went and got repaired at a station. :wink:
NBCDumb
Posts: 246
Joined: Fri, 7. Nov 08, 10:47
x4

Post by NBCDumb »

Kierk wrote:NBCDumb don't worry about asking questions! Version .1 of hull engineer marks the first time I had even looked at XML stuff, so there is lots of messy stuff in there. The key is that this is a script that runs continuously, a fact that you can't see in just the mod file. The basic engineer.ai runs kind of like a BASIC file, where they label a section with a particular name and then later on in the script they use resume to go back to that particular label. On the first run through $dronevalue is in fact null and isn't even calculated until the very end of the script. For whatever reason when I tried to do it earlier in the script it failed and wouldn't work. Putting it at the end meant the first pass would fail, but from pass 2 onward it would work perfectly, so I figured good enough :).
I just understood why you cannot initialize variable in the script start : the position in the script is saved along with the NPC using the AI script: npc has an entity ID and with this ID you'll find something like this
<entity id="[0x11c4f]">
<script id="3863" name="engineer.ai" label="dorepair" time="159566" index="2">
<command type="repair"/>
<vars>
<value name="$NumofElements" type="integer" value="67"/>
<value name="$addedhullpercentage" type="hitpoints"/>
<value name="$adjustedengineering" type="integer" value="4"/>
<value name="$baserepairrate" type="integer" value="10"/>
<value name="$damagedelements" type="group" value="1226"/>
<value name="$debugoutputchance" type="integer"/>
<value name="$dockingbay" type="componentslot" value="32"/>
<value name="$dronevalue" type="integer"/>
<value name="$engskillmultiplier" type="float" value="1.4"/>
<value name="$finalrepairrate" type="integer" value="1"/>
<value name="$hulldamagelimit" type="integer" value="75"/>
<value name="$hullrepairrate" type="float" value="0.01"/>
<value name="$leadmultiplier" type="float" value="1.1"/>
<value name="$operationalelements" type="group" value="708"/>
<value name="$repairfrequency" type="time" value="1"/>
<value name="$repairrate" type="integer"/>
<value name="$repairratefactor" type="integer" value="5"/>
<value name="$restoreindex" type="integer" value="1"/>
<value name="$wreckedelements" type="list" value="3570"/>
</vars>
</script>
</entity>
AI script are not just started from first line at each gamesave load, they resume to where they stopped, which is really great, but also makes it very hasardous to update an AI script without running into troubles except if you start a fresh game with your new AIs....

I ended up having a <label name="init"/> which sets all my vars and an init flag (whose value has to be incremented with each major AI rewrite) which I check after each blocking operation (mostly <wait>), if flag is not set with the expected value (remember the increment part, in case you do major updates), <resume label="init"/>
And then all the variable lookup errors vanished from my debug logs!

Return to “X Rebirth - Scripts and Modding”