Modding in Icewind Dale 2
semiticgoddess
Member Posts: 14,903
This thread is to discuss the possibilities of modding Icewind Dale 2, the Infinity Engine game most notorious for having lots of hard-coded stuff that makes it difficult to mod. Since barely anyone mods this game, especially recently--the big mods for IWD2 are all very old--there's not a lot of information on how to do it. I wanted to share some of my findings and hopefully others in the community will be able to show their own insights.
6
Comments
However, copying FA_39332 to another classes' CLAB file doesn't seem to do anything. I can't give Evasion to a ranger, for instance. Also, altering the feat .spl files doesn't do anything: if I make any changes to FEAT0C.spl, the Dash feat spell from GemRB, characters in-game with the Dash feat don't get any AC bonuses I might tack on, nor can I change the magnitude of the 15% speed boost. Testing found that the only way I can apply passive bonuses to a class is to use the typical AP_ prefix; the FA_ prefix appears to be non-functional.
Now, if I want to give a thief, say, a 15% speed boost like Dash at level 10 or something, I can do that because I can just add "AP_FEAT0C" to the CLABTH01.2da file under level 10 (any other custom spell could do the same). However, I can't add Evasion because there doesn't appear to be an Evasion opcode. The 39332.spl file from GemRB, which is named Evasion, has zero opcodes; it's an empty spell file.
It seems impossible to apply any additional effects using the FA_ prefix or a spell with zero opcodes like 39332.spl, the Evasion spell. However, I can imitate the effects of a feat by applying a level-based opcode of some sort, like giving a monk the effects of Aegis of Rime. This, however, will stack with existing feats, and there are some feats I can't imitate, like Weapon Focus or Spell Focus feats.
It is possible for me to grant certain feats at level 1 by editing the FEATS.2da file. However, that can only be done at level 1; you can't give a class a feat at a higher level.
As for innate abilities, if you want to add any new spells to any class, like giving Abundant Step to a monk, you have to add the file name (in this case SPIN272) to the LISTINNT.2da table, or else it won't be available.
In a nutshell: while you can apply all sorts of opcodes to classes at certain levels via the CLAB files, you can't use it to give proper feats to any class unless you're giving it to them at level 1, which incentivizes people to only take a single level in that class (like many people do with the monk, fighter, paladin, and ranger classes).
I also found a table on GemRB called FEATREQ.2da, which lists all of the requirements for every feat in the game. However, the table has no impact on gameplay; it seems to be a replication of a hard-coded system rather than an extracted table the game actually uses. It's unfortunate, because that table also contains the number of pips you can put in a feat. If it were possible to edit that system, you could take, say, Spirit of Flame or Scion of Storms multiple times, or take more than two Spell Focus: Enchantment feats, or reach more than three pips in a weapon proficiency.
A spell that lasts 3 rounds plus one round per level would just have 1 and 3 in those parameters.
More good news: IWD2 has an opcode that's fundamentally identical to the ever-important EE opcode, Remove Effects by Resource: in Near Infinity, it's Dispel Specific Spell, opcode 254, and it can be used to make spells non-stacking without resorting to the Protection from Spell opcode that prevents the player from refreshing the spell by re-casting it before it expires.
Dispel Specific Spell can even fix a long-running problem with Seven Eyes! Seven Eyes in IWD2, like IWD, could only be cast every 20 rounds even if all the eyes were expended, but just by putting a Dispel Specific Spell opcode on top of Seven Eyes, you can restore any missing eyes by re-casting the spell!
LISTDOMN.2da governs which domain spells each cleric gets. Based on the layout of the table, it looks like you could actually give clerics more than two domain spells per spell level.
LISTINNT.2da, as mentioned above, contains all innate spells that a critter can receive via their class (like Stunning Attack) or race (like Invisibility). If a spell isn't in this list, you can't give it to a character via a CLAB table.
LISTSHAP contains all druid shapeshifting spells. I don't know if you can create more than 12 different shapeshifts, but I doubt it. This doesn't assign the shapeshifts, though; you do that via the druid's CLAB table, CLABDR01.
LISTSONG contains all bard songs. However, it seems impossible to give a bard more than 5: if you add a 6th song, it won't show up in the menu and therefore cannot be used.
About game balance: saving throws and save DCs vary dramatically. A goblin in Targos might have a +0 Will save, while a Hatemaster in the Severed Hand in Heart of Fury mode might have a +35 Will save. A mage with 18 Intelligence will cast Charm Person with a save DC of 15, while a maxed-out deep gnome Dreadmaster of Bane in Heart of Fury mode could cast Mass Dominate with a save DC of 37. This means that a save DC must scale dramatically to avoid being overpowered in the early game or useless in the late game (or even both!):
Goblin: 25% chance of making its save against Charm Person
Hatemaster: 95% chance of making its save against Charm Person
Goblin: 5% chance of making its save against Mass Dominate
Hatemaster: 90% chance of making its save against Mass Dominate
A save DC starts at 10 by default. These are the things that modify a save DC:
1. Casting stat (Intelligence, Wisdom, or Charisma), up to a theoretical +15 to save DC (more likely a +4 to +10 over the course of the game)
2. Spell level (a level 1 spell has a +1 to the DC; a level 9 spell has a +9 to the save DC)
3. Spell Focus feats (only available for Enchantment, Evocation, Necromancy, and Transmutation spells), up to +4 to save DC
4. Malison, -2 to saving throws
5. Recitation, -2 to saving throws
6. Prayer, -1 to saving throws
7. Bane, -1 to saving throws (Will save negates)
8. Emotion: Despair, -2 to saving throws (Will save negates)
9. Tyrant's Dictum, +1 to Will save DCs (only for clerics of Bane)
10. Spell-specific modifiers, like Chaos' +4 to save DC or Horror's -3 to save DC
The first three modifiers scale as the player gains levels, but items that offer saving throws, like a save against a poison effect, don't get any of those modifiers. This means that a mod-introduced sword that poisons the target will need a save DC commensurate to its place in the game.
IWD2 has the use .eff file opcode, but no spell in the entire game uses that opcode; I'm not sure it even works properly (IWD2 has a lot of nonfunctional opcodes from BG2). You could try to rig it to apply to critters with the ranger class, but that would probably do one of two things even if it did work: apply only to single-classed rangers, or (more likely) apply the .eff to anyone who has even a single ranger level.
Since rangers are woodsy fighters rather than dancy acrobats like thieves or monks, I wouldn't give them Evasion until higher levels, which would add a further layer of complexity. You could specify the opcode to only work on level 10+ characters, but it would also work on characters with 9 cleric levels and 1 ranger level.
IWD2 also has the "Apply Effects List" opcode, but that only differentiates between critter types like undead or fire-dwelling and so forth; it doesn't specify class.
Symbol of Stun, Symbol of Death, and Power Word Kill work a little differently. They have the stun and death magic opcodes listed in the spell itself, but the projectile manipulates which critters get affected; the projectile calculates the enemies' HP and then applies the opcodes accordingly. You can, however, change the projectile and prevent that from happening. If you rig Symbol of Death to use the same projectile as Symbol of Hopelessness, there will be no maximum HP of critters the spell can affect.
I don't see any means of editing the projectiles. No .pro files show up in Near Infinity, nor can they be accessed through the spell files that use them.
More good news: we have confirmation about the LISTSPLL.2da table! You can rig any spell in the game to be usable by any spellcaster class at any level and it will work just fine. I've tested out level 8 Call Lightning spells and level 4 Suffocation spells from sorcerers and level 2 Ray of Enfeeblement and Death Armor spells from clerics. They're all completely functional.
Also, there are tables that give innate spells to certain races:
SPCD_GR.2da: innate spells for gray dwarves
SPCE_D.2da: innate spells for drow elves
SPCG_D.2da: innate spells for deep gnomes
SPCH_A.2da: innate spells for aasimar
SPCH_T.2da: innate spells for tieflings
SPCHF_GW.2da: innate spells for ghostwise halflings
This means that spells have the same save DC regardless of which spell slot they occupy. A Fire Storm spell will have the same save DC if cast by a cleric or a druid, even though the cleric casts it as a level 8 spell instead of level 7. Also, the vanilla game Symbol spells erroneously have a save DC of 1 lower than they're supposed to, since they strike as level 7 spells even though they're level 8 in IWD2
This means that you can make a weapon's on-hit effects scale with level.
In the past, an item's save DC was completely stagnant, making a lot of weapons wildly overpowered because their DCs were too high while others remained near-useless because their DCs were too low. Worse yet, the intense scaling in Heart of Fury mode all but negated the effects of all kinds of weapons because the save DCs were just too low to affect any target more than 5% of the time.
This means high-level fighters can get on-hit effects to work more reliably. Better still, it means that the save DCs for magical weapons like Black Blade of Disaster can scale dynamically.
Edit: Unfortunately, it appears that I did not record my findings anywhere.
Still, I'm inspired now, so I'll experiment when I get a chance and report back.
Have you had any luck adding around skill bonuses for particular races. I'm going on memory, but I tried to give half orcs a bonus to intimidate, and as I recall, it was a complete dead end...
Edit: presumably without resorting to some invisible monster craziness
As for skills, the only opcodes that seem to work are those that show up properly in Near Infinity, and not all skills are represented by opcodes. Alchemy, Knowledge, and thief skills are the only things that show up in NI as opcodes. For other skills, like Concentration, I found .spl files for feats like Combat Casting by downloading them from GemRB, which shows that opcode 301, for example, is supposed to modify Concentration. But attempting to use opcode 301 seems to crash the game, though I've only tested it as a passive effect applied via a CLAB.2fa file.
You could give Half-orcs the Bullheaded feat at level 1 by altering the FEATS.2da. By the way, you can get around this by using opcode 402, Apply Effects by List. The bard song itself will not be leveled, but it can cast a spell that is.
...but in-game, they appear to get shrunk by a few pixels, which distorts them and makes them look wrong--and asymmetrical, which means they simply don't fit in with the other icons. It might be fine with images that are already asymmetrical, but for a circle one like this with concentric rings, the rings won't show up properly.
I seem to recall that that 2da was handcoded...I'm going to experiment and report back specifics after I get to a good place with fnp.
I'm thinking that we should document our findings in a more organized, IESDP way. If I can figure out how, I might try to fork that on github...
http://readme.spellholdstudios.net/bam-readme.html
Edit: I checked and I think that I meant Bam workshop. Actually, I think I've had good results from both:
http://www.shsforums.net/topic/57564-bamworkshop/
With mention on the stream of Camdawg chasing one last option for the possibility of iwd2ee, what are your thoughts on it? The modding community has been around so long, that perhaps if Beamdog finally give up on iwd2ee, it might be something possible to mod? I was thinking perhaps putting iwd2 together with 1 in the iwdee game, might be a nice option. It shouldn't be too hard to add an EET style world map, iwd2 areas, people, story/dialogue... the tricky part will then be the rule changes, extra races, rule tweaks, but if the groundwork is already there, those things can be added over time. I'm literally just thinking out loud right now, so well aware I might be totally off the mark.
Here's a quick world map I wipped up:
As for implementing feats and other 3E features--which is really what people would be most interested in--it could theoretically be done by modifying the EE source code, adding to the code in an attempt to replicate the effects of IWD2 features. But I'm guessing that would be a more intensive process that relies on skills that Beamdog doesn't specialize in--that is, adding new features rather than re-working existing code to function better on modern platforms. Duplicating IWD2 content and then tacking on some completely new code which attempts to replicate known features from unknown source code would be a sluggish and difficult process that might falter midway through development. You don't want to commit to an unfamiliar task if the potential for profit is low and there's a chance that you wouldn't be able to implement everything.
So much this!
There quite a few differences, but not that many that can't be replicated in another way. The only difference I think can't be done is the ability to pick and choose levels from different classes. Skills, subraces, feats...can all be replicated with global and exisiting effects. Scripts can be replicated with much longer versions (lots of new triggers and actions in iwd2 which would be great to have, like the whole Team structure), but these can be worked around with time.
Realisticly, I think a group of 10 people, dividing up the game, could reproduce iwd2 in iwdee within a few months.