tl;dr : in Feat.2da, CATEGORY & MAXCR columns work.. sorta. But don't know where spells are getting their CR from. In Spells.2da the Category column works.
As a test, I changed Spell.2da Category for Cone of Cold ( SpellID #25 ) from "11" TALENT_CATEGORY_HARMFUL_AREAEFFECT_INDISCRIMINANT, to "1" TALENT_CATEGORY_HARMFUL_AREAEFFECT_DISCRIMINANT
and my debug script appropriately regarded my OgreMagi's mem'd Cone of Cold under the new category.
( i was concerned that the category might be defined in Henchspells.2da -- and it probably is for the scripted AI, but apparently not for these native functions )
Of interest:
GetCreatureTalentBest found Cone of Cold ((with the above change)) between 20 and 10 MaxCR, then switched to Sleep under 10 CR, and came up empty at 0 CR. However, there are talents that come up valid at 0 CR in other categories ...
Charm Person under harmful_ranged didn't, but healing_potion did and so does harmful_melee. ( maybe spells won't get chosen at only 0 MaxCR.. )
The oddest thing was harmful_melee: the chosen talent keeps switching back and forth between Disarm and Combat Expertise, don't know why. And it never chooses Knockdown -- all 3 feats are available to the Magi. Ahh, Knockdown isn't assigned a CATEGORY in Feat.2da. It *is* assigned a MAXCR right beside this tho. Improved Knockdown has neither. Disarm has both set; Improved Disarm has neither. Power Attack has both set; so does Improved Power Attack
Yep as soon as I assign Knockdown harmful_melee ( "22" ) in Feat.2da it shows up as an available talent in debug. I tend to believe, atm, that the scripted AI uses values from Hench*.2da rather than from these standard .2da's ...... anyway, i'm putting in some numbers here. See what happens
I have no clue where MaxCR is defined for spells yet, because so far i see no reason that these native functions are accessing Henchspells.2da.
Also, GetCreatureTalentRandom doesn't seem very random: the ogre has always gone Invis first, then Heroic 2nd. (on a half dozen runs). probly the pRNG seed ....
- am looking at the CATEGORY & MAXCR columns in Feat.2da; hard to make sense and easy to think "unfinished". Things like Bardsongs seem well set up with entries like 8 enhancement_areaeffect & 20 CR. Others like Epic Shapes & Epic Spells have Shape_Undead, 10 & 1 but then right under it is Shape_Dragon with nothing. Even Hellball has ... nothing. Is hellball even implemented in NwN2? .. the spellscript is here. Others have one column and not the other and vice versa.
As a test I pumped Disarm's MaxCR column up to 10 and sure enough, it filled my debug under harmful_melee as the talent to choose, from 0..20 MaxCR in GetCreatureTalentBest(). This is evidence that both CATEGORY & MAXCR actually work, in Feat.2da
ps. the "CRValue" column in Feat.2da is used for something entirely different, i thinkzor.
Unfortunately, increasing MAXCR even modestly seems to knock lesser Feats off the bottom of the graph,
ie. w/ Improved Disarm @ 3
and Improved Knockdown @ 3
Combat Expertise @ 1 never shows up even at MaxCR = 0. The debug just fluctuates between the two Improved feats. When i increase CE to 4, everything else gets knocked out (from MaxCR 20 down to MaxCR 0 in the debug-loop)
i Wish to stress that all this may have nothing to do with the scripted AI (eg. TonyK's ) which likely uses Hench*.2da files exclusively.
final test: setting the Feats' MAXCR at "1" makes the selection process jump around at various MaxCRs, apparently giving a decent spectrum of harmful_melee Talents.