[SCR] Nanite Hull Repair (7 Sept 2011)

The place to discuss scripting and game modifications for X³: Terran Conflict and X³: Albion Prelude.

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

User avatar
arcana75
Posts: 2165
Joined: Tue, 2. Dec 03, 09:28
x3tc

[SCR] Nanite Hull Repair (7 Sept 2011)

Post by arcana75 » Sat, 18. Apr 09, 04:44

Repairs any of your ships' hull by using shield energy at a rate of 1% max shield for an even smaller amount to hull. The ship will stop and go into autopilot and repair the hull. The amount repaired is 1/10000 of your current shield strength. If the ship has e-cells onboard the amount is boosted 5x. Each cycle burns e-cells at the rate below:

Code: Select all

$ecUse = -5 
if $ship is of class {Carrier}
  $ecUse = -50 
if $ship is of class {Huge Ship}
  $ecUse = -50 
if $ship is of class {Big Ship}
  $ecUse = -20 
if $ship->is of class {Freighter}
  $ecUse = -10
If the shield drops to 25% or the hull is repaired or autopilot is turned off, the repair stops. If e-cells run out it reverts to the slower repair rate. If during repair more e-cells are added it resumes at the boosted rate.

Due to the usage of current shield strength to repair at the rate of 1% of max shield strength, using low-powered shields will be ... uneventful.

The command is in your intended ship's Special command.

[ external image ]
Superbox SPK Zip
Superbox Zip
Last edited by arcana75 on Wed, 7. Sep 11, 15:02, edited 5 times in total.

pelador
Posts: 1399
Joined: Wed, 6. Nov 02, 20:31
x3tc

Post by pelador » Sat, 18. Apr 09, 06:55

So you could repair a 50% damaged M2 in 50 seconds! by simply giving it a 1MJ shield?

The process is way too quick imho, be little point training marines in engineering skill for boarding consequences with it's use.

It would be better if it was scaled to a point of fixed hull amount scaled by equipment as you have mentioned, resources would help but have no qualms about using shield energy. I appreciate the need to make it an alternative to selotaping your mouse button when using the repair laser. But this as stands would make me more inclined simply to reach for Cycrow's cheat script.

E.g. Lets say you had three device variants: (S, M, L) with weighted costs.

The small repairs at a rate of 100 hull, Medium = 500 and Large 1,000. But the cycle time would be every 10 seconds rather than a second which would also help performance by reducing the frequency of cycles.

Examples, For a 50% damaged ship using estimated class averages:

Repair times (remembering these are IG times) using L device:

M3 = 8000 hull, 50% repair time ~ 40 secs.
TS = 17,500 hull, 50% repair time ~ 90 secs
M6 = 60,000 hull, 50% repair time ~ 5 mins
M7 = 275,000 hull, 50% repair time ~ 23 mins
M2 = 500,000 hull, 50% repair time ~ 42 mins

Comparing S device as above for small ships useage:

M3 ~ 7 mins
TS ~ 15 mins

M device:

M3 ~ 1.3 mins
TS ~ 3 mins
M6 ~ 10 mins

Each device could take a fixed amount of energy from the shields scaled to size, which would give more varience than a simple % linear model and add more character to the use of Nano-bots. It would also ensure you have the right size shield for useage. Depending on how they are weighted it would likley mean an M3 wouldnt be able to use an L or M, but it would also likley mean an M2 would have less drain on its shields than an M7. TL's might use the M variant. Again the S, M, L are really classes of shield type useage not vessel size but will likley correlate in the main but would probably need better class descriptions for "shopping" clarity. It also might take more device choices to cater for the spectrum of ships. Or alternatively the Nano-bots performance is programmed based on shield potential meaning you still only need one device, the idea of having different ones is for cost/benefit choice. Might take a spreadsheet to work it all out but be worth it in the end I think.

