IWD to BG2 Opcode Utility

Overview

This utility was something I wrote to assist in converting Icewind Dale spells to Baldur's Gate II for the Divine Remix mod. It is not intended to convert spells, but rather to make a first pass in spell conversion to eliminate a lot of manual work when importing spells from IWD. The utility focuses on opcodes and their parameters, leaving other tasks (such as projectiles, graphics, etc.) to the modder.

Installation

Windows
The IWD to BG2 Opcode Utility is packaged and installed with WeiDU and
is distributed as a self-extracting archive. To install,
simply double-click the archive and follow the instructions
on screen.

Alternatively the files can be extracted from the archive
using WinRAR. If properly
extracted, you should have a IWD_to_BG2_Opcode_Converter folder and Setup-IWD_to_BG2_Opcode_Converter.exe
in your BG2 folder.

To use this utility, place spell files you wish converted in the input folder inside IWD_to_BG2_Opcode_Converter and run Setup-IWD_to_BG2_Opcode_Converter.exe in your BG2 folder. Converted files will get moved to the output folder inside IWD_to_BG2_Opcode_Converter.

Mac OS XIf the mod was previously installed, uninstall it before
extracting the new version. The eSeries is packaged
and installed with WeiDU.
To install, simply extract the contents of the mod into your BG2 folder. If
properly extracted, you should have a IWD_to_BG2_Opcode_Converter folder, Setup-IWD_to_BG2_Opcode_Converter,
and Setup-IWD_to_BG2_Opcode_Converter.command in your BG2 folder.

To use this utility, place spell files you wish converted in the input folder inside IWD_to_BG2_Opcode_Converter and run Setup-IWD_to_BG2_Opcode_Converter.command in your BG2 folder. Converted files will get moved to the output folder inside IWD_to_BG2_Opcode_Converter.

Contents

Inside the IWD_to_BG2_Opcode_Converter folder are two more folders, input and output. Simply place the spell files you wish to have converted into the input folder, and the utility will drop the converted files into the output folder. The utility will make three main changes to spells:

Opcodes are mapped from IWD to BG2 (see chart below)

Portrait icons referenced by the opcodes are mapped from IWD to BG2 (see chart below)

Durations are changed from the IWD standard of 7-second rounds to the BG2 standard of 6-second rounds

While written as a WeiDU installer, the utility runs without a backup option so that it won't get added to weidu.log and you can run it multiple times without interfering with mods on your BG2 install.

Opcodes are changed as follows (only opcodes which get modified are listed). For opcodes that are not mapped automatically, if anyone can offer specific suggestions on mapping I'll be happy to add conversions for them in future releases.

IWD Opcode

BG2 Opcode

Notes

0 AC vs. Damage Type Modifier

0 AC vs. Damage Type Modifier

IWD Opcode 253 also gets mapped to 0

7 Set character colours by Palette

7 Set character colours by Palette

Opcodes are the same across engines, but IWD has one opcode to target entire body. BG2 needs several opcodes to target the body, so these are created

8 Change by RGB

8 Change by RGB

Opcodes are the same across engines, but IWD has one opcode to target entire body. BG2 needs several opcodes to target the body, so these are created

9 Glow Pulse

9 Glow Pulse

Opcodes are the same across engines, but IWD has one opcode to target entire body. BG2 needs several opcodes to target the body, so these are created

142 Graphics: Display Special Effect Icon

142 Graphics: Display Special Effect Icon

Same opcode, but portrait icons are mapped (see table below); special exception is petrify (71). Petrify is handled in BG2 by graying out the portrait so icons are not needed; as such opcodes 142 and 169 with petrify icons are deleted

164 Remove Intoxication

94 Stat: Drunkenness Modifier

Sets the stat to a value of 0

169 Graphics: Prevent Special Effect Icon

169 Graphics: Prevent Special Effect Icon

Same opcode, but portrait icons are mapped (see table below); special exception is petrify (71). Petrify is handled in BG2 by graying out the portrait so icons are not needed; as such opcodes 142 and 169 with petrify icons are deleted

233 Graphics: Icewind Visual Spell Hit (plays sound)

266 Unknown

Unable to map automatically; changed to unknown opcode as placeholder

234 HP: Cold Damage

12 HP: Damage

Changed to more generic BG2 damage opcode with a damage type of cold (2)

235 Graphics: Icewind Casting Glow

266 Unknown

Unable to map automatically; changed to unknown opcode as placeholder

236 HP: Cold Damage

12 HP: Damage

Changed to more generic BG2 damage opcode with a damage type of cold (2)

237 HP: Crushing Damage

12 HP: Damage

Changed to more generic BG2 damage opcode with a damage type of crushing (0)