Yes, it checks the spellbooks for known spells (wizard/priest).
No, unfortunately Local variables are not available to the UI, only Global variables.
The only other thing that is viably detectable is stored sequencers, which carry the annoyance of a permanent Spell Sequencer Icon.
Well, if it can be made to track global variables, then it can track local variables in a way, say with the help of an invisible monster (it wouldn't be bullet proof, but it would work fine with the proper warnings).
Summon an invisible creature that checks for the local variables, as well as other attributes--can they check party position?--and then set global variables based on those detected values.
Probably best case, it would check for the internal vars and party position, and set a particular unique global for that specific party position and internal variable combination.
Well, if it can be made to track global variables, then it can track local variables in a way, say with the help of an invisible monster (it wouldn't be bullet proof, but it would work fine with the proper warnings).
It would be nice if we could blacklist certain spells, to exclude them from being offered. Like those Spell Immunity subspells, for instance. And for my multiclass sorcerers, Identify (which is non-functional for them). It would be a bit of a middle-ground between "offer all wizard spells" and "define the entire spell list by hand."
Simple enough to add an optional blacklist for something like Identify when auto-generating the list from all spells. No extra 2da tables this time though, just going to use an array, since it shouldn't be a long list:
ACTION_DEFINE_ARRAY ~name~ BEGIN ~WIZARD_IDENTIFY~ etc... END
and another STR_VAR:
blacklist = ~name~
It should not be offering the Spell Immunity subspells for learning in the first place, is it?. There is an odd issue with it not offering them for normal sequencer/contingencies, which will get fixed now.
If you are referring to wanting to block specific subspells when casting the normal sequencer/contingency spells, that is a separate matter.
I have also added some support to try the Global/Locals variable tracking, if you would like to see if it's worth it. Activating the ability takes up to a second when using the method, as the script checks/updates the variables. It's called with INT_VAR "global = 1". @Aionz if you would like to try using this for your "free" spells from scrolls, set "global = 2", and apply a 'LOCALS' variable by name of the spells resref to 2 on the creature. The spell will not be offered and not count towards the known spell limit for that level.
Assuming the answer to that is yes, can it constrain the available spells by level? Could I set up a sequencer spell which, instead of adding 3 spells of 4th level or below, only lets you add 4th-level spells - and not 1st-3rd level spells?
Yes.
This will setup Spell Trigger to only allow spells of 4th level:
OUTER_SPRINT resref ~SPWI809~
OUTER_SPRINT custom ~~~~~ function()
local temp = {}
for k,v in pairs (bookSpells) do
if v.level == 3 then // starts with 0 = spell level 1
table.insert(temp, v)
end
end
bookSpells = temp
end~~~~~
LAF CREATE_SEQUENCER_MENU STR_VAR resref custom END
However, I just found an issue while testing this with the default UI function that expands spells added through 2da's. They receive their actual level, rather than (level - 1). i.e. Spell Immunity subspells would not show up if you restricted it to only allow level 5 spells, because level 5 spells have a v.level value of 4, and those subspells would have a v.level value of 5. (I just updated the tool with a fix for this, v.53).
I think you could do it without a stat.
In the learning subspell:
- Learn Spell ()
- Cast spell A
- Cast spell B
spell A: Remove Spell (), Immunity to SpellB (no duration), Immunity to SpellA(timing 9)
spell B: Remove Spell (), Immunity to SpellB (timing 9)
First time casts spellA, removes the spell for relearning, blocks spellB, and grants permanent immunity to SpellA.
Second time casts spellB, removes the spell for relearning, grants permanent immunity to spellB.
Third time spell is learned without being removed, can no longer be selected for learning.
Is there possibly a max integer limit for the number of known spells?
No max limit, it's choking on trying to find a baseline for levels 4-7, I'll work on it.
For the moment - add a 51st row granting 1 spell for each levels 4-7, and a 52nd row granting 2 spells for each levels 4-7.
EDIT - apparently some of my spells' icons didn't get copied in, and the function mandates that the spellbook and L-suffix spells must have the same icon.
It's not mandatory - it just copies the existing spell to create the L-suffix version - but the icon can be changed to anything you want, or setup as anything you want it your creating them yourself.
@subtledoctor I've upload a new version, it should fix the issues with custom known spells tables.
@Necromanx2 , @Raduziel , I've removed the "Red X" icon - if you can't learn any spells of the current level, it just won't do anything when you click on the spells icon or memorize button now. If you can't learn any more spells of any level, you can still escape the screen by pressing the "escape" key.
@subtledoctor - looks like the game wipes all known spells from invalid classes when you dual class.
I had never really tested it for anything but the sorcerer/shaman, which cannot dual.
It might be possible, if known spells are being tracked through local variables, to have the first CLAB level spawn an invisible CRE to grant all spells that should be known by checking the local variables on the summoner.
1) All cleric and mage spells are checked. I don't understand the issue though - you cannot "know" the same RESREF as both a mage and cleric spell, unless you directly edit the creature file.
Comments
No, unfortunately Local variables are not available to the UI, only Global variables.
The only other thing that is viably detectable is stored sequencers, which carry the annoyance of a permanent Spell Sequencer Icon.
Well, if it can be made to track global variables, then it can track local variables in a way, say with the help of an invisible monster (it wouldn't be bullet proof, but it would work fine with the proper warnings).
Summon an invisible creature that checks for the local variables, as well as other attributes--can they check party position?--and then set global variables based on those detected values.
Probably best case, it would check for the internal vars and party position, and set a particular unique global for that specific party position and internal variable combination.
Then it would cast the spell select spl.
Then reset all variables and destroy self
It should not be offering the Spell Immunity subspells for learning in the first place, is it?. There is an odd issue with it not offering them for normal sequencer/contingencies, which will get fixed now.
If you are referring to wanting to block specific subspells when casting the normal sequencer/contingency spells, that is a separate matter.
I have also added some support to try the Global/Locals variable tracking, if you would like to see if it's worth it. Activating the ability takes up to a second when using the method, as the script checks/updates the variables. It's called with INT_VAR "global = 1".
@Aionz if you would like to try using this for your "free" spells from scrolls, set "global = 2", and apply a 'LOCALS' variable by name of the spells resref to 2 on the creature. The spell will not be offered and not count towards the known spell limit for that level.
This will setup Spell Trigger to only allow spells of 4th level:
However, I just found an issue while testing this with the default UI function that expands spells added through 2da's. They receive their actual level, rather than (level - 1). i.e. Spell Immunity subspells would not show up if you restricted it to only allow level 5 spells, because level 5 spells have a v.level value of 4, and those subspells would have a v.level value of 5. (I just updated the tool with a fix for this, v.53).
In the learning subspell:
- Learn Spell ()
- Cast spell A
- Cast spell B
spell A: Remove Spell (), Immunity to SpellB (no duration), Immunity to SpellA(timing 9)
spell B: Remove Spell (), Immunity to SpellB (timing 9)
First time casts spellA, removes the spell for relearning, blocks spellB, and grants permanent immunity to SpellA.
Second time casts spellB, removes the spell for relearning, grants permanent immunity to spellB.
Third time spell is learned without being removed, can no longer be selected for learning.
For the moment - add a 51st row granting 1 spell for each levels 4-7, and a 52nd row granting 2 spells for each levels 4-7.
@Necromanx2 , @Raduziel , I've removed the "Red X" icon - if you can't learn any spells of the current level, it just won't do anything when you click on the spells icon or memorize button now. If you can't learn any more spells of any level, you can still escape the screen by pressing the "escape" key.
I honestly had no issue with the X icon: the "problem" I've reported once was due to my own stupidity, not an issue with the function.
I had never really tested it for anything but the sorcerer/shaman, which cannot dual.
It might be possible, if known spells are being tracked through local variables, to have the first CLAB level spawn an invisible CRE to grant all spells that should be known by checking the local variables on the summoner.
2) to do ... what?