This then can be run as a script task on the ship that isnt using task 0 so that the auto-pilot/commands doesn't cause interupts. So in that sense you can fly/use the ship whilst repairs are underway. A local variable on the ship can monitor if a repair is in process to avoid duplication.

This is all purely one example of how a more "flavoured" process could work whilst keeping some semblence to "balance".

User avatar
arcana75
Posts: 2165
Joined: Tue, 2. Dec 03, 09:28
x3tc

Post by arcana75 » Sat, 18. Apr 09, 12:15

Totally agree with u, but sounds like alot of work.

How about a rate of X hull pts per Y shield points? A ship with reasonably sized shields would be able to repair itself reasonably quick, at the same time it can't be reasonably exploited by installing small shields?

For example, I'll take 1% shields every second, and repair hull a small fraction of the transferred shield power (eg 0.00001% of the original). So an M3 with 75MJ shields would repair 750 pts per second. The repair/shield loss is still linear, just different gradients.

I didn't want this script to work while flying cuz I could then hit the repair while fighting. I like that it has to go on autopilot and 0 speed; it's meant to work after battle or when claiming ships.

pelador
Posts: 1399
Joined: Wed, 6. Nov 02, 20:31
x3tc

Post by pelador » Sat, 18. Apr 09, 12:47

arcana75 wrote:Totally agree with u, but sounds like alot of work.

How about a rate of X hull pts per Y shield points? A ship with reasonably sized shields would be able to repair itself reasonably quick, at the same time it can't be reasonably exploited by installing small shields?

For example, I'll take 1% shields every second, and repair hull a small fraction of the transferred shield power (eg 0.00001% of the original). So an M3 with 75MJ shields would repair 750 pts per second. The repair/shield loss is still linear, just different gradients.

I didn't want this script to work while flying cuz I could then hit the repair while fighting. I like that it has to go on autopilot and 0 speed; it's meant to work after battle or when claiming ships.
Changing the gradient might not work in practice and the extended time would make it impractical for the playership if it cant operate commands, as the player would be sitting in space. Plus having an extended time frame is a natural balancer to allow repairs to occur over time that would have a minimal influence on battle situations. The loss of shields in doing so helps further.

Also changing the co-efficient means you'd lose significant shield energy faster than hull is repaired and even if it recharges you are then left with a possible situation of running out of energy. To a point where the 25% threshold is reached or even if removed down to 0 which removes repair potential. If you reduce the shield value used you open up the same problem of possibly using smaller shields or removing the balancing feature as effective. Thus the reason for extending the cycle time which would also help with performance as the script operating frequency is less.

An M2 with 4 2GJ shields. Using your model with have a repair rate of: 10 * number of MJ, so

8,000 MJ = 80,000 hull points a second so an average 99.9% damaged M2 (499,999) would be repaired in about 6 seconds, which is worse than the original design.

Extending the time frame will push things more towards less of a need to reduce shields as a balancer, it would be just finding the right balancing point. No pun intended ;)

Or alternatively making it pulse down to a specific point each cycle to provide a disincentive for running repairs and using the ship in combat concurrently. But there are problems in doing that as if you start repairs below the pulse point if not 0 (which might not make appropriate sense for the purpose of repairing) you have the same non-balancing issue.

Could consider pulsing laser energy down to 0, but the recharge times are much faster, so would have less influence over the extended periods required to make repairs anything but effectively instantaneous.

User avatar
arcana75
Posts: 2165
Joined: Tue, 2. Dec 03, 09:28
x3tc

Post by arcana75 » Sat, 18. Apr 09, 14:24

I believe a simple cap will prevent the imbalanced repair rate, at this juncture.

User avatar
arcana75
Posts: 2165
Joined: Tue, 2. Dec 03, 09:28
x3tc

Post by arcana75 » Sun, 3. May 09, 17:40

SPK added. Also modified the script to balance it abit, allowing the usage of e-cells to boost the repair rate.

pelador
Posts: 1399
Joined: Wed, 6. Nov 02, 20:31
x3tc

Post by pelador » Sun, 3. May 09, 19:27

