Script: Shield Shunt (to Energy Cells)

The place to discuss scripting and game modifications for X³: Reunion.

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

Maulkye
Posts: 181
Joined: Mon, 26. Jul 04, 19:09
x3

Script: Shield Shunt (to Energy Cells)

Post by Maulkye » Sun, 18. Dec 05, 01:47

AtomicDryad has taken over hosting of this little mod. His last post indicated it could be acquired at:
AtomicDryad wrote: This script is now available at http://x3.fnord.to/dl/Shield_Shunt_V2.rar
I've also made an .spk: http://x3.fnord.to/dl/Shield_Shunt_V2.spk
PS - Fell free to modify this mod as you wish. All I ask is that you keep my name in there somewhere.

Thanks!



Hey Guys,

I just finished my first script. In (very) short, it shunts power from the shields to generate energy cells. I set it to run with energy cells valued at 500 Watts and then everything gets derived from there (with some caps for sanity of course).


Story and Notes:

Teladi Shield Shunt - by Maulkye

Story

Only a few Wazouras ago, a bright young Teladi trader was running weapons through dangerous territory. Seeking to save costs he had taken a route known to be frequented by pirates. His plan was to swing deep into the rarely traveled areas of space to avoid entanglement with raiders, and by his calculations this would still be a shorter route than the safer and more frequented byways.

Unfortunately, a band of pirates returning to a secret base in deep space spotted the young Teladi's ship and it's considerably valuable haul of weapons. Faced by certain death the Teladi pilot quickly engaged the jumpdrive to escape, only to be greeted by a droning computer reminder that he had no jump fuel. Damn! He exclaimed. The Teladi now remembered that he had sold his fuel to increase his free cargo space, so that he could carry more weapons and further increase his profit. Being ages away from help and with death looming on the horizon, the young Teladi did the unthinkable. He offered 50% of his profits to his engineer if he could get them out of there alive.

The engineer quickly consulted his manual (Laforge’s Tips and Tricks volume NCC1701) and determined that he could shunt power from the shields to generate jump fuel. It was risky and the energy balance had to be right, but it could be done. All he had to do was start an energy cascade with a large enough initial drain from the shields, and the process should continue until the buffer storage banks in the shield generators were full. There were no guarantees, but with death as the only alternative, he began right away. After 5 minutes and with the pirates 6km away, the brilliant engineer managed to shunt enough power for the Teladi captain to enagage the drives and flee.

To this day, both Teladi are rich beyond their dreams, and have developed their new technology into a lucrative business. These wonderful devices can be acquired for around 150,000 credits at the Seizewell Equipment Dock, now owned by the two Teladi entrepreneurs. Stop by and say hello!



Script Notes

This script will slowly drain the shields of a ship using the Shunt to provide a limited amount of energy cells. I worked the math out initially to make sense, and then I tweaked it to be a little more fitting of my vision. Here are some notes about the script:

- Uses command 1230 (other ship commands) and thus does not trigger the autopilot
- Uses SS_WARE_SW_NEW11 (about 150k credits)
- Places the Shunt unit at the Teladi Equipment Dock in Seizewell. This sector and station are required in your galaxy (unless you alter the distro script)
- I've only done the English XML, but I think most folks know how to alter this. I haven't actually tried it, but I imagine you just change the XML file name to the appropriate language id (such as 398900.xml) and then change the Lang ID in the file to the same ID (such as 39).
- The shunt process cannot be stopped once it's started. (The energy transfer cascade is too volatile to try to stop once engaged). So, if you start this process in a dangerous area with low shields, you could endanger yourself. Be careful.
- Energy cells were valued at 500 Watts for the purpose of this script
- A minimum of 2500 Watts are need to start the cascade (3MJ shields or more): 500Watts * Production Amount of 5 EC = 2500
- The amount of cells produced during the cascade are based on the max number of megawatts a ships shield can carry + 10. So an M3 with 75MW of shields can create 85 cells if they have enough cargo space
- There is a 1000 Energy Cell cap for the shunt. (Shield buffers of any size have simple not been able to maintain a stable buffer when energy levels reach power levels in excess of 500,000 Watts).
- The shunt will stop if it has not reached it’s maximum output before it has reached the ship's cargo capacity (minus a 5 unit reserve).
- The shunt will terminate if the shields are destroyed or jettisoned such that the ships total shielding power is below the minimum required energy to drive the reaction (prevents endless loops if the shields are lost during shunting).
- The shunt always uses the minimum power required to run one cycle (set to 5 units * 500MW = 2500MW), even if there is only room for less than 5 cells in the ship. (The excess energy is bled into space).
- The Shield Shunt checks the ships actual energy amounts as it processes, so it will continue to run until the ships actual energy cell amounts are maxed.

Well, I think I’ve covered it, and I tested it with each ship type and each condition, but it’s pretty easy to miss stuff so let me know if you find an error.

Thanks,
Maulkye
Last edited by Maulkye on Sun, 10. Feb 08, 17:28, edited 21 times in total.

DarthVain
Posts: 842
Joined: Mon, 2. Jun 03, 11:53
x3tc

Post by DarthVain » Sun, 18. Dec 05, 03:09

Unfortunately can't connect to the link.
Another one bites the dust!!

DarthVain

Maulkye
Posts: 181
Joined: Mon, 26. Jul 04, 19:09
x3

Darnit

Post by Maulkye » Sun, 18. Dec 05, 03:26

Darn Yahoo briefcase is not very good.

