IWD to BG2 Opcode Utility

Version 1 - Check for the most recent version

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 X
If 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:

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)
238 Stat: Save vs. all 33 Stat: Save vs. Death Modifier
34 Stat: Save vs. Wands Modifier
35 Stat: Save vs. Petrification/Polymorph Modifier
36 Stat: Save vs. Breath Weapons Modifier
37 Stat: Save vs. Spells Modifier
Creates the five opcodes needed to handle this effect
239 Cure: Slow Poison 164 Cure: Slow Poison  
240 Summon: Icewind Summoning Spell 67 Summon: Creature Summoning The parameters can not be mapped; you'll need to manually adjust resources for this opcode
241 HP: Vampiric Touch 12 HP: Damage
18 HP: Maximum HP Modifier
Converts to the same opcodes as BG2 Vampiric Touch spell; also accounts for caster to target/target to caster HP transfers
242 Graphics: Display Creature Overlay 266 Unknown Unable to map automatically; changed to unknown opcode as placeholder
243 Summon: Icewind Animate Dead 266 Unknown Unable to map automatically; changed to unknown opcode as placeholder
244 State: Positive Prayer 266 Unknown Unable to map automatically; changed to unknown opcode as placeholder
245 State: Negative Prayer 266 Unknown Unable to map automatically; changed to unknown opcode as placeholder
246 Summon: Icewind Summoning Spell (Mixed) 266 Unknown Unable to map automatically; changed to unknown opcode as placeholder
247 Beltyn's Burning Blood 266 Unknown Unable to map automatically; changed to unknown opcode as placeholder
248 Summon: Summon Shadow Monsters 266 Unknown Unable to map automatically; changed to unknown opcode as placeholder
249 State: Positive Recitation (state) 266 Unknown Unable to map automatically; changed to unknown opcode as placeholder
250 State: Negative Recitation 266 Unknown Unable to map automatically; changed to unknown opcode as placeholder
251 State: Hold (Lich Touch) 266 Unknown Unable to map automatically; changed to unknown opcode as placeholder
252 State: Blinded (Sol's Searing Orb) 12 HP: Damage
74 State: Blindness
Damage is of type magic (64)
253 AC vs. Damage Type Modifier (II) 0 AC vs. Damage Type Modifier IWD Opcode 0 also gets mapped to 0
254 Removal: Effects specified by Resource 266 Unknown Unable to map automatically; changed to unknown opcode as placeholder
255 State: Salamander Aura 266 Unknown Unable to map automatically; changed to unknown opcode as placeholder
256 Spell Effect: Umber Hulk Gaze 266 Unknown Unable to map automatically; changed to unknown opcode as placeholder
257 Zombie Lord Aura 266 Unknown Unable to map automatically; changed to unknown opcode as placeholder
258 Protection: Immunity Resource 266 Unknown Unable to map automatically; changed to unknown opcode as placeholder
259 Summon: Summon Creature 266 Unknown Unable to map automatically; changed to unknown opcode as placeholder
260 Graphics: Animation Removal 271 Graphics: Avatar Removal  
261 Protection: Immunity Effect and Resource 101 Protection: from Opcode  
262 Summon: Summon Pomabs 266 Unknown Unable to map automatically; changed to unknown opcode as placeholder
263 Spell Effect: Turn Undead (Evil) 5 Charm: Charm Specific Creature Changed to more generic charm effect targeting undead (4); parameters are the same in both engines and opcodes
264 Spell Effect: Static Charge 266 Unknown Unable to map automatically; changed to unknown opcode as placeholder
265 State: Cloak of Fear 266 Unknown Unable to map automatically; changed to unknown opcode as placeholder
266 Stat: Movement Modifier (forced) 126 Stat: Movement Modifier Removes save opportunity
267 Cure: Remove Confusion 242 Cure: Confusion  
268 Spell Effect: Eye of the Mind 171 Spell: Give Innate Ability Since this spell is unavailable in BG2, simply maps to give an innate ability with the resource "spin268.spl"
269 Spell Effect: Eye of the Sword 171 Spell: Give Innate Ability Since this spell is unavailable in BG2, simply maps to give an innate ability with the resource "spin269.spl"
270 Spell Effect: Eye of the Mage 171 Spell: Give Innate Ability Since this spell is unavailable in BG2, simply maps to give an innate ability with the resource "spin270.spl"
271 Spell Effect: Eye of the Venom 171 Spell: Give Innate Ability Since this spell is unavailable in BG2, simply maps to give an innate ability with the resource "spin271.spl"
272 Spell Effect: Eye of the Spirit 171 Spell: Give Innate Ability Since this spell is unavailable in BG2, simply maps to give an innate ability with the resource "spin272.spl"
273 Spell Effect: Eye of the Fortitude 171 Spell: Give Innate Ability Since this spell is unavailable in BG2, simply maps to give an innate ability with the resource "spin273.spl"
274 Spell Effect: Eye of the Stone 171 Spell: Give Innate Ability Since this spell is unavailable in BG2, simply maps to give an innate ability with the resource "spin274.spl"
275 Spell Effect: Remove Seven Eyes 266 Unknown Unable to map automatically; changed to unknown opcode as placeholder
276 Spell Effect: Remove Effects of Type 266 Unknown Unable to map automatically; changed to unknown opcode as placeholder
277 HP: Magic Damage (Soul Eater) 12 HP: Damage Changed to more generic BG2 damage opcode with a damage type of magic (64)
278 Spell Effect: Shroud of Flame 266 Unknown Unable to map automatically; changed to unknown opcode as placeholder
279 Spell Effect: Animal Rage 266 Unknown Unable to map automatically; changed to unknown opcode as placeholder
280 Spell Effect: Turn Undead 266 Unknown Unable to map automatically; changed to unknown opcode as placeholder
281 Spell Effect: Vitriolic Sphere 266 Unknown Unable to map automatically; changed to unknown opcode as placeholder
282 HP: Suppress HP Info 266 Unknown Unable to map automatically; changed to unknown opcode as placeholder
283 Text: Float Text 139 Text: Display String Preserves strref
284 Spell Effect: Mace of Disruption 266 Unknown Unable to map automatically; changed to unknown opcode as placeholder
285 State: Sleep (forced) 39 State: Unconsciousness Removes save opportunity
286 Spell Effect: Ranger Tracking 307 Ranger Tracking Ability  
287 Protection: Backstab 292 Protection: Backstab Sets parameter to 1, as indicated by IESDP
293 Spell Effect: Beholder Dispel Magic 266 Unknown Unable to map automatically; changed to unknown opcode as placeholder
294 Spell Effect: Harpy Wail 266 Unknown Unable to map automatically; changed to unknown opcode as placeholder
295 Spell Effect: Jackalwere Gaze 266 Unknown Unable to map automatically; changed to unknown opcode as placeholder
296 Script: Set Global Variable 309 Script: Set/Modify Variable Had troubles with BG2 opcode 265 Script: Modify Global Variable, so this gets mapped to the more reliable 309 opcode even though 309 is ToB-only
297 Stat: Hide In Shadows 275 Stat: Hide in Shadows Modifier Preserves strref
298 Stat: Use Magic Device 266 Unknown Unable to map automatically; changed to unknown opcode as placeholder

Portrait icons are changed as follows (only icon values which get modified are listed):

IWD Portrait Icon BG2 Portrait Icon Notes
39  Hasted 38   Haste  
40  Resist Fear 37   Resist Fear IWD icon 48 (Courage) also gets mapped to 37
48 Courage 37   Resist Fear IWD icon 40 (Resist Fear) also gets mapped to 37
42  Bard Song 40   Bard Song IWD icons 42 (Bard Song), 77 (Ballad of Three Heroes), 78 (Tale of Curran Strongheart), 79 (Tymora's Melody), 80 (Song of Kaudies), 81 (Siren's Yearning), and 82 (War Chant of Sith) also get mapped to 40
43  Nauseous 7   Nauseated  
44  Fatigued 39   Fatigue  
45  Held 13   Held  
47  Hopelessness 44   Hopelessness  
49  Friends 115  Friends  
50  Hope 22   Heroism  
51  Greater Malison 45   Greater Malison  
52  Spirit Armor 46   Spirit Armour IWD icon 84 (Armor of Faith) also gets mapped to 46
53  Dominated 43   Domination  
54  Feebleminded 48   Feebleminded  
55  Tenser's Transformation 72   Tenser’s Transformation  
56  Mind Blank 134  Chaotic Commands IWD icons 66 (Chaotic Commands) and 70 (Impervious Sanctity of Mind) also get mapped to 134
57  Aid 17   Blessed IWD icons 61 (Strength of One), 64 (Recitation), and 74 (Exaltation) also get mapped to 17
59  Draw Upon Holy Might 135  Draw Upon Holy Might  
60  Miscast Magic 105  Miscast Magic  
61  Strength of One 17   Blessed IWD icons 57 (Aid), 64 (Recitation), and 74 (Exaltation) also get mapped to 17
63  Defensive Harmony 49   Defensive Harmony  
64  Recitation 17   Blessed IWD icons 57 (Aid), 61 (Strength of One), and 74 (Exaltation) also get mapped to 17
65  Champion's Strength 50   Champion's Strength  
66 Chaotic Commands 134  Chaotic Commands IWD icons 56 (Mind Blank) and 70 (Impervious Sanctity of Mind) also gets mapped to 134
67  Righteous Wrath of the Faithful 64   Righteous Magic  
68  Phased 15   Shielded  
69  Pain 101  Decaying  
70 Impervious Sanctity of Mind 134  Chaotic Commands IWD icons 56 (Mind Blank) and 66 (Chaotic Commands) also gets mapped to 134
71 Petrify None 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
72  Iron Body 62   Iron Skins  
73  Animal Rage 141  Enraged  
74  Exaltation 17   Blessed IWD icons 57 (Aid), 61 (Strength of One), and 64 (Recitation) also get mapped to 17
75  Cat's Grace 155  Avoid Death ToB icon
77  Ballad of Three Heroes 40   Bard Song IWD icons 42 (Bard Song), 78 (Tale of Curran Strongheart), 79 (Tymora's Melody), 80 (Song of Kaudies), 81 (Siren's Yearning), and 82 (War Chant of Sith) also get mapped to 40
78 Tale of Curran Strongheart 40   Bard Song IWD icons 42 (Bard Song), 77 (Ballad of Three Heroes), 79 (Tymora's Melody), 80 (Song of Kaudies), 81 (Siren's Yearning), and 82 (War Chant of Sith) also get mapped to 40
79 Tymora's Melody 40   Bard Song IWD icons 42 (Bard Song), 77 (Ballad of Three Heroes), 78 (Tale of Curran Strongheart), 80 (Song of Kaudies), 81 (Siren's Yearning), and 82 (War Chant of Sith) also get mapped to 40
80 Song of Kaudies 40   Bard Song IWD icons 42 (Bard Song), 77 (Ballad of Three Heroes), 78 (Tale of Curran Strongheart), 79 (Tymora's Melody), 81 (Siren's Yearning), and 82 (War Chant of Sith) also get mapped to 40
81 Siren's Yearning 40   Bard Song IWD icons 42 (Bard Song), 77 (Ballad of Three Heroes), 78 (Tale of Curran Strongheart), 79 (Tymora's Melody), 80 (Song of Kaudies), and 82 (War Chant of Sith) also get mapped to 40
82 War Chant of Sith 40   Bard Song IWD icons 42 (Bard Song), 77 (Ballad of Three Heroes), 78 (Tale of Curran Strongheart), 79 (Tymora's Melody), 80 (Song of Kaudies), and 81 (Siren's Yearning) also get mapped to 40
83  Deaf 112  Deaf  
84  Armor of Faith 46   Spirit Armour IWD icon 52 (Spirit Armor) also gets mapped to 46

Contact Information

Thanks and Acknowledgements

This utility would not be possible without the research effort that is the IESDP and tools such as Near Infinity. Thanks to the still active and vibrant Infinity Engine modding community.

Tools Used in Creation
WeiDU by Wes Weimer
Near Infinity by Jon Olav Hauglid
IESDP maintained by igi

Credits and Copyright Information

This utility may not be sold, published, compiled or redistributed in any form without the consent of its author. IWD to BG2 Opcode Utility is ©2006 "Cam" Camagna.

Version History

Version 1 - January 16, 2006