Actually you've made it worse:

Boreas Shields = 10 GJ = 10,000,000 Shield energy.

1/10000 = 1000 * 5 = 5000 hull points a second repaired with e-cells

100 % repair 80s
50 % repair 40s (200,000 / 5000) whereas before it was 50s.

So, you have introduced e-cells as a balancer.

50% = 2000 e-cells = ( ( 200,000 / 5000) * 50 ) = Average repair 32,000 cr (A 50% repair bill for an M3 probably is around the million mark) for less than 25% cargo use of e-cells, hardly disabling. And 2000 e-cells wouldnt even be missed by most Solar fabs or complexes.

Imho, still in the realms of cheat rather than balanced the biggest problem being the time, which seems to have escaped your attention. Of course some people may like to make use of scripts like this to remove a certain aspect of the game for them. Personally for the costs and how it works I'd still prefer to reach for the Cycrows cheat package if I wanted to "band-aid" my fleet.

To be honest I dont want to make it such a big issue, if its makes you happy and brings other people fun then great script.

User avatar
arcana75
Posts: 2165
Joined: Tue, 2. Dec 03, 09:28
x3tc

Post by arcana75 » Mon, 4. May 09, 03:21

pelador wrote:Imho, still in the realms of cheat rather than balanced the biggest problem being the time, which seems to have escaped your attention.
Feedback to help tweak the script is one thing as at least the poster already subscribes to the script. Your post comes off as malicious rather than altruistic as I don't think u're giving feedback as an actual script user. Prove me wrong?

People are reaching for ways to reduce the mundane tasks in this game. Some SETA overnight. Others reach for scripts like marine trainers or automated universe ware finders or weapon switchers. Others still put weights on the ctrl to repair then walk away. We can argue till the cows come home but ultimately I believe it's due to a strange human quirk that they want to enjoy this game yet not cheat blatantly but also not break game atmosphere.

I personally use scripts like the marine trainer, the universe ware finder and my own scripts as they help automate and accelerate human tasks ingame that can be done quicker and easier. So no it did not escape my attention.

BTW your calculations are flawed because you forgot a few things like shield amount, cargo sizes and availability of e-cells. And I don't think a Boreas (M1?) owner will be bothered much by credits or time. He could also reach for the marine repair script which is a great alternative and I believe repairs just as quickly if not faster than my script.

I like the script this way, especially the amount that repairs without e-cells as I think I'll never bother with using e-cells. The current repair rate without e-cells is slower than the previous version but there will be some abberations since I can't look at every ship's stats.

Ultimately too low then why use it. Too high don't use it. In between is time I don't have to figure out. If it pleases u, just modify the script to repair 1 hull per second or some arbitrarily balanced value.

User avatar
s9ilent
Posts: 2033
Joined: Wed, 29. Jun 05, 01:45
x4

Post by s9ilent » Mon, 4. May 09, 03:31

With out going in to to much detail, I'm going to agree with pelador.

It is very fast. Yes, repairing at a dock is instantaneous, but I think you should be comparing it with a HQ's repairing instead.
i.e. I think it might be better to use the ship's waretype relvalue as the repair time-balance thingy.


My memory is a little sketchy on the exact details, but I think the rel value is the time it takes to produce/consume a single unit. e.g. Rel value 100 = 100seconds to make. (At a 1x multiplier)
So you could make it repair something like (1/relvalue hull)% per second, and then make it draw how ever much shields it needs to repair said hull amount | on sufficient shields to repair)

(Note, this is just a comment about time balancing, not cost balancing)

User avatar
Sir Squallus
Posts: 687
Joined: Thu, 10. May 07, 17:45
x4

Post by Sir Squallus » Mon, 4. May 09, 03:47

You also could Change the Skript to take~ 10% max shild Strengh and repair ~5% hull

only thing is the skript must get max Shildcont and Type so you have max shildstrengh then it should be Balanced, no cheat, and the user must think how and when to use it

