Cargo Cloaking Device MK1

For discussion, technical assistance, and suggestions go to:

Developed for:
   X3-Reunion 2.0.02          (REQUIRED)
   Bonus Pack 3.1.05       
   Cycrow's Script Manager    (REQUIRED w/ Custom Wares Enabled)
   T File:   8764 (448764.xml)
   Command:  646  (In Piracy Menu)
   Page ID:  8764
   Ware:     None (Multiple custom wares via Cycrow's Script Manager)

What it does:
   Ahoy Matey.  The Cargo Cloaking Device MK1, when enabled onboard M5/M4/M3/TP/TS 
class ships, masks all illegal goods from detection by Freight Scanners by emitting 
a false cargo signature. 

   Use Cycrow's Script Manager to install the SPK file.  Custom Wares MUST be

Where to buy:
   The CCD is available to all at your local Pirate Base for the reasonable sum of
~1.4 million credits.
How to use it: The CCD can be activated in the Command Console in the Piracy section. Additionally, it can be mapped to a key (e.g. Shift-F1) from here: Options->Controls->Interface->Extensions->Cargo Cloaking Device MK1 Toggle Usage Notes: 1) This technology has its limitations. The greater the ratio of illegal goods to cargobay capacity, the greater the chance that detection may pierce the illusion provided by the CCD. 2) This device can only operate on M5, M4, M3, TS and TP class ships. 3) This device can be run on any player-owned ship, locally or remotely through the command console. 4) The illegal goods and their cloaked version are as follows: Spaceflies - Energy Cells Spacefly Eggs - Majaglit Space Fuel - Nostrop Oil Space Weed - Delaxian Wheat SQUASH Mines - Teladianium Captives - Passengers 5) The cloaked goods will be apparent to the pilot by the trailing asterisk (*). 6) When switched off, there is a delay before the cloaking effect fully dissipates. This delay can vary from negligible to 10 seconds. Other Notes: I don't know if there's a very good way to balance this script other than simply the price, so I suppose it's a borderline cheat script. However, the device is capable of failing so it doesn't remove all risk of illegal goods detection. If people feel I should, as an additional balancing element, I may also cause it to draw its power from the ship's shields. Other options, such as disabling the CCD when the cargo bay is open, and reducing the CCD's effectiveness relative to the current shield strength, are being considered. Balancing suggestions, aside from using energy cells, are welcome. I conceived of several ways to implement this device. Ultimately, I decided on replacing the cargo with a different fake ware for each illegal ware instead of a single generic faked ware. For one, I think this method has a certain style. Secondly, while a generic faked ware would have the advantage of not needing to code for each individual illegal ware, it would be less robust. IMPORTANT NOTE: THIS IS ONLY MY THIRD X SCRIPT. THERE MAY BE BUGS IN IT AND THIS SHOULD BE CONSIDERED A PUBLIC BETA TEST. I chose all currently unused command slots, etc., however, I will not seek official "dibs" on them until such time as folks feel that it is worthy. Obviously, I'd appreciate if other script authors would avoid these for the time being. At least until we see if anyone other than me wants to use this script. This script is my first to use global script tasks and local per-ship variables. I believe I did things right. Testing will tell. Known Bugs: 1) Faked goods can be transferred to another ship, and will remain faked until on a ship that has the CCD cycled off or until the forceoff script is run on that ship. Until I solve this, simply do not transfer the faked goods to another ship. (Turn the device off first and transfer the real goods.) Future: 1) I included all common illegal goods of which I'm aware. If there are other illegal goods I can add them on request. 2) Additionally, a large ship MK2 variant would be an option should it be requested. 3) One or more of the balancing ideas mentioned in Other Notes. 4) A similar device for hiding illegal ship extensions would be easy, but is not planned. 5) Perhaps it is too inexpensive/expensive? I'd appreciate input on this. 6) Right now, this script really won't work for automated traders. I have several ideas on how to address this, but will see if there's interest first. Files in Package: plugin.ccd.cloakcargo.xml (helper script-performs the cloaking/decloaking)
(troubleshooting script-forces decloak on a ship)
(setup helper script-creates the lookup table)
(main loop-runs globally)
(command script that toggles the device) setup.plugin.ccd.xml (setup script)
(uninstall script)
(t file)
Uninstall: Use the Script Manager to remove script files. This should install the uninstall script automatically. After loading a save game, this script should run and remove remove the command slot and hotkey registration. I suggest stopping the CCD from running on all ships and ensuring their original cargo is intact before uninstalling. If this doesn't happen, manually copy the uninstall script (available for download below) to your X3 scripts directory. Be sure to remove the uninstall script before re-installing CCD. You never want both setup.plugin.ccd.xml and setup.plugin.ccd.uninstall.xml installed in your scripts directory at the same time. Troubleshooting: In the unexpected event that a ship get's stuck with the faked cargo, I created a script that will disable the cloak on any ship and return all goods to their original forms. To use this script, go into the script editor and find plugin.ccd.forceoff.xml. With it selected, press the R key to run it. Press Enter twice, and then select Select Ship and press Enter. Navigate to the ship using the universe map. Once that ship is selected, the script will completely disable the cloak and return all items to their original forms. This technique requires two scripts to be installed: plugin.ccd.forceoff.xml and plugin.ccd.cloakcargo.xml. Because of this, neither of these scripts will be uninstalled if you uninstall the CCD using the Script Manager. This should not be necessary, I just created it as a precaution. Thanks: Again to all the tutorial authors Cycrow (for lots of things) Download: SPK Package v1.00: Uninstall Script v1.00: (Right-click->Save Target As...)