Crazy idea, but couldn't you do a check on the memorized spell array value?
I just tried using:
Code:
if (hero.child[cHelpWiz].field[cMemMax].arrayvalue[2] >= 1) then
hero.child[cHelpWiz].field[cMemMax].arrayvalue[2] -= 1
hero.child[cHelpWiz].field[cSecMax].arrayvalue[2] += 2
endif
and it seems to work, the logic being that if you can cast a spell of that level from attribute bonus or otherwise, the variant and normal specialist take effect. essentially the check is "can the character cast X level spells from X class?"
going to need to back check all of the caster variants and see which are affected by this though.
to update focused specialist, just replace the #levelcount expressions with arrayvalue[spelllevel] >=1