pelador
Posts: 1399
Joined: Wed, 6. Nov 02, 20:31
x3tc

Post by pelador » Mon, 4. May 09, 04:01

arcana75 wrote:
pelador wrote:Imho, still in the realms of cheat rather than balanced the biggest problem being the time, which seems to have escaped your attention.
Feedback to help tweak the script is one thing as at least the poster already subscribes to the script. Your post comes off as malicious rather than altruistic as I don't think u're giving feedback as an actual script user. Prove me wrong?
I'm sorry you feel that way, but this is the second time you've made assumptions about my personality without any real basis of fact.

I dont write scripts or use them? Even though my sig contain references to my developments and my name appears in the community library. And previous advice started to indicate potential alternative script avenues you could take?

If you feel my attempts to help improve a more balanced script that would make it potentially more appealing and realisitc within the game parameters are offensive then I'll refrain from offering any help. If constructive critism is of no use to you and you don't want to improve and learn then feel free to defend your script how you want.

As an "olive branch" if you want to further understand other script avenues you could take I could potentially help, as others could do also.

I apprecite that people can become defensive about their creations who wouldn't. Natural reaction. I hope my comments dont deter you from continuence into scripting. This is why it should be fun and fun for all, hence my last sentence in my previous post. Game "improvement" can be a complicated subject as that reference means so many things to different people. So if my view of trying to marry ES's vision more closely to your development is simply something you dont agree with then fine. But at least then the word "balance" is missleading unless explained.

Apologies if my comments are not helpfull, but its my opinion and as a script/mod user, I thought you might appreciate honest feedback.

User avatar
arcana75
Posts: 2165
Joined: Tue, 2. Dec 03, 09:28
x3tc

Post by arcana75 » Mon, 4. May 09, 04:10

I think I'm going to leave the script as it is. :P

User avatar
arcana75
Posts: 2165
Joined: Tue, 2. Dec 03, 09:28
x3tc

Post by arcana75 » Mon, 4. May 09, 04:19

Minor bug fix, new version uploaded!

rbh2006
Posts: 7
Joined: Wed, 18. Oct 06, 01:14
x3

Post by rbh2006 » Mon, 14. Dec 09, 09:36

Pardon me for butting in- I was looking over the numbers for your calculations of the repairing of the ships hulls:

1) At 1/10,000 repair rate of the Current Shield Strength- a 10,000 J Max Shield would Start to repair at a rate of 1 Hull Point/ Sec., so 1,000 hull points in about 1,000 seconds or in about 16 min and 40 seconds.

1A) However at that same time, if the shields are depleting at a rate of 1%/sec, then the shields would be fully depleted in 100 sec. Your 25% cut-off of the shields means that the command would automatically shut off at 75 sec of operation.

1B) This now means that during that 75 sec time frame, let's just say, to keep the numbers simple, that the rate of repair actually stays the same as the Maximum Shield Strength, only 75 points of hull will be repaired before the 25% shield cut-off is reached.

This therefore now means that the shields would need to recharge B4 continuing the Hull Repair a total of 13 times B4 the whole 1,000 Hull Points are repaired.

If the Software/Ware actually has the Rate of Repair Decreasing with the current level of the shields, then the actual Rate of repair will decrease over time as the shields are drained, thus slowing the Rate of Repair as time goes on. Meaning that actually the Hull Points repaired will be less than they would if the calculations are based on the Max Shields that the ship currently has on board.

Here is an alternative option to make the rate be actually balanced and be useful for all ships:

Have the Hull Repair Rate as a constant based on the Actual Max Shield Strength of the Ship in question (E.g. Argon Buster with 10,000 J Shields), and the repair rate is actually 1 Hull Point for every 1,000 J Shield Strength. This means that the Ship repairs at a rate of 10 Hull Points/Sec. Then, with the Shield Depletion Rate at 1%/Sec, means that the same 75 seconds would yield a total of 750 Hull Points repaired, meaning that the Shields will only need to be recharged Once B4 the hull is totally repaired.

