Skip to content

Innate Spells, and Scripting

horredtheplaguehorredtheplague Member, Developer Posts: 186
This is a bug that's been driving me mad, for years. I'm sure some of you are familiar with it, especially scriptors. It's a vicous circle of a bug, no less. If you have an innate spell set to > level 1, and try to cast it w/ a script---it crashes the game. On the other side of the coin, the Trigger SpellCastInnate() requires the innate spell to be the same level as the spell.ids entry, or it will never ring true. No-win situation, right? Well, it was until today.

Attached is a text version of the tp2 file I wrote. First, it takes all innate spells, and sets them to level one. Then, it checks every script in the game for CastSpellInnate. It excludes any that use spell id of zero (0), like: SpellCastInnate([GOODCUTOFF],0) e.g. These checks ring true for any innate spell of any level, from my testing, if cast in the last scripting round. It transforms these entries into CastSpellInnateRES format (which is a custom addition to Trigger.ids of same hex value as the original). SpellCastInnateRES rings true regadless of spell/ids entries and spell levels.

I tested it in BGEE, and thankfully there's no scripts using CastSpellInnate(). I didn't test, but I'll bet dimes to dollars the "script-casting > level 1 = CTD" bug wasn't fixed in BGEE (thankfully, I don't have many dimes let alone dollars heh). If Beamdog simply copies BG2 scipts over, esp from the ToB portion of the game, w/o fixing the engine---this bug will soon follow.

I tested it in BG2 as well--in a vanilla install, two few-to-moderate modded installs, and a big phat BWP install. The latter took a lunchtime to install and required me to fix kit.ids that was hosed and shredded somewhere between mod # 243 and mod # 268 in the install list. But all said and done, it worked there as well. Scriptors rejoice!

I'll be including this code as a core subcomponent in the next BPSeries package (just the level 1 innate part will install, for now, replacing the present code) and also in the upcoming new release/overhaul of the Big Picture mod. I've also posted it for the BWP crew, in their forums. And attached to this post, is a text version available for any that wish it. I'm hoping somebody will pass this along to "The Source", because it's not a minor issue if you try to really sink your teeth into your added adventures. Pretty pictures and flashy effects are great stuff, but if you want your pretty sprites to "sing and dance" just-the-right-way it requires a beautiful script.

Comments

  • AndreaColomboAndreaColombo Member Posts: 5,525
    I'll tag @Cuv, @Avenger_teambg and @CamDawg as this kind of stuff seems right up their alley.
  • CamDawgCamDawg Member, Developer Posts: 3,438
    I brought it up in the beta as part of integrating the BG2FP fixes--rather than setting innates to one, we should fix the underlying behavior. I think it was addressed, partially--I don't think you'll get CTDs any more, but I don't think the various triggers for detecting innates cast work.
  • horredtheplaguehorredtheplague Member, Developer Posts: 186
    CamDawg said:

    I brought it up in the beta as part of integrating the BG2FP fixes--rather than setting innates to one, we should fix the underlying behavior. I think it was addressed, partially--I don't think you'll get CTDs any more, but I don't think the various triggers for detecting innates cast work.

    Thanks, @CamDawg. I'm glad I wasn't alone on this one, that Beamdog is aware of the situation. I totally agree that the level one approach is not the way to go--but I'm not an engine hacker, so this was the best workaround I could manage. Agreed its needs for BGEE are limited, but BG2EE would be a different tale if left alone. For BG2:ToB, it's essentially a requirement if you like custom player/enemy scripting.
Sign In or Register to comment.