Opening a contraband box doesn't identify the box, nor does it remove the box from the player's cargo.
This bug seems to be limited to the contraband box and not to any other types of ammo boxes.
This bug also applies to one of my mod's ammo boxes that generates a random item.
In any case, finding a contraband box and using it as many times as the player wants lets the him max Domina rank (from donating coffins and cadavers) and sell lots of illegals wherever possible for a few hundred thousand credits, possibly while in the New Beyond if found early enough. Makes the unlimited cash from thermo nanofac exploit look a bit tame.
This was a very subtle bug.
It was caused by adding custom properties to items. If you add a property to an item (using the <Properties>
element) then we potentially need to initialize those properties when creating the item.
The code that generates a random item has to create all items in the universe to see which ones match the specified criteria. Thus, we end up calling code that runs the initialization TLisp for any property.
When we run the TLisp for the property, we (naturally) set gItem
to be the item being created. Unfortunately, if gItem
is previously set to some value, we clobber it and never restore it.
So inside the call to use the contraband box, when we generate a random item, we clobber gItem
. Later when we identify and remove the ammo box, gItem
is set incorrectly, so nothing gets identified or removed.
The fix was to restore gItem
after initializing the properties.