I think I found a solution. Finally. At least it hasn't hit an exception yet. The implementation is brute force and crude and ugly, but since my changes to equipment.str and miscellaneous.str don't seem to impact things (or throw errors during compilation), this was the only thing I could figure out.
Step 1:
Introduce a Setting Adjustment that makes all Skills non-specialized (-2). Right now, that's only being done for the combat skills, but if this works, I'll do it everywhere.
if (hero.childexists[skShooting] = 1) then
perform #traitroll[skShooting,-,2,"Specialization"]
endif
if (hero.childexists[skFighting] = 1) then
perform #traitroll[skFighting,-,2,"Specialization"]
endif
if (hero.childexists[skThrowing] = 1) then
perform #traitroll[skThrowing,-,2,"Specialization"]
endif
Step 2:
Start tracking the unique number of skills. I created a Derived Trait for this (Specializations). I set it up to use Phase: Traits and Priority: 4000. The eval script is:
var modifier as number
modifier = 0
foreach pick in hero where "thingid.sk?"
modifier += 1
nexteach
foreach pick in hero where "thingid.skKn?"
modifier -= 1
nexteach
field[trtBonus].value += modifier
#resmax[resEdge] += .5 * modifier
The resmax for Edge is bumped up .5 for each (non-Knowledge) skill purchased because you get one free specialization.
Step 3:
Instead of subtracting -2 from everything else, now I just add +2 to the specialized skill.
Here's the code for the Eval Script for Assault Rifle specialization:
foreach pick in hero from WeapRange
if (eachpick.tagis[WeaponType.ModAssault] = 1) then
eachpick.field[wpBonus].value += 2
endif
nexteach
I'll try some more things out tomorrow, but at this point, the specialization edge solution is working.
|