In Shadowrun, I had to move the calculation of advCost into the same script in the CanAdvance component that handles adding the trtBonus for advancements. I also had to re-construct trtFinal within that script, so that I could use the un-modified value to calculate the cost of that advancement:
Code:
~increase and decrease advancements often need to look up the base value of the thing they're working with
if (origin.parent.tagis[Advance.Increase] + origin.parent.tagis[Advance.Decrease] <> 0) then
if (tagis[component.SkillIndiv] <> 0) then
basevalue = maximum(linkage[basis].field[trtUser].value, linkage[basis].field[sklGroup].value) + linkage[basis].field[trtAdvMod].value + linkage[basis].field[trtBase].value + linkage[basis].field[trtBonus].value
else
basevalue = linkage[basis].field[trtUser].value + linkage[basis].field[trtAdvMod].value + linkage[basis].field[trtBase].value + linkage[basis].field[trtBonus].value
endif
I also had to move that script to the traits phase, inbetween "Bound trtUser" and "Calc trtFinal #1"
The way it ends up happening is that each item on the advances table runs that script - they calculate their own advCost, and then they add +1 to trtBonus. Then, the next item on the advances table runs its script. Since the trtBonus from the last one has been added, when this one calculates its advCost, a different result is generated, and then this one adds +1 to trtBonus, and so on.
Oh, and the way you get at advCost has to change if you do that:
Code:
origin.parent.field[advCost].value += linkage[basis].field[trtAdvCost].value