I have thought some more about options to get it to work. I have another idea that works flawlessly (I just tested it) if you are already using new weapons or copies of weapons in the user file.
Make an eval script inside each weapon. There is no looping. The eval script is run for that weapon when it is on the character. The downside is that each weapon entry would need a similar eval script, modified by the specialization/proficiency.
I prefer to use Traits 5000, as it works with my other mods. You can try an earlier timing if you want, but it seems to me that it is a modifier after, and in addition to, all other potential modifiers.
Code:
var proficient as number
proficient = -2
if (hero.tagis[Edge.edgPistol] = 1) then
proficient = 0
endif
field[wpBonus].value += proficient