Page 1 of 2

[SCRIPT] Cargo Cloaking Device MK1 - v1.00 2007-02-02

Posted: Sat, 3. Feb 07, 02:39
by Greg_G
Cargo Cloaking Device MK1
(I highly recommend reading the above web page instead; it has
screenshots, is better formatted and has many more hyperlinks.

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.

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

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.)

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
5) Perhaps it is too inexpensive or 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)
plugin.ccd.forceoff.xml (troubleshooting script-forces decloak on a ship)
plugin.ccd.init.xml (setup helper script-creates the lookup table)
plugin.ccd.main.xml (main loop-runs globally)
plugin.ccd.toggle.xml (command script that toggles the device)
setup.plugin.ccd.xml (setup script)
setup.plugin.ccd.uninstall.xml (uninstall script)
448764.xml (t file)

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.

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.

Again to all the tutorial authors
Cycrow (for lots of things)

SPK Package v1.00: ... 2.2007.spk
Uninstall Script v1.00: (Right-click->Save Target As...) ... nstall.xml

Posted: Sat, 3. Feb 07, 03:40
by Klyith
NICE idea. I'll try this out, though I don't use the script installer usually so I have to get that up to date first. I assume from a quick look at the code that if I have CCD toggled on, then pick up a new spacefly or whatever, I have to turn it off and then back on again to cloak the new spacefly?

One little error: you're using a piracy command slot, but in descriptions you say to look in the combat section.

IMHO it isn't terribly unbalanced. It doesn't cloak the SOS, so there's a limit to how piratical you can really be with it. I mean, I've never successfully used a squash mine... Dunno what's so illegal about them...

Having it not work when the cargo bay is open is a cool & realistic idea, BUT a) implementing it would require a much faster loop checking the bay doors' status, which would be bad for performance; and b) what are the chances of getting scanned while the doors are open? It's not like anyone flies around with the bay open for more than 10 seconds.

Posted: Sat, 3. Feb 07, 04:05
by Greg_G
Hi Klyith :) Regarding your question, if you pick up an illegal ware while the device is on, it will be cloaked automatically within 10 seconds. There is no need to cycle the device.

As for the error, thanks for catching that. I C&Ped the Turret Rotate webpage to base this one on, and didn't make that change. I will fix the page and this post in just a sec.

And as for the cargo bay idea, that's exactly why I didn't want to do it, it would require more frequent checks, but I wanted to mention it in case people felt it was necessary.

Unlike my other two scripts (which I did SPK-only just because I wanted too :p), this one really needs it since it needs to add a bunch of wares which wouldn't be practical (or welcome!) with the CMP.

Posted: Sat, 3. Feb 07, 22:00
by Cycrow
Greg_G wrote:1) I included all common illegal goods of which I'm aware. If there are other
illegal goods I can add them on request.
without looking at the scritps i dont know exactly how u've done it, but by that im assuming u have hardcoded a list of goods for it to mask ?

just have to remember that some goods are illegeal in some race sectors but not others.

however, u can do it without hardcoding it at all. just get the tradable ware array for the ship, and check if each one is illegeal in the current sector.

for balancing, u could do something simlar that we did for Firelance, we had 2 methods, one was basically like a cargo hold upgrade that allows you to load illegeal goods into, but had a limited size, it worked in a simlar way to the Taxi Drivers guild cabin spaces if u've ever used that.
the other was a device that jammed the scanners which is basically what ur one is doing, how we balanced that was to make it occasionally fail, but when it does fail, the police detect the device and u get in more trouble than if u just had the illegeal goods, so u have to take a risk like with all ilegeal activities

Posted: Sat, 3. Feb 07, 22:42
by Greg_G
Cycrow wrote:just have to remember that some goods are illegeal in some race sectors but not others.
Indeed, but I intentionally decided to mask all potentially illegal goods so as to make it "safe" to travel from one region to another without worry.

I could easily change it so that it only masks those that are illegal in the current sector if folks request it.
Cycrow wrote:however, u can do it without hardcoding it at all. just get the tradable ware array for the ship, and check if each one is illegeal in the current sector.
Aye, this is true (and is what I could do anyways as I mention above), but the hardcoding was intentional. If you check the second paragraph of Other Notes above, I touched on this subject. I decided I wanted each illegal good to have a specific legal good that it is cloaked as, such as space weed showing as delaxian wheat, but not actually make it delaxian wheat which could then be sold as delaxian wheat.

