I looked at this code and my understanding is this:
*they will work together* means that the custom kit will get the respective D5xxxx spells from the selected spheres and no longer any SPPRxxxx or SPINxxx, correct?
Priests no longer automatically get SPPR spells; regular spells are now assigned via each kit's clab table, that's why the mod needs to patch all kits in kitlist.2da. With this code, you can safely install the kit later, and it will patch itself in accordance with the F&P mod and your sphere choices.
But you still end up with (mostly) SPPR spells in your spellbook, they are simple added via 177 effects in an AP_ spell in the clab table. And that only applies to SPPR spells. SPIN and SPCL abilities are untouched.
In case any spells are defined in the initial kit definition (GA_xxxx), what will happen to those?
Those are untouched. Anything you add via the clab table will work no matter what. This is a good way to guarantee that a kit has access to a particular spell, regardless of whether the spell is in it sphere access. I believe priest spells don't double up in your spellbook even if you add them multiple times in multiple ways, so this is safe even when it is redundant.
As an example: say your cleric kit gets the Iron Skins druid spell from a "GA_SPPR506" line in the clab table. Now the player installs F&P, but your kit does not have major access to the sphere of Earth, which contains Iron Skins. What happens?
- You get your normal sphere spells, plus you get Iron Skins.
What if you do give your kit access to the sphere of Earth? Now there are two distinct mechanisms adding Iron Skins to your spellbook. What happens?
- You get Iron Skins once. The priest spellbook only displays a spell once no matter how many different mechanisms add it.
What if your kit has focus access to the sphere of Earth, which results in the kit getting Iron Skins as a 4th-level spell?
- This is the worst-case scenario. Your spellbook will contain Iron Skins as a 4th-level spell (the d5f___ spell which uses opcode 146 to cast SPPR506), and will also contain Iron Skins at 5th level (the normal SPPR506 spell). Not ideal... but not the end of the word, and it actually give the player added flexibility, to use whichever slots they prefer for that spell.
Do the mods update scripts, items, etc to the new spell references?
Don't need to. All it changes is the method by which spells are added to your spellbook. In cases where the spells are changed ("focus" versions of spells, or spells where we changed their spell level, or instances where we added a wizard spell to the priest sphere) the originals are still used, they are simply cast via opcodes 146/148. So script triggers, spell immunities, etc. should all work just as they do in the vanilla game.
Edited by subtledoctor, 29 March 2017 - 08:16 PM.