The only stumbling block I see, is that when your ship becomes more than 50% Damaged, the Nanobots have to spread out and cover much more area of the ship in order to repair the ship. Meaning that it will take longer to repair or make repairs than at a Shipyard more.

The smaller the repair, the Faster the Nanobots can repair because there are more Nanobots per area to repair.

I would suggest that:

1) the Rate of repair be in an inverse proportion to the % of Damage the Ship needs repaired.

2) The Standard Rate of Repair be stated for a 50% level of repair when Activated.

3) Hence (E.g., 50% Damage--> 1 Hull Point/Sec/1,000 J Max. Shield Strength(S.S.); at 25% Damage--> 2 Hull Points/Sec/ 1,000 J Max. S.S.; at 75% Damage--> 0.5 Hull Points/Sec/1,000 J Max S.S.)

As the Hull is repaired, the Rate of Repair increases.

The Game already calculates the % of Damage (Variable), The Max Shields (a Constant in the equation) are based on the Actual Shields on the ship.

The Rate of Depletion of the Shields will remain Constant, so the shields will always Shut-off after 75 Seconds of operation and automatically start to recharge to protect the newly repaired Hull, after which the Nanobots can be reactivated to finish the repair.

There could be 4 versions (S,M,L,XL) of the Nanobot repair Ware/Software, so that different Ships can have the Standard Repair Rates Listed above.

If a Ship that can carry M class cargo uses the S version, the Repair Rate will be 50% of the Standard Rate listed above.

If a Ship can carry L class cargo uses the S version the Repair Rate will be 33% of the Standard Rate. If the same Ship has the M version, then the rate will be 67% the Standard Rate.

If a Ship that can carry an XL version, uses the S version --> 25% Standard Rate. If it carries the M version 50% the Standard Rate. The L version 75% the Standard Rate.

The Shield Depletion Rate would be at the Rate dictated by the Size of the Ship, the Size of the Software/Ware and the Max Shields themselves.

Ideally, the Ships should carry the same size Ware/Software that they can carry for Maximum Efficiency.

The Formula should work like this:

((2 X (Max Hull Pts - Actual Hull Pts)/ Max Hull Pts) X (Actual Max Shields/1,000) X (Carried Software Size/Max Cargo Size)) X 15

Add the resulting number to the Actual Hull Pts B4 the equation and repeat the cycle until either the shields get to 25% or the Actual Hull Pts = the Max Hull Pts.

If the shields are at 25% and shut off the repair- send a message to notify that the ship is "recharging the shields. Check to resume repairs."

Have this Formula cycle every 15 seconds as the shield depletion will be calculated properly to 75 seconds.

I am not a scripter, not familiar with the programming code, but I have a head for calculations. I hope this helps.. Thanks for your hard work and Happy Holidays

User avatar
arcana75
Posts: 2165
Joined: Tue, 2. Dec 03, 09:28
x3tc

Post by arcana75 » Sat, 5. Jun 10, 01:42

Updated script (SPK and ZIP) for 2.7!

Wintersdark
Posts: 238
Joined: Thu, 15. Jan 09, 17:12
x4

Post by Wintersdark » Thu, 8. Jul 10, 05:58

Thanks! I love it =)

