Here is the script. You can add this script to your class and modify it to look for the table you want, and you should be able to keep this one and the normal one from crossing paths as long as you're specific about looking for secondary/tertiary/quaternary abilities.
Phase: PostLevel, priority: 10500
Code:
~build up a tag expression to identify all weapon training abilities for
~this class
var expr as string
expr = "wFtrGroup.? & CustTaken." & idstring
~first, make sure we have any weapon training abilities for this class.
~If we don't, there's nothing to do here.
doneif (hero.haschild[BaseCustSp,expr] = 0)
~debug "Weapon training is being calculated for " & field[name].text
~the best bonus available to all weapon training abilities is 1 at 5th level,
~+1 per 4 levels after that. If we don't have a bonus, we're done.
var bonus as number
bonus = field[cGiveSpec].value
var tagbonus as number
doneif (bonus = 0)
~go through all of our weapon training abilities in ascending order,
~giving a decreasing bonus to each.
foreach pick in hero from BaseCustSp where expr sortas _CompSeq_
~if our net bonus is 0 because we're run out of weapon types, we're
~done
doneif (bonus <= 0)
~set the bonus for this ability
eachpick.field[abValue].value += bonus
tagbonus = eachpick.field[abValue].value
~forward the weapon group tag we're assigned to the class a number of
~times equal to the bonus we're receiving
if (eachpick.field[abValue].value >= 1) then
var i as number
var wepexpr as string
var bonustag as string
wepexpr = eachpick.tagids[wFtrGroup.?," | "]
bonustag = eachpick.tagids[TrainBonus.?, ""]
foreach pick in hero from BaseWep where wepexpr
for i = 1 to tagbonus
perform eachpick.assignstr[bonustag]
next
nexteach
endif
~our next ability has a bonus of 1 lower
bonus -= 1
nexteach