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".
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 UI.menu, 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:
Contingency Target within 4ft
Contingency Target within 10ft
Caster killed a creature
Contingency Target died
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".