Seems there are more issues with this opcode than thought. As reference to other threads, I thought of creating a separate thread for opcode 172. Here are the links to the other two threads:http://forum.baldursgate.com/discussion/35033/known-9861-creature-files-overriding-memorized-spellshttp://forum.baldursgate.com/discussion/35125/project-images-simulacra-shouldnt-cast-these-spells
Existing behavior: opcode 172 removes one memorized copy of the .spl in the resource field, and removes the spell/ability from the known spells list. Additional copies memorized of the .spl are kept intact.
Expected behavior: opcode 172 removes *all* memorized copies of the .spl in addition to removing the spell/ability from the known spells list.
How to reproduce this: unzip the attached file into your override folder. It's a modified Chain Contingency which does nothing except have an opcode 172 attached intended to remove all instances of SPWI908. In order to test this, you will need at least 4 instances of chain contingency memorized (use Edwin for this). Once you cast this after a slight delay you will see one memorized copy of chain contingency disappear as well as from the list of known spells.
The desired behavior is that all copies of chain contingency disappear in addition from the list of known spells.
NOTE: This might be qualified as a borderline request:
Suggested additional improvement: allow opcode 172 to have an option to unmemorize x number of copies of the spell in the resource field without removing the spell from the known spells list. This will require use of param1 and param2. One param to specify removal type (0 - default, 1 - unmemorize x spells), and one parameter to specify the number of spells to unmemorize.