Member
Join Date: Mar 2015
Posts: 91
|
Good Day,
I have been working on a side project with the authoring kit and have encountered a small problem. The progression system I am trying to implement has a two tier cost system, and the cost system is also non-linar. The first set of costs are: rank cost (total cost) 0 0 (0) 1 10 (10) 2 15 (25) 3 20 (45) 4 25 (70) 5 30 (100) The second set of costs are: rank cost (total cost) 0 0 (0) 1 5 (5) 2 10 (15) 3 15 (30) 4 20 (50) 5 25 (75) Using thread necromancy I found this: http://forums.wolflair.com/showthrea...t=excel&page=2 Which helped resolve the second set of numbers. However, the first set of numbers are behaving strangely. Code:
<!-- Each career skill point that is allocated by the user costs the appropriate XP --> <eval index="5" phase="Traits" priority="10000"> <before name="Calc resLeft"/> <after name="Bound trtUser"/><![CDATA[ doneif (field[trtFinal].value = 0) doneif (tagis[Skill.Career] = 0) var traitlevel as number var traitcost as number var finalvalue as number traitlevel = field[trtFinal].value traitcost = 5 finalvalue = traitcost / 2 * (traitlevel * traitlevel + traitlevel) hero.child[resXP].field[resSpent].value += finalvalue ]]></eval> <!-- Each non-career skill point that is allocated by the user costs the appropriate XP --> <eval index="6" phase="Traits" priority="10000"> <before name="Calc resLeft"/> <after name="Bound trtUser"/><![CDATA[ doneif (field[trtUser].value = 0) doneif (tagis[Skill.Career] = 1) var traitlevel as number var traitcost as number var finalvalue as number traitlevel = field[trtFinal].value traitcost = 5 finalvalue = traitcost / 2 * (traitlevel * traitlevel + traitlevel) hero.child[resXP].field[resSpent].value += finalvalue + 5 ]]></eval> Without the doneif (field[trtUser].value = 0) line, it causes the 0 value of the skill to cost 5 each. Was wondering if anyone could help tell me what blindingly obvious mistake that I am making is? I also tried this: Code:
var traitlevel as number doneif (field[trtFinal].value = 0) doneif (tagis[Skill.Career] = 1) var finalvalue as number traitlevel = field[trtFinal].value finalvalue = (2.5 * traitlevel * traitlevel) + (2.5 * traitlevel) hero.child[resXP].field[resSpent].value += finalvalue - 5 --> |
#1 |
Senior Member
Lone Wolf Staff
Join Date: May 2005
Posts: 13,213
|
In this case, your first set of costs are not quite the same formula.
The formula for your first table is 2.5x^2 + 7.5x So in HL: Code:
traitcost = 5 finalvalue = (traitcost / 2 * traitlevel * traitlevel) + (traitcost * 3/2 * traitlevel) |
#2 |
Member
Join Date: Mar 2015
Posts: 91
|
Good Day,
Thanks for the rapid response. It, of course, works. |
#3 |
|
|