View Single Post
Senior Member

Join Date: Jan 2007
Location: NW Arkansas
Posts: 1,301

August 15th, 2022, 01:33 PM
Howdy all!

I'm playing around with a dataset where improving Attributes and Skills has a varying cost based on the level of the Trait.

For Attributes, the XP cost of an advance is twice the next level (Current is 9, going to 10 costs 20 points, then to 11 is 22 (for 42 total to go from 9->11). Skills are the next level for cost (current is 1, going to 2 is 2, then to 3 is another 3 for 5 total to go from 1-3).

However, when I take a second advance for the same Trait (whether it's Attribute or Skill) both advances take the most recent cost. So, above would be fine with the first advance to the Attribute, the cost is 20. As soon as I take the second advance, the previous advance to the attribute takes on the new cost of 22, and the new advance is 22 as well.

There's a simple solution to this I know, but I'm drawing a blank... Anyone see a solution?

Trait (XP Fields):
Code:
```
<field
type="derived">
<!-- Calculate the final value from the three distinct pieces -->
<calculate phase="Traits" priority="2950" name=""><![CDATA[

]]></calculate>
</field>
<field
id="trtXPCurr"
type="derived">
<!-- Calculate the xp cost based on the trtUser -->
<calculate phase="Traits" priority="3050" name="Calc trtXPCurr"><![CDATA[
var nextCost as number

~ Attribute Cost
if (tagis[component.Attribute] <> 0) then
elseif (tagis[component.Skill] <> 0) then
endif

@value = nextCost

]]></calculate>
</field>
<!-- In-play bonuses applied to the trait -->
<field
id="trtXPNext"
type="derived">
<!-- Calculate the xp cost based on the trtUser -->
<calculate phase="Traits" priority="3050" name="Calc trtXPNext"><![CDATA[
var nextCost as number

~ Attribute Cost
if (tagis[component.Attribute] <> 0) then
elseif (tagis[component.Skill] <> 0) then
endif

@value = nextCost

]]></calculate>
</field>```
Code:
```    <eval index="2" phase="Traits" priority="2900"><![CDATA[

~apply any appropriate increase or decrease for the linked trait
~Note: This pick is a child of the gizmo and our parent pick is the actual "Advance"
~       pick that contains the appopriate "Advance" tag, so be sure to check there.
~Note: Since the advancement is displaced to the hero, it's "parent" is *not* the
~       gizmo, so we must explicitly reference through the "origin" container.

endif

]]></eval>

<eval index="3" phase="Traits" priority="3060"><![CDATA[

var currCost as number

~apply any appropriate increase or decrease for the linked trait

]]></eval>```
```    <eval index="1" phase="Traits" priority="3200">