Question about increasing Attribute Cost
So this is what is my skeleton system:
<!-- Attribute component Each attribute possessed by the actor derives from this component --> <component id="Attribute" name="Attribute" autocompset="no"> <!-- Attributes have a minimum trait value of 1 --> <eval index="1" phase="Initialize" priority="3000"><![CDATA[ field[trtMinimum].value = 1 ]]></eval> <!-- 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> I want Attributes to be based on an increasing scale as follows: Each point up to 14 costs 15 AP(CP) each 15 costs 30 AP 16 costs 45 AP 17 costs 60 AP you get the idea I know it needs to go here: <after name="Bound trtUser"/><![CDATA[ hero.child[resCP].field[resSpent].value += (field[trtUser].value - 1) * 7 ]]></eval> But I'm not sure how to go about it. Any help would be greatly appreciated. Geoff |
How familiar are you with scripting? Have you figured out how to use an if...then? And have you figured out how to set up a mathematical formula?
Also, please be more clear about your formula. When you say "each point up to 14 costs 15", does that mean that I have to pay a total of 150 to get a 10? And then, because the cost/point increases drastically above 14, am I paying a total of 210 for 14 and 240 for 15? |
Actually, give me the formula in terms of total cost to get to that level, not the cost per point.
from 1-14: AP = 15 * points from 15-? AP = some more complex formula In that sort of format - the total cost is simpler to build a script around. |
So here's the Attribute Chart
1-14 = 15 AP per point (so an STR of 10 would cost 150AP) 15 = 30 16 = 45 17 = 60 18 = 75 19 = 90 Max Attribute Value is 19 Thanks Mathias Geoff |
Take a look at the rest of the questions I asked, please - how are you with scripting? Can you turn those numbers into formulas that can be used to calculate the total cost?
|
Ugh, So I'm trying to figure out how to write complex formulas in Hero Lab/XML but I can't find a good reference source.
|
Okay I may have considered this from the wrong angle.
Each Attribute defaults to an 8. Players pay no AP for this. Costs for an Attribute value are calculated according to this table: 8 = 0 9 = 15 10 = 30 11 = 45 12 = 60 13 = 75 14 = 90 15 = 120 16 = 165 17 = 225 18 = 300 19 = 390 Players cannot purchase an Attribute above 19. (Values are the total cost) So is there some way to use a lookup to calculate the value? |
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 Code:
if (field[trtUser].value <= 13) then 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 Code:
<field |
I was taking another look at that formula, and I think I came up with something that looks better:
Code:
field[trtAPCost.value += 15 *(field[trtUser].value * field[trtUser].value - 25 * field[trtUser].value + 166) / 2 |
Thanks Mathias. I put the lines in and now I'm getting an odd error:
Syntax error in 'eval' script for Component 'Attribute' (Eval Script '#2') on line 4 - Extra characters at end of line Here's the information in my Traits.str file <!-- 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[ if (field[trtUser].value <= 13) then field[trtAPCost].value += 15 * field[trtUser].value else field[trtAPCost.value += 15 *(field[trtUser].value * field[trtUser].value - 25 * field[trtUser].value + 166) / 2 endif hero.child[resCP].field[resSpent].value += field[trtAPCost].value ]]></eval> Any clue as to what I did wrong? Geoff |
All times are GMT -8. The time now is 04:19 AM. |
Powered by vBulletin® - Copyright ©2000 - 2024, vBulletin Solutions, Inc.
wolflair.com copyright ©1998-2016 Lone Wolf Development, Inc. View our Privacy Policy here.