Lone Wolf Development Forums  

Go Back   Lone Wolf Development Forums > Hero Lab Forums > HL - Authoring Kit

Notices

Reply
 
Thread Tools Display Modes
geoffnsandiego
Junior Member
 
Join Date: Apr 2017
Posts: 7

Old April 9th, 2017, 11:33 AM
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
geoffnsandiego is offline   #1 Reply With Quote
Mathias
Senior Member
Lone Wolf Staff
 
Join Date: May 2005
Posts: 13,207

Old April 9th, 2017, 12:50 PM
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?
Mathias is online now   #2 Reply With Quote
Mathias
Senior Member
Lone Wolf Staff
 
Join Date: May 2005
Posts: 13,207

Old April 9th, 2017, 01:12 PM
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.
Mathias is online now   #3 Reply With Quote
geoffnsandiego
Junior Member
 
Join Date: Apr 2017
Posts: 7

Old April 9th, 2017, 01:37 PM
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
geoffnsandiego is offline   #4 Reply With Quote
Mathias
Senior Member
Lone Wolf Staff
 
Join Date: May 2005
Posts: 13,207

Old April 9th, 2017, 01:42 PM
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?
Mathias is online now   #5 Reply With Quote
geoffnsandiego
Junior Member
 
Join Date: Apr 2017
Posts: 7

Old April 9th, 2017, 02:19 PM
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.
geoffnsandiego is offline   #6 Reply With Quote
geoffnsandiego
Junior Member
 
Join Date: Apr 2017
Posts: 7

Old April 9th, 2017, 08:38 PM
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?
geoffnsandiego is offline   #7 Reply With Quote
Mathias
Senior Member
Lone Wolf Staff
 
Join Date: May 2005
Posts: 13,207

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 online now   #8 Reply With Quote
Mathias
Senior Member
Lone Wolf Staff
 
Join Date: May 2005
Posts: 13,207

Old April 10th, 2017, 08:23 AM
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
That way, there are no decimal values.
Mathias is online now   #9 Reply With Quote
geoffnsandiego
Junior Member
 
Join Date: Apr 2017
Posts: 7

Old April 10th, 2017, 09:26 AM
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
geoffnsandiego is offline   #10 Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -8. The time now is 03:15 AM.


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