[(BG2) BUG] Restore and fix opcode 243 (0824)
AndreaColombo
Member Posts: 5,533
This bug fix request was originally posted by @Wisp (*cues @Bhryaen for some winking*) in the Feature Request forum and got buried within the 400+ other requests, so I thought I'd report it here (the original post can be found here.
CURRENT BEHAVIOR:
Effect 243 (Drain item charges) used to work in SoA, but it was buggy and sometimes it would destroy items seemingly at random, even ones without charges (including quest items). Bioware "fixed" this in ToB by simply disabling the entire effect.
It would be ever so nice if this effect could be restored to working order (sans the bugs). Additionally, I think it would be neat if the effect could be expanded to take the number of charges to be drained as its parameter 2 (currently thought to be unused).
EXPECTED BEHAVIOR:
Expected/desired behaviour is adapted from the spell description of the summon nishruu spell and presented in a IESDP-like format:
243 (0x0F3) Item: Drain Item Charges [243]
Parameter #1: Item Type
Parameter #2: Number to Drain
Description:
Magical items matching the 'Item Type' value on the targeted creature(s) will have their charges drained by Number to Drain. Non-recharging items drained of all their charges are destroyed.
Known values for 'Item Type' are:
0 Magical items excluding weapons
1 Magical items including weapons
I do not know what is exactly feasible, but conceivably this effect could limit itself to draining charges from ability headers of type 3 (magical ability), and only destroying the item if the word at 0x24 in the ability header is not 3 (i.e., don't destroy recharging items) and if said charge count reaches 0 as a result of the drain.
NB. If the number-to-drain bit is implemented, the existing uses of this effect need to be amended to have a non-zero value for parameter 2. For reference, these are nishruu.itm, spellh01.itm, golmag01.itm, spin550.spl and spwm140.spl.
CURRENT BEHAVIOR:
Effect 243 (Drain item charges) used to work in SoA, but it was buggy and sometimes it would destroy items seemingly at random, even ones without charges (including quest items). Bioware "fixed" this in ToB by simply disabling the entire effect.
It would be ever so nice if this effect could be restored to working order (sans the bugs). Additionally, I think it would be neat if the effect could be expanded to take the number of charges to be drained as its parameter 2 (currently thought to be unused).
EXPECTED BEHAVIOR:
Expected/desired behaviour is adapted from the spell description of the summon nishruu spell and presented in a IESDP-like format:
243 (0x0F3) Item: Drain Item Charges [243]
Parameter #1: Item Type
Parameter #2: Number to Drain
Description:
Magical items matching the 'Item Type' value on the targeted creature(s) will have their charges drained by Number to Drain. Non-recharging items drained of all their charges are destroyed.
Known values for 'Item Type' are:
0 Magical items excluding weapons
1 Magical items including weapons
I do not know what is exactly feasible, but conceivably this effect could limit itself to draining charges from ability headers of type 3 (magical ability), and only destroying the item if the word at 0x24 in the ability header is not 3 (i.e., don't destroy recharging items) and if said charge count reaches 0 as a result of the drain.
NB. If the number-to-drain bit is implemented, the existing uses of this effect need to be amended to have a non-zero value for parameter 2. For reference, these are nishruu.itm, spellh01.itm, golmag01.itm, spin550.spl and spwm140.spl.
Post edited by Bhryaen on
3
Comments
However, there is a note here that explained that the function was horribly messed up to avoid destroying items like "Familiar, weapon bits etc...". Can someone provide me with a list of item types that should not be destroyed please?
The three first would be for flags at 0x18 in the ITM header:
The first would be for the 'unsellable' flag (bit 0). No draining if this flag is set.
The second would be for the 'droppable' flag (bit 2). No draining unless this flag is set.
The third check would be for the 'magical' flag (bit 6). No draining unless this flag is set.
The fourth check would be for item category/type (word at 0x1c in the SPL header). I will have to get back to you on which exact categories should be eligible, or left alone.
You would still have problems with most non-spell scrolls and some other items, but you can conceivably get around that by deleting the header in those cases.
(I can see why Bioware just disabled it.)
This won't matter too much with BGEE, but when we start getting nishruus running around BG2EE we'll have some fun.
K, I can make those checks.
Yeah, ITM. Sorry. Maybe bit 5 as well? (frankly, I don't know what it does) Scratch that. It is set for all sorts of items.
The charge removal type could be specific too. As far as we know it could be 0,1,2,3. And only 1/2 should destroy an item.
And the checks are made as well. My precious kitty was totally unscathed by the mean old nishruu, but my wand of monster summoning was not so lucky.
My install still has these stones with magic expendable abilities.
Well, at least gems are not 'magical', so they will be save, despite these redundant, excess, useless, etc... abilities.
In BG2 we potentially run into problems with the Tome of Infinite Spells (MISC3A*), some droppable creature items (CARSOMYR, CHALCY3) [set to undroppable in the CRE, I assume] and the Blood of Quallo's Friend (MISC98).
The Tome of Infinite Spells may be an acceptable loss. The creature items could probably be set to undroppable in the ITM, and maybe MISC98 should be unsellable?
Nishruu has an invalid item: nishruu. So, testing will need some other item...
I just made a wand which triggers spwm140 (a relevant one because of Neera)
It didn't seem to affect potions, but did affect wands. Also, it didn't destroy the last charge of wands. Which isn't a problem. The effect won't destroy items, just deplete them (one by one) almost totally.
So it is a kind of (optimal) middle ground between not working and being a total nuisance.
I can just drop this in my override right?
I'm not sure what should be destroyed by this but I basically spawned Dorn, gave him a bunch of wands and then used your wand on him. All his equipment survived except the wands. Is this a vaild test?
Note: If a wand was in a quickslot, it was destroyed (no wand in the inventory screen) but it would still retain the wand icon in the quick-item slot on the main screen. Only way to remove the icon was to either put something else there or just click on the empty slot in the inventory screen.
@SethDavis - try to update the action bar if an item was destroyed - just like you would do with a destroy item opcode.
[EDIT] Potentially fixed - Messed with the update check to handle removed items differently than items that still had charges/weren't affected.