View Single Post
Mathias
Senior Member
Lone Wolf Staff
 
Join Date: May 2005
Posts: 13,213

Old July 14th, 2009, 02:23 PM
Here's how to go about this. What you need (as Rob said), is a mathematical formula that expresses the total cost of buying that level, as a function of the level.

So, for attributes:
2 0
3 12
4 28
5 48

If you're good at math, you can derive the formula yourself. My training was in the sciences (I have a BS Biology, and I've now ended up as a computer programmer - go figure), so I was trained in how to get Excel or my graphing calculator to get it for me. You enter that data into excel, produce a scatter plot of it, and then tell Excel to generate a trendline.

What you get for that data above is:

y = 2x^2 + 2x - 12

for skills:

1 1
2 3
3 6
4 10
5 15

in this case:
y = 1/2x^2 + 1/2x

so, the attribute cost function in the skeleton files is:

Code:
 
<!-- Each attribute point above one that is allocated by the user costs 7 CP -->
<eval index="2" phase="Traits" priority="10000">
<before name="Calc resLeft"/>
<after name="Bound trtUser"/><![CDATA[
hero.child[resCP].field[resSpent].value += (field[trtUser].value - 1) * 7
]]></eval>
You'll replace that with:
Code:
 
<!-- Each attribute point above one that is allocated by the user costs 4CP * the level, per level -->
<eval index="2" phase="Traits" priority="10000">
<before name="Calc resLeft"/>
<after name="Bound trtUser"/><![CDATA[
var traitlevel as number
var traitcost as number
var finalvalue as number
 
traitlevel = field[trtUser].value
traitcost = 4
 
finalvalue = traitcost / 2 * (traitlevel * traitlevel + traitlevel)
 
hero.child[resCP].field[resSpent].value += finalvalue - 12
]]></eval>
See how the multiplier for attributes is set up as traitcost = 4

If you calculated the function for attributes from 0, you'd find that level 1 would cost 4 points, and level 2 would cost 8 points, so the finalvalue variable that's been calculated represents the total cost to get to the level we're at. Since level 2 should be free, and it would normally cost 12 points to get there, subtract 12 from finalvalue to get the cost of increasing things from 12.

For skills, you can use the same function. All you have to do is set traitcost = 1 and remove the -12, since there are no free points for skills.
Mathias is offline   #14 Reply With Quote