If I can request a feature, though, it would be: Please add a configuration screen (linked through CyCrow's community plugin config libraries?) to let the user adjust the repair rate factor and set a minimum repair rate (that would hopefully function even in the absence of shields).


Unlike other posters in the thread, I'm largely in the other camp. I strongly believe notions of balance and cheating in a purely single player game are largely absurd. Play the game the way it's fun for you!

My feeling, in regards to repairs, is that I can repair anything for free. It seems strange to me that my avatar/pilot can repair his own ship for free, but none of my other ships (which I like to imagine have their own pilots working for me) are able to repair themselves normally.

The extension to that is that I don't view time investment as relevant. I don't like boring parts of games. Sure, I could weigh down a key and go have a bath, but that's just silly and broken.

Currently, I use CyCrow's cheat function to repair recovered ships. It'd be free either way, but this way I don't have to stop playing to do it which is important given I have very limited game playing time in a week.

I don't like doing that, though. I do NOT want to be able to repair ships in combat, and I'd rather it not be instantaneous. Your script works very well for me here, because while it *can* be used in combat, forcing ships to stop and drain their shields is pretty much garaunteed to be fatal.

Also, I love that I can remotely order ships to repair themselves without needing to babysit them directly: important when you use remote sector salvagers! It sucks badly to have to order badly damaged ships capable of only extremely slow travel to fly to a dock for repairs.

Thanks again, I absolutely love this script!

dains
Posts: 61
Joined: Sat, 2. Jun 07, 18:12
x3

Post by dains » Mon, 30. Aug 10, 01:54

Ahhh, exactly what I've been looking for. I just downloaded the whole "mobile repair" thingy but haven't tried it out, then I saw this. I really like your approach, and while there's some debate about how much/little to repair, that strikes me as an argument over how fast warp drive or hyperspace really is.

(The answer by J. Michael Stracinsky(sp?) for the ships in Babylon 5 was "They move at the speed of plot" lol. Point being, it's irrelevant as long as it supports the execution of the story.)

So I think having your script fix ships at the speed of gameplay is entirely valid. I like having it require energy cells too, as that imposes both a credit cost and a logistical one- keeps it interesting!

Edit: Have you considered making this a ware, so that players have to go buy one for each ship? I'd suggest making it about equivalent to a jumpdrive or transporter device and putting it in the same stations. Also, like a jumpdrive, making it an M or L size so the dinky ships have to use repair facilities.

User avatar
Khaakbuster
Posts: 393
Joined: Sun, 8. Jan 06, 18:43
x3tc

Post by Khaakbuster » Fri, 14. Jan 11, 16:33

I really like the idea behind this. What I don't like is the high repair rate and the fact that you have to sit still in space and wait for the repairs to finish. That's why I decided to completely rewrite this script. So if anyone is interested in it - here you go:


[ external image ]
Advanced Nanite Hull Repair Version 1.0 (ZIP file)


Installation

Just copy the "Scripts" and "T" folder to your X3:TC directory.


What does it do?

This script adds another command to ships of the classes M1, M2, M7, M6 and TL - the "Advanced Nanite Hull Repair".

This ability will allow these ships to repair damaged hull over time by the use of shield generator energy. The repair rate and the shield drain rate depend on the strength of the power generator. The higher the output of the power generator the higher the repair rate.

Using this ability will slowly drain your shields. Having bigger shields installed will help you keep the command active for a longer period of time. On "weak" ships with little shields you may have to restart the repair process after the shields have been recharged.


How to use this?

You can start the repair process with the help of the "additional ship commands". That means that you can keep flying and even fighting! I wouldn't advice fighting a larger battle with such a shield drainer active. ;)

If current shield strength drops below 25 percent of installed shield power the process cannot be started or will stop if it was running.

Used slots:
Command Slot 1245
Text Page ID 7521 (conflicts with the old "Nanite Hull Repair" by arcana75, this is intentional !)


Versions
V1.0 - initial version

escondido
Posts: 243
Joined: Tue, 27. Dec 05, 01:29
x4

Post by escondido » Wed, 26. Jan 11, 09:23

hey m8...im playing the x-tended terran conflict mod and have instaled the first script....for now is working well....e hope you can make another and beter sript like this 100% compatible for this mod ( mi idea is the cript work very very slow..i mean the repair rate is like a snail :lol: ...thanks :wink:

boxleitnerb
Posts: 250
Joined: Mon, 5. Dec 05, 15:00
x3tc

Post by boxleitnerb » Thu, 15. Dec 11, 05:22

del

Post Reply

Return to “X³: Terran Conflict / Albion Prelude - Scripts and Modding”