Additionally, where I mention robustness, I was referring to a situation where, using a generic replacement system, if the data storing the wares hidden were lost somehow, the user would be stuck with the generic fake good. This way, instead of actually storing what was replaced in a variable, I just replaced the goods each with another faked good. This way even if something goes wrong, one can just run my force decloak script and their original carog will be safe. Admittedly, as long as I got everything right this is unnecessary, but because I'm new both to the development environment (scripting editor) and the production environment (x engine) I chose to err on the side of caution.

However, I realize there's a bug in my current system whereby a person can transfer the faked goods to another ship. Obviously not a generally useful thing to do unless the other ship has a CCD, but something I need to account for in the script. I'll give this some thought.

Thanks for the balancing ideas, I'll give them some thought as well.

Posted: Tue, 6. Feb 07, 15:29
by Puruco
Hi Greg: I install with Roguey mod and appear the famous read-text. Just to chek, install with XFP and same result. Both cases the install ware was check in the cycrow script installer.

Posted: Tue, 6. Feb 07, 19:56
by Greg_G
I'll double check the installer and the t file and get back with you. Thanks for the report.

Has anyone else tried this script and have this problem?

Edit: Puruco - I'm not spotting anything obviously wrong. You didn't specify where you are seeing the readtext (pirate base, command menu, control config) so I'm guessing stuff here. I extracted the files from the package and the t file and and t file references all seem right. I have two thoughts:

1) Did you enable Custom Wares in Cycrow's Script Installer? It's disabled by default IIRC. It must be enabled for this script to work.
2) Perhaps one of your other scripts/mods is using the same t file #/page id as this script. Take a look at (X3install)\t\448764.xml and see if the contents seem to be related to this script.

If the problem is the ware shows up as readtext at the Pirate Base but shows up properly in the command menu (after you buy the readtext item) or in Options->Controls->Interface->Extensions->Cargo Cloaking Device MK1 Toggle, then that means it's definately a problem with Custom Wares. If it shows readtext in all three places, then it's likely t-file related.

Posted: Tue, 6. Feb 07, 21:32
by Puruco
The read-text appears in the pirate station and the command slot. I think that in controls appear ok but not sure I will check tonigth. The custom wares in cycrow,s installer is enable.

So tonite I will check if their is another script conflicting. I'm almost sure that the name is correct in the command because i assig a key to it. Also I going to unistall and reinstall it, maybe that fix it. also I didn't test if it funtion properly even with the read-text.

Edit: Greg i know that the box beside custom ware in cycrow's installer have to be check. The box beside the mod name too?

Posted: Tue, 6. Feb 07, 22:04
by Greg_G
Alrighty, Puruco, I'll be happy to work through this with you. Once I know exactly and for sure where it gives a readtext (out of those three places) I should be able to narrow things down. And definately check that one t file once you are home.

This script shouldnt show up as a mod in the custom wares listing (at least it does not for me). It should, however, list 7 items down in the Ware list (e.g. Cargo Cloaking Device MK1, Majaglit*, etc.).

Posted: Wed, 7. Feb 07, 16:23
by Puruco
Hi: Sorry have no much time to do all because have to studie with my son. Have time to uninstall and reinstall, same problrm. Also I check the list in the cmmunity script library and did not find any conflicting script.

Tonite will try to do the rest. ohh almost forgot, when i install it appear the listing that you mention of 7 wares.

Posted: Wed, 7. Feb 07, 16:30
by Cycrow
the first box with the mod listing is selecting hich mods you want to add the custom wares too, any mods listed there will have the ware files added to

Posted: Wed, 7. Feb 07, 20:12
by Puruco
Cycrow wrote:the first box with the mod listing is selecting hich mods you want to add the custom wares too, any mods listed there will have the ware files added to
Ok, so maybe this is the problem. i have to check the mod box too, not only the custom wares box. I will do that the way this is the only ware that have this problem and because is the only ware(I think) that need to check the custom ware box maybe this fix it.

Thanks Cycrow...

Posted: Wed, 7. Feb 07, 20:29
by Greg_G
Ah, thanks for the clarification Cycrow. I don't run any mods (well I do, but only ship creator and some fake patches) so I was unclear on that subject.

Hopefully that'll fix you up Puruco, but if it doesn't, please let me know and we'll investigate further.

Edit: Fixed a typo

Posted: Wed, 7. Feb 07, 21:54
by Cycrow
it only lists the mod files that already have ware files, so if u use one of those mods then it will overright the custom ware files.

checking those will cause it to add the custom wares onto the files in the mod.

think of it as merging the custom wares mod with the selected mods

Posted: Thu, 8. Feb 07, 02:09
by Greg_G
Aye, I understand now. Thanks much for the clarifications.