I put it on a new link. It's not the best file hosting service, but it'll do for now. When you go there, you have to click a link near the bottom. This takes you to another page where you have to click the link "Download Here" near the bottom again. Sorry, this host is not very good, but it's there for now :)

(Linked at top of thread)

Once again, please let me know if this link works.
Last edited by Maulkye on Mon, 19. Dec 05, 00:42, edited 2 times in total.

DarthVain
Posts: 842
Joined: Mon, 2. Jun 03, 11:53
x3tc

Post by DarthVain » Sun, 18. Dec 05, 03:29

Download works fine now.

Will test your script :)
Another one bites the dust!!

DarthVain

Maulkye
Posts: 181
Joined: Mon, 26. Jul 04, 19:09
x3

Sorry

Post by Maulkye » Sun, 18. Dec 05, 05:24

Sorry, there was en error in the shield draining code that pulled out all the shields' power instead of the proper calculated amount. :(

I just uploaded the corrections. Apologies. :)

Again, Let me know if there are any bugs.

DarthVain
Posts: 842
Joined: Mon, 2. Jun 03, 11:53
x3tc

Post by DarthVain » Sun, 18. Dec 05, 13:34

Excellent,

No bug and works well :)

Great job Maulke :thumb_up:
Another one bites the dust!!

DarthVain

User avatar
Sandalpocalypse
Posts: 4186
Joined: Tue, 2. Dec 03, 23:28
x4

Post by Sandalpocalypse » Sun, 18. Dec 05, 13:52

The shield shunt is at all teladi eq docks

and

the shunt command is available without the shunt ware installed

dunno if it works though

Maulkye
Posts: 181
Joined: Mon, 26. Jul 04, 19:09
x3

Arg

Post by Maulkye » Sun, 18. Dec 05, 18:19

Sandalpocalypse wrote:The shield shunt is at all teladi eq docks

and

the shunt command is available without the shunt ware installed

dunno if it works though
Sandalpocalypse, I can't seem to reproduce either of these cases in any of my tests. What mods and scripts were you running at the time you ran my script? (maybe there was a ware or command conflict or something)

PS - The shunt distribution code is so specific. It picks one sector and one station before adding, so I can't think of any way that could go to all stations. I'll keep looking though.

If anyone else has a similar problem, please let me know.

User avatar
Sandalpocalypse
Posts: 4186
Joined: Tue, 2. Dec 03, 23:28
x4

Post by Sandalpocalypse » Sun, 18. Dec 05, 23:54

Yes I am pretty sure there is a conflict. I say this because the shield shunt command under Additional Ship Commands actually reports my level with the Assassins Guild (Script by Cycrow)

Maulkye
Posts: 181
Joined: Mon, 26. Jul 04, 19:09
x3

Darn

Post by Maulkye » Mon, 19. Dec 05, 00:13

Sandalpocalypse wrote:Yes I am pretty sure there is a conflict. I say this because the shield shunt command under Additional Ship Commands actually reports my level with the Assassins Guild (Script by Cycrow)
Yeah, I see it now (1220). It looks like 1230 is free. I'll remap to 1230 and post the changes. I'll let you know here when it's ready.

Maulkye
Posts: 181
Joined: Mon, 26. Jul 04, 19:09
x3

Ok

Post by Maulkye » Mon, 19. Dec 05, 00:46

I changed the command ID to use 1230 instead of 1220 so hopefully it all works properly and doesn't interfere with Cycrow's work.

I also changed the "Shunt Failed" messages to be incoming audio alerts instead of just logbook writes. It seems a little more intuitive that way.

The link has been updated at the top of the thread to go to the new file.

Let me know if there are any further problems.

Stanley Tweedle
Posts: 26
Joined: Tue, 6. Dec 05, 07:48
x3

Post by Stanley Tweedle » Mon, 19. Dec 05, 02:10

to clarify for myself.

the three textual xml's go in the script subdir.

and the numerical one in the T subdir?

correct?

im not sure however, as all the files in the script dir are pck's. and all the files in T are xml, though none so far have any words in their title.

Maulkye
Posts: 181
Joined: Mon, 26. Jul 04, 19:09
x3

Post by Maulkye » Mon, 19. Dec 05, 02:30

Stanley Tweedle wrote:to clarify for myself.

the three textual xml's go in the script subdir.

and the numerical one in the T subdir?

correct?

im not sure however, as all the files in the script dir are pck's. and all the files in T are xml, though none so far have any words in their title.
Sounds correct: in your X3 Reunion folder place the "textual files" (cas.Shunt.CMD.xml, setup.cas.Shunt.Attach.xml, setup.cas.Shunt.Distro.xml) into the "scripts" folder and the 448900.xml file in the "t" folder.

Let me know how you like it. :)
Last edited by Maulkye on Tue, 20. Dec 05, 00:59, edited 1 time in total.

User avatar
Sandalpocalypse
Posts: 4186
Joined: Tue, 2. Dec 03, 23:28
x4

Post by Sandalpocalypse » Mon, 19. Dec 05, 02:34

add folders to the zip

makes it easier

Maulkye
Posts: 181
Joined: Mon, 26. Jul 04, 19:09
x3

Good Idea

Post by Maulkye » Mon, 19. Dec 05, 17:12

Good plan, I'll do that after work today and put it on the file host.

Any other ideas?

I'm surprised no one has yet queried about my selection of 500 watts as the power valuation of an energy cell. Does this seem reasonable?

Post Reply

Return to “X³: Reunion - Scripts and Modding”