auc42x Posted July 29, 2023 Share Posted July 29, 2023 I recently discovered a crashing bug with the Icewind Dale spells component of SCS, using original BG2+ToB. Upon resting in some circumstances (not all), my game crashed with the message of "An Assertion failed in CCGameEffect.cpp at line number 1536". I am told that this indicates the engine encountering an invalid opcode. Briefly, I found four spells that use opcode 61, which is only valid in BGEE. In that game, it is "Creature RGB color fade" (https://gibberlings3.github.io/iesdp/opcodes/bgee.htm#op61), whereas in original BG2, it is a crash (https://gibberlings3.github.io/iesdp/opcodes/bg2tob.htm#op61). The four spells with that opcode are from the IWD set added by this mod, specifically: GHAST1.spl, SPPR426.SPL (Cause Serious Wounds), SPPR524.SPL (Cause Critical Wounds), and SPPR740.SPL (Wither). I was able to use Near Infinity to update the opcodes from 61 to 50 ("Color: Glow by RGB (Brief)") without changing any other data, and everything seems to be working again. I can't say if the visual effect is what was "intended", but it looks okay to me. More details of my bug hunt are in this thread: https://www.gibberlings3.net/forums/topic/37022-solved-help-on-debugging-a-modded-bg2-crash/ If SCS is updated again, it would be good to get that fixed. If not, then hopefully this message is helpful to somebody else in the future, trying to figure out how to fix it! (More details on what I did to fix it on an individual basis are in the linked thread above) Quote Link to comment
polytope Posted July 29, 2023 Share Posted July 29, 2023 (edited) 3 hours ago, auc42x said: Briefly, I found four spells that use opcode 61, which is only valid in BGEE. In that game, it is "Creature RGB color fade" (https://gibberlings3.github.io/iesdp/opcodes/bgee.htm#op61), whereas in original BG2, it is a crash (https://gibberlings3.github.io/iesdp/opcodes/bg2tob.htm#op61). The four spells with that opcode are from the IWD set added by this mod, specifically: GHAST1.spl, SPPR426.SPL (Cause Serious Wounds), SPPR524.SPL (Cause Critical Wounds), and SPPR740.SPL (Wither). I tried installing IWD spells on oBG2, but don't play with it now, after discovering... balance issues with Divine Protection and Entropy Shield which some other players have also commented on. I still have that install though, and on closer examination no enemy priest appears to have Wither or Cause Serious Wounds memorized, which is probably why I never saw a CTD. GHAST1.spl is anomalous, it isn't actually triggered by ghasts... or anything else I could find. Edit: @CamDawg does the current stand-alone IWDification have this issue on classic games? Edited July 29, 2023 by polytope Quote Link to comment
polytope Posted July 29, 2023 Share Posted July 29, 2023 (edited) Lol, I just tested and Wither indeed crashes the game but only when cast... which neither my party's priest nor any enemy cleric ever did. As a short range, slow casting 7th level spell, Destruction is strictly better; instant kill on a failed save vs death at -4 or 8d6 immediate damage even if they save; compare to Wither's effect of 18hp damage/round (36 if hasted) on a failed save vs death at -4 for 1 round/2 levels, no effect on a successful save. Quote For example, I first encountered the crash when I had a party of CHARNAME, Yoshimo, Aerie, and Keldorn. I can prevent the crash by: Removing Keldorn from the party, but keeping all others. Removing Aerie from the party, but keeping all others. De-selecting all L4 priest spells that Aerie is set to memorize that night, but keeping all characters in the party. And various other perturbations. On the other hand, I can create a crash by going back to previous saves and adding various other spellcasters (priest or mage) to the party and resting, with or without Yoshimo/Keldorn/Aerie. I'm surprised at your report that just recruiting NPCs who could cast these spells and resting with them in the party triggers the crash which definitely wasn't my experience. Perhaps Bubb or Kjeron could offer a better explanation. Edited July 29, 2023 by polytope Quote Link to comment
argent77 Posted July 29, 2023 Share Posted July 29, 2023 As of Near Infinity v2.4-20230729 you can check the game for invalid effect opcodes. This is the result after installing SCS IWD spell components on oBG2: Spoiler File: cdid325.spl, Name: No such index, Attribute: Type=Unknown (321) File: cdid325.spl, Name: No such index, Attribute: Type=Unknown (321) File: cdid325.spl, Name: No such index, Attribute: Type=Unknown (321) File: cdid325.spl, Name: No such index, Attribute: Type=Unknown (321) File: cdid325.spl, Name: No such index, Attribute: Type=Unknown (321) File: cdid325.spl, Name: No such index, Attribute: Type=Unknown (321) File: cdid325.spl, Name: No such index, Attribute: Type=Unknown (321) File: cdid325.spl, Name: No such index, Attribute: Type=Unknown (321) File: cdid325.spl, Name: No such index, Attribute: Type=Unknown (321) File: cdid325.spl, Name: No such index, Attribute: Type=Unknown (321) File: cdid325.spl, Name: No such index, Attribute: Type=Unknown (321) File: cdid325.spl, Name: No such index, Attribute: Type=Unknown (321) File: CDIWDTR1.SPL, Name: No such index, Attribute: Type=Unknown (325) File: GHAST1.SPL, Name: No such index, Attribute: Type=Unknown (61) File: SPPR327.SPL, Name: Mold Touch, Attribute: Type=Unknown (324) File: SPPR328.SPL, Name: Storm Shell, Attribute: Type=Unknown (321) File: SPPR426.SPL, Name: Cause Serious Wounds, Attribute: Type=Unknown (61) File: SPPR524.SPL, Name: Cause Critical Wounds, Attribute: Type=Unknown (61) File: SPPR740.SPL, Name: Wither, Attribute: Type=Unknown (61) File: SPPR740.SPL, Name: Wither, Attribute: Type=Unknown (61) File: SPPR740.SPL, Name: Wither, Attribute: Type=Unknown (61) File: SPPR740.SPL, Name: Wither, Attribute: Type=Unknown (61) File: SPPR740.SPL, Name: Wither, Attribute: Type=Unknown (61) File: SPPR740.SPL, Name: Wither, Attribute: Type=Unknown (61) File: SPPR740.SPL, Name: Wither, Attribute: Type=Unknown (61) Quote Link to comment
polytope Posted July 30, 2023 Share Posted July 30, 2023 (edited) 10 hours ago, argent77 said: As of Near Infinity v2.4-20230729 you can check the game for invalid effect opcodes. This is the result after installing SCS IWD spell components on oBG2: (cdid325.spl, CDIWDTR1.SPL, SPPR327.SPL, SPPR328.SPL) cdid325.spl is the subspell payload of SPPR326.spl - Cloudburst. CDIWDTR1.spl doesn't seem to be attached to any troll on SCS installs, including those produced by the new monster summoning spells, this may be because I installed my own old modification of trolls over SCS (deprecated, don't install it on EE), but I doubt it, others would have noticed if trolls weren't working. Interestingly, no druid encountered in my game has Cloudburst, Mold Touch or Storm Shell memorized as 3rd level picks, and I didn't have a druid in my party for the short time I was playing with IWD spells (and wouldn't have used any of these anyway). It still doesn't explain why OP sees a crash upon resting, I can even memorize the bugged spells, and start casting them, the CTD does not occur until casting is successfully completed and the game tries to resolve the effects in the feature block of the spell. Edited July 30, 2023 by polytope Quote Link to comment
jmerry Posted July 30, 2023 Share Posted July 30, 2023 22 minutes ago, polytope said: nterestingly, no druid encountered in my game has Cloudburst, Mold Touch or Storm Shell memorized as 3rd level picks, and I didn't have a druid in my party for the short time I was playing with IWD spells (and wouldn't have used any of these anyway). Not a coincidence. These spells are simply not on the lists of spells that SCS uses to build its druids (with IWD spells). Quote Link to comment
polytope Posted July 30, 2023 Share Posted July 30, 2023 I didn't think it was a coincidence, those spells are obviously not very good, like "what if someone attacks me with a Flameblade tomorrow, I better memorize Cloudburst". Storm Shell at level 3 is hardly an improvement over Resist Fire/Cold at level 2, even though it grants electricity resistance, if you need electricity resistance use the 4th level Protection from Lightning for complete immunity and a duration of 5 rounds/level rather than a flat 1 turn. Mold Touch does a lot of damage at least (although less on average than the description says) but you end up needing to save yourself because of the way it chains, and it's still a touch range, slow casting deal, the damage over time aspect would seem to make it good for disrupting casters in the manner of Melf's Acid Arrow if it weren't for that. Quote Link to comment
CamDawg Posted July 30, 2023 Share Posted July 30, 2023 18 hours ago, polytope said: Edit: @CamDawg does the current stand-alone IWDification have this issue on classic games? No, IWDIfication is good to go on all of these. At present you should be using IWDification as your source of IWD spells (EEs or otherwise). SCS is using the same code that was in IWDifcation RC2, so everything fixed in the five versions (changelog) since is still a bug in the SCS version of these spells. The good news is that since IWDification and SCS share the library for these spells, all of IWDification's fixes will get rolled into the next SCS. A few other notes: ghast1 is used by the ghasts from Monster Summoning IV; cdiwdtr1 is used by the troll summons in Shades. These, and everything else flagged in argent's list, is also fixed in IWDification. Quote Link to comment
polytope Posted July 30, 2023 Share Posted July 30, 2023 1 hour ago, CamDawg said: A few other notes: ghast1 is used by the ghasts from Monster Summoning IV; cdiwdtr1 is used by the troll summons in Shades. These, and everything else flagged in argent's list, is also fixed in IWDification. Actually it turns out this not a problem with the IWD spells packaged in SCS. MSIV calls a yuan-ti rather than a ghast from MSUMM04.2da, whereas the trolls from Shades don't have the peculiar pseudo-immortality of other trolls (in its various implementations). Which is why I thought it was interesting, the spells enemy casters will use against you don't have these opcode bugs, the player should only see it if they're trying to cast the unused spells (although summoned orcs had a misassigned animation in SCS). Quote Link to comment
jmerry Posted July 30, 2023 Share Posted July 30, 2023 As for this specific bug: Quote Version 1 - February 19, 2022 ... Cleaned up some leftover EE opcodes in spells for oBG2 games. (Quoting the IWDification changelog) Yep, fixed a while back. Quote Link to comment
polytope Posted July 30, 2023 Share Posted July 30, 2023 Still no explanation as to why the bug triggers on resting rather than use of spells. I'd guess some party AI script is trying to cast the bugged spells out of combat, but none in that list seem obvious candidates as long duration prebuffs. Quote Link to comment
auc42x Posted July 30, 2023 Author Share Posted July 30, 2023 21 hours ago, polytope said: I'm surprised at your report that just recruiting NPCs who could cast these spells and resting with them in the party triggers the crash which definitely wasn't my experience. Perhaps Bubb or Kjeron could offer a better explanation. and 1 hour ago, polytope said: Still no explanation as to why the bug triggers on resting rather than use of spells. I'd guess some party AI script is trying to cast the bugged spells out of combat, but none in that list seem obvious candidates as long duration prebuffs. I do have to admit that I'm not 100% satisfied with my search for the bug, due to not definitively identifying the triggering condition. The crash itself seems to be deterministic, in that it doesn't happen "randomly" for a given game state. Starting from a given pre-rest savepoint, it will crash 100% of the time, or not crash 100% of the time, based on what game state perturbations I make. But, as you quoted from the other thread, unexpected game state changes affect it. Removing Keldorn (a non-casting NPC) from my party will prevent the crash. As will removing all memorized L4 cleric spells from Aerie, and making no changes to the party. Or, adding Nalia (who has no cleric spells) to the party will cause it to crash when it didn't before. As per the other thread, I was able to prevent the crash in all circumstances (e.g., I wasn't able to cause it in any other manual tests) by removing SPPR426.SPL only. So there's something about the IWD version of Cause Serious Wounds that was manifesting in my game. I did wonder about whether SPPR524.SPL (Cause Critical Wounds, an L5 cleric spell) would also cause it if I advanced a character in level so that they could memorize L5 cleric spells, but I didn't actually test it. I don't know why that spell would have been being invoked, however. I don't keep party AI on, and as you say, it isn't exactly an expected prebuff anyway. My testing was able to trigger the bug by resting in a variety of inns and outdoor areas, including tests that used saves from hours of gameplay ago, by preturbing the state. I can add one more detail, in case it is of interest. I originally encountered the bug on the rest that triggers the "Life... is Strength" Irenicus dream. The crash happened after the dream finished, after the "Loading Area" screen came up, and directly before the resting movie played. I could then generate the crash on non-dream rests as well; it always happens before the movie plays (but, if a dream is triggered, after the dream completes and after it loads the original resting area). So, yeah, like I said, I'm not totally thrilled with my own bugfinding here. I found a bug, and I'm 99% sure that it is the cause of the crash that I was having, but I can't totally explain why it was triggering in those particular circumstances. I have done coding work on other games, and were it one of the ones that I had experience with, I absolutely would have kept digging. But I have zero experience with BG2 coding and mod development, and so as much as I like debugging (seriously!), I admit that this bug doesn't quite give me enough incentive to dive into the technical details here. (I am happy to run further tests if requested, though; I fixed my current game, but cloned a copy of the install just before making more drastic changes, and presumably could still generate the same circumstances by going back to that cloned copy and reverting the four spells). 14 hours ago, argent77 said: As of Near Infinity v2.4-20230729 you can check the game for invalid effect opcodes. This is the result after installing SCS IWD spell components on oBG2: My compliments on a quick update to Near Infinity. And for what it's worth, I see those other ones too, when I go looking for them. My search missed the non-61 ones the first time around; I suppose I'm not searching with quite the correct syntax, but got lucky on finding the 61 set. For what it's worth, I went back and read the SCS readme (https://gibberlings3.github.io/Documentation/readmes/readme-stratagems.html) and found one line that I had missed the first time around: Quote SCS also incorporates, as an optional component for the Enhanced Edition only, most of the new spells in Icewind Dale, which will be used intelligently by the AI if they are installed. So there was a warning in there, but it's pretty easy to miss. The proper "fix" could just have been to restrict those components from installing on original BG2, the way that several other components have per-game restrictions? Though I see that @CamDawg has already said that the IWDification fixes will be rolled into a next version at some point, which should take care of it that way. Quote Link to comment
polytope Posted July 30, 2023 Share Posted July 30, 2023 3 hours ago, auc42x said: I can add one more detail, in case it is of interest. I originally encountered the bug on the rest that triggers the "Life... is Strength" Irenicus dream. The crash happened after the dream finished, after the "Loading Area" screen came up, and directly before the resting movie played. I could then generate the crash on non-dream rests as well; it always happens before the movie plays (but, if a dream is triggered, after the dream completes and after it loads the original resting area). Aha, I've been able to reproduce this, it looks to me like the problem is resting when a party member is injured and you have the bugged spells memorized. This triggers the "healing spells cast on rest" routine, this is why dismissing Keldorn, even though he's no spellcaster worked... he was probably lightly injured. Apparently the game parses through all your memorized spells if a PC is injured before resting, and found an opcode it choked and CTDed on. Quote Link to comment
Recommended Posts
Join the conversation
You are posting as a guest. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.