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

Old April 10th, 2017, 08:10 AM
Okay, I did a little graphing and trendlining, and got excel to give me the formula.

You've got these two formulas:

from 8-13:
y = 15x
from 14-19:
y = 7.5x^2 - 187.5x +1245
(yeah, it's a weird-looking formula, but plug in the numbers for a few tests, and you'll see everything will be correct).

So, in the code you posted earlier, you've got an example of some math going on:
Code:
hero.child[resCP].field[resSpent].value += (field[trtUser].value - 1) * 7
Here's that, replaced with the correct function. You'll note that I also store the value in a field, and then use that field's value to actually add to the resource - that way, if you want to display the cost somewhere, you can just look up this value instead of recalculating it (take a look at the Shadowrun game system, for example - see how we list the costs for everything)? (You can load and launch a game system in demo mode to take a look at details of that system without having to pay for it).

Code:
if (field[trtUser].value <= 13) then
  field[trtAPCost].value += 15 * field[trtUser].value
else
  field[trtAPCost.value += 7.5 * field[trtUser].value * field[trtUser].value - 187.5 * field[trtUser].value + 1245
  endif

hero.child[resCP].field[resSpent].value += field[trtAPCost].value
Earlier, you mentioned a term - "AP" - is that what your game system calls its character creation points? Does that mean "attribute points", and is attribute-specific, or does it mean something more generic?

If it is specific to attributes, then instead of trtAPCost, which is intended to be generic, you'd call it attrCost, and then it's only for attributes.

Generic cost field - put this in the Traits component:

Code:
<field
  id="trtAPCost"
  name="A? Point Cost"
  type="derived">
  </field>
Or, if it's attribute-specific, put this in the Attribute component, and change all the references in my script earlier from trtAPCost to attrCost:

Code:
<field
  id="attrCost"
  name="Attribute Point Cost"
  type="derived">
  </field>
Mathias is offline   #8 Reply With Quote