Lone Wolf Development Forums

Lone Wolf Development Forums (http://forums.wolflair.com/index.php)
-   HL - Authoring Kit (http://forums.wolflair.com/forumdisplay.php?f=58)
-   -   Advances - Same Increase Multiple Times? (http://forums.wolflair.com/showthread.php?t=67314)

TCArknight August 15th, 2022 01:33 PM

Advances - Same Increase Multiple Times?
 
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
      id="trtAdvBonus"
      name="Advancement Bonus Value"
      type="derived">
          <!-- Calculate the final value from the three distinct pieces -->
      <calculate phase="Traits" priority="2950" name=""><![CDATA[

        @value = tagcount[Helper.Advancement]
               
        ]]></calculate>
      </field>
  <field
      id="trtXPCurr"
      name="XP For Current Point/Add"
      type="derived">
          <!-- Calculate the xp cost based on the trtUser -->
      <calculate phase="Traits" priority="3050" name="Calc trtXPCurr"><![CDATA[
                var nextAdd as number
            var nextCost as number
               
        ~ Attribute Cost
                if (tagis[component.Attribute] <> 0) then
                  nextAdd = field[trtUser].value + field[trtAdvBonus].value
              nextCost = 2 * nextAdd
                elseif (tagis[component.Skill] <> 0) then
                  nextAdd = field[trtUser].value + field[trtAdvBonus].value
              nextCost = nextAdd
                  endif
                 
                @value = nextCost
               
        ]]></calculate>
      </field>
    <!-- In-play bonuses applied to the trait -->
    <field
      id="trtXPNext"
      name="XP For Next Point/Add"
      type="derived">
          <!-- Calculate the xp cost based on the trtUser -->
      <calculate phase="Traits" priority="3050" name="Calc trtXPNext"><![CDATA[
                var nextAdd as number
            var nextCost as number
               
        ~ Attribute Cost
                if (tagis[component.Attribute] <> 0) then
                  nextAdd = field[trtUser].value + field[trtAdvBonus].value + 1
              nextCost = 2 * nextAdd
                elseif (tagis[component.Skill] <> 0) then
                  nextAdd = field[trtUser].value + field[trtAdvBonus].value + 1
              nextCost = nextAdd
                  endif
                 
                @value = nextCost
               
        ]]></calculate>
      </field>

CanAdvance Component:
Code:

    <eval index="2" phase="Traits" priority="2900"><![CDATA[
      ~we only worry about this on actual advances - not traits added at creation
      doneif (tagis[Advance.Gizmo] = 0)

      ~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.
         
      if (origin.parent.tagis[Advance.Increase] > 0) then
            ~ origin.parent.field[advCost].value += linkage[basis].field[trtXPNext].value
               
        perform linkage[basis].assign[Helper.Advancement]
               
                endif

      ]]></eval>

    <eval index="3" phase="Traits" priority="3060"><![CDATA[
      ~we only worry about this on actual advances - not traits added at creation
      doneif (tagis[Advance.Gizmo] = 0)
     
          var currCost as number
          notify linkage[basis].field[name].text & " This Cost: " & linkage[basis].field[trtXPCurr].value
         
          currCost = linkage[basis].field[trtXPCurr].value
         
      ~apply any appropriate increase or decrease for the linked trait
      origin.parent.field[advCost].value += currCost


      ]]></eval>

Advance Component:
Code:

    <eval index="1" phase="Traits" priority="3200">
        <after name="Calc trtXPNext"/><![CDATA[
      #resspent[resXP] += field[advCost].value
      ]]></eval>


ploturo August 16th, 2022 10:54 PM

Instead of spending the resXP resource with a script on the advancement picks, can you have the trait pick handle it?

It seems to know the total number of its advances based on the tags, so it should be able to calculate the total cost of its current advancements without having to worry about what they are and which order they were added in.


All times are GMT -8. The time now is 08:33 AM.

Powered by vBulletin® - Copyright ©2000 - 2022, vBulletin Solutions, Inc.
wolflair.com copyright 1998-2016 Lone Wolf Development, Inc. View our Privacy Policy here.