Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


Dark Dreams of Furiae - a new module for NWN:EE! Buy now
Attention, new and old users! Please read the new rules of conduct for the forums, and we hope you enjoy your stay!

Force-Paused Spell Immunity Menu, extended Contingency options

kjeronkjeron Member Posts: 2,302
edited February 2017 in UI Modding
I haven't put together a Weidu for either of these, yet. Right now this is just to share some findings:

Spell Immunity Menu:
Unlike spell learning/memorization, Sequencers and Contingencies do not acquire their spells from indexing an internal list of available/known/memorized spells, but from a direct reference to the spells RESREF or filename. This means that we can set up the UI to allow us to Sequence or Contingency any specific spell we want, without having to have it memorized or even known.
The first thought I had for this was Spell Immunity, as Sequencer Creation offers a forcibly-paused screen to avoid the mishaps of the select spell menu offered by opcode 214.
First, I disable all elements of the MageBook screen depending on which Sequencer/Contingency is currently being selected, such as "SPWI510".
Then I made a simple octagon menu of icons for the spell schools that will only be displayed when the Sequencer is "SPWI510", and have each of them sequence their Subspell directly by filename.
A few modifications to and a subspell of "SPWI510.spl" to give it a proper cast time and run a Sequencer Creation.
Added "SPWI510" to the annoying "mageBookStrings" table.
The result, is casting the spell immediately pauses the game and pops up this:

Clicking one of the 8 icons updates your choice and the label in the center to tell you which it is, clicking the center button casts the spell. Pressing "escape" escapes the selection and wastes the spell.
So far I've had two big disappointments:
- The first is that I could not remove the background greyscale, even after removing the greyscale-on-pause and greyscale in the MageBook it is still there.
- The second is that other sequencers and contingencies can only handle one instance of the Spell Immunity spell at a time, as all instances will use the school chosen by the first one. But so long as you only put one instance of Spell Immunity into them, they work fine, pausing the game so the spell can be selected, no matter which character owns it or is currently selected.

This could just as well be applied to the Totemic Druid's Summon Spirit Animal, the previous Enchanted Weapon spell, or really anything that uses a 2da menu selection provided the spells have the same casting time, and are all either "target creature" or "target point".

Contingency Conditions:
I also took another look at contingency conditions. The hardest part was figuring out the last column (TRIGGER), until realizing that both it and the first colum(row#) are meaningless. Instead, the file "CONTCOND.2da" matches its rows position directly to the parameter2 options of opcode 232, provided you start counting from '0'. Extending the file with entries for all 21 parameter2 options fills the Condition menu with options.
Most didn't have strings, so I had to make up my own, but they work just like they would if used in opcode 232:
Pardon the lack of spell icons, its unrelated.
There are some drawbacks:
- Since they are matched to row numbers, you can't skip any, such as #10(Every Round) which just causes the game to crash. It would need to be removed from the list through, or at least warned to not select it.
- I have not found any way to set the Special field through the Creation opcode, rendering options 13 and 21 severely limited(can only check Daytime and Spellstate:Hopelessness, respectively), and options 14, 15, 19, and 20 practically useless( Range:0, "Never", HP < 0, HP < 0%).

The ones that can be put to use:
When Attacked
Contingency Target within 4ft
Contingency Target within 10ft
Took damage
Caster killed a creature
Caster died
Contingency Target died
When Turned

The Contingency target section can also be expanded, but is only missing one entry, "ANYONE", and can be added to Chain Contingency by giving CONTTARG.2da a proper fourth row, however, regular contingencies are still limited to only "Myself".



  • AstroBryGuyAstroBryGuy Member Posts: 3,415
    Very cool! Insightful, Agree, and Like! This would be very useful for Totemic Druids.

    Sounds like it wouldn't work with Nahal's Reckless Dweomer, since that generates the list of spells on-the-fly from the caster's own spellbook. Or did I misunderstand something?

  • kjeronkjeron Member Posts: 2,302
    edited February 2017
    @AstroBryGuy The spell-book(known&memorized) is fully accessible for nahal's, since this is all being done within normal Sequencer Creation(a part of the Mage Spellbook), just visually hidden. It can also pull the list of memorized Priest spells, since they are available to sequencers, possibly even known priest spells - something to look into.
    The problem is targeting, cast time, range, and using it to cast spells you have memorized.

    The initial spell now controls the range, casting time, and targeting, while the subspell is instant. So the casting time and range of the initial spell has to represent all the subspells it can cast. What restricts targeting is that spell's that require a "Creature" target will outright fail if you cast them "at a Point".

    Spell Immunity and Summon Spirit are relatively easy because each always uses the same targeting ("Caster" for Spell Immunity, "Target Point" for Summon Spirit).

    With Nahal's, there is no way to know ahead of time what the spell's target, range, or casting time will be, so any spell it casts would have to stuck to the standards of a normal Spell Sequencer: Fixed casting time and can only target creatures, not a point/location, and failure if out of range.

    The spell will still be decremented if it can be, there just isn't any check to see if you actually have any memorizations to decrement. This is irrelevant for spells that you cannot memorize in the first place, such as the subspells for Spell Immunity and Summon Spirit, but it matters for Nahal's. I've had limited success preventing this so far, but I suspect its possible.

    Personally, I'm not against giving Nahal's a fixed 1-round casting time with an instant-cast subspell, it would be a decent nerf to the spell. It could even be set up to restrict which spell levels it can choose from, so you cannot use it to cast L9 spells at level 1.

    Post edited by kjeron on
  • AquadrizztAquadrizzt Member Posts: 1,017
    Wait... @kjeron, can you add new Contingency conditions/targets through CONTCOND.2da and CONTTARG.2da?

  • kjeronkjeron Member Posts: 2,302

    Wait... @kjeron, can you add new Contingency conditions/targets through CONTCOND.2da and CONTTARG.2da?

    Yes and No.
    You can extend it to include the 21 existing conditions available through ocpode 232, but you cannot add custom ones.

  • The user and all related content has been deleted.

  • The user and all related content has been deleted.

  • kjeronkjeron Member Posts: 2,302

    Can I use this for a custom Contingency spell? And, how easily could it be Weiduized? Does it involve messing with finicky .lua files that cannot easily be patched by Weidu?

    This is pretty much why I never went any further with this idea. They have potential, but not accessibility to implement.

    Sequencer/Contingency can be manipulated to utilize/filter any spell by modifying the UI: known, unknown, memorized or spent. Wizard or Priest, (likely Innates as well, don't remember actually testing them).

  • The user and all related content has been deleted.

Sign In or Register to comment.