• Please note: In an effort to ensure that all of our users feel welcome on our forums, we’ve updated our forum rules. You can review the updated rules here: http://forums.wolflair.com/showthread.php?t=5528.

    If a fellow Community member is not following the forum rules, please report the post by clicking the Report button (the red yield sign on the left) located on every post. This will notify the moderators directly. If you have any questions about these new rules, please contact support@wolflair.com.

    - The Lone Wolf Development Team

Question in regards to Derived traits

SAbel

Well-known member
I am attempting to make the L5r system for HL I have made it to the point were the Rings (derived traits of the abilities) come into play but I can not make the traits work right I have the code at this point which results in a value of 0 for the trait when it should be the lower of the two abilities it is tied to; my example is the Air Ring (trait) which pulls from the abilities Awareness and Reflexes (which the system refers to as traits) ie Rings and traits.


<!-- Air Trait -->
<thing
id="trAir"
name="Air"
compset="Trait"
isunique="yes"
description="Air is mercurial and enigmaticm the element of intuition and understanding. Air is represented y the twin Traits of Awareness and Reflexes.">
<fieldval field="trtAbbrev" value="Air"/>
<eval index="1" phase="Traits" priority="4000">
<before name="Derived trtFinal"/>
<after name="Calc trtFinal"/><![CDATA[
~Air is the lower of the character's Awareness and Reflexes.
~minimum(field[attrAwa].value, field[attrRef].value)
]]></eval>

</thing>
 
Here's a script that should work:

Code:
~Air is the lower of the character's Awareness and Reflexes. 
field[trtBonus].value += minimum(#trait[attrAwa], #trait[attrRef])

Note that I've used macros, to make this simpler to write. In case you need it elsewhere, that statement, written out in full, without any simplifications (this version would work, too - it would do exactly the same things as the simpler version):

this.field[trtBonus].value += minimum(hero.child[attrAwa].field[trtFinal].value, hero.child[attrRef].field[trtFinal].value)

I presume the active line of the script was commented out because it didn't have an equals sign yet, and your code wouldn't have compiled without it? Remember, in scripts in HeroLab, EVERY line must be either flow control (like an if statement), a perform statement, or set something equal to something else.
 
Thank you mgehl, This stuff is just above my head and I am not doing well but this should help me out. I used the full statement b/c it must do this for 4 derived ablities.
Thank you for that help it makes the differance in everything.
If I go out and get a XML for dumies book would that help b/c I am having a hard time getting this to work correct. Like adding tabs, I could not make it work with the replacement from the wiki, or adding areas to skills other than what is presented in the wiki basics. I am still trying mind you just its much harder than what I had hoped.
 
Do you do most of your working in an XML editor (I am using XML Marker ver 1.1) or do you use the Authoring Kit?
 
I do everything in an XML editor. Remember that the editor that's available within each game system needs to be defined, by writing it in XML, before you can use it.

Don't worry about learning XML - XML is a very broad classification of things, and you don't need to know about every posible thing XML could be defined to do - you need to know what it has been defined to do in HeroLab.

What I would suggest is learning more about HeroLab's scripting language. If you already use any of the games that exist for HL (d20, M&M, etc.), pick up a book that hasn't been entered, and try entering a few things using the editor. You want to get experience and practice working with the scripting language before you try to learn both the scripting langauge AND the XML at the same time. If you have a couple of these games, Savage Worlds, 4ed, and Cortex (once it's released), would be the most informative, since they're all derived from the same skeleton files you're deriving L5R from (d20, M&M, and WoD were all written before the Skeleton files, so they'll be doing the same things, but they'll have different names for everything). After you've gotten practice entering these things using the editor, try entering a few things in XML.
 
All you would do for the other 4 versions is change the names of the attributes it references. So, for strength (id: attrStr) and willpower (ID: attrWil) (or whatever the attributes are called - I don't know L5R), you would use:

field[trtBonus].value += minimum(#trait[attrStr], #trait[attrWil])
 
I used your long forumal method and it works great for setting up the derived traits. Thank you.

Okay New one for this, the base for an trait is 2 max is 10 (this represents the amount of D10s one rolls when using the correct Trait), but there is a way to gain more character points when starting by dropping a trait to a value of 1. I did have the traits all starting at 2 but I could not use the up down arrows to drop down to 1 it was locked at low end of 2. So what must I do to have the Traits start (defult) at 2 but still be able if a person wanted to drop then down to a value of 1?
Ie in D&D the defult is 10 but a person could drop abilities lower if they wanted to have more points to spend.
I have not even started to tackle the level system in L5R nor am I worried about the points at this time. I am just not sure where I should start looking into this setting the ability defults (since I have them all in now.)
 
A creation script on the component.

Here's an example from Cortex that sets the initial value of a component to 3:

<!-- The default value of an attribute when creating a new character is d6, rather than the minimum of d4 -->
<creation><![CDATA[
field[trtUser].value = 3
]]></creation>


This page from the wiki:

http://hlkitwiki.wolflair.com/index.php5/Component_Element_(Data)

tells you the order to place all the various things in a component, so, the creation script belongs after the field definitions and the identity definitions, and before the tag definitions.
 
I did this line <fieldval field="trtUser" value="2"/> (I got the idea outta 4E files)
it works

<!-- Awareness Attribute
-->
<thing
id="attrAwa"
name="Awareness"
compset="Attribute"
isunique="yes"
description="is a representation of a characteer's intuition, and empathy.">
<fieldval field="trtAbbrev" value="Awa"/>
<fieldval field="trtUser" value="2"/>
<tag group="explicit" tag="1"/>
</thing>
 
Either way works. They both end up doing the same thing, the creation script, however, doesn't need to be repeated for every version of a thing (which is important if you need it for all 100 skills and skill specialties in your game.
 
Okay so heres my new one :)
to purchase attributes the cost is the new level *4
example Awareness starts at 2 the cost for making it 3 = 12 (new rank x4, or in this case 3x4=12) if the character wants to go from 2 to 4 the cost is 28 (first 3x4=12 then the next rank 4x4 = 16 so that the total is 12 + 16 = 28) so how do I make this happen?
 
Please do *NOT* worry about trying to handle character advancement yet. If that's what you're doing, you're getting *way* ahead of yourself.

If the cost of a trait during creation uses the scaling system you describe, you can simply calculate the total cost within a script. You know what the base value of the trait is, right? Then you can calculate the cost of raising it from the base value to its current value. That total value then represents the cost of that attribute.

Hope this helps....
 
Hello Rob I am no were near advancement yet!
(but the mechanic stays the same so)
When createing a character in L5R the player starts with 45 CP (character points) on attributes, skills, advantages extra heritage rolls, they may take an additional 10 cp points in disadvantages which adds to the pool making a max of 55 cp to spend.

Abilities cost the next rank * 4 (example if rank {starts at} 2 and player would like it to become 3 the cost is 12 CP (rank 3 * 4 = 12) but if the player wanted to go all the way to 4 the cost would be 28CP (rank 3 {12 points} + rank 4 {16 points})
So I need to find a way to make the cost =new rank * 4.
The player must pick a clan to start in that sets up the next two factors of
Clan Family (which gives a bonus +1 to a set attribute (a few are players choice attirbute) then the Clan school which also gives a +1 to set attribute (a few are players choice attirbute) and the characters starting Koku (money) and outfit (equipment)

Skills work 1 cp to purchase granting rank 1 in the skill then the cost is the new rank ex. Stealth rank 1 would cost 1 cp to go to rank 2 would cost 2 cp and to go to rank 3 would cost 3 cp, as a note a skill can not be raised higher than +2 ranks over the starting value.
Advantages all have a set cost so that is straight forward.
Disavantages add to the CP start total but a play may not add more than 10 points in this manner (they may end up with more through pour heritage results but those would be "free" add)

I also was wondering how to have the system not count the starting attributes when calculating CP. I have the attributes set to 2 (basic setting for the game) but it seems to charge them for the points at the begining.
 
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.
 
For the use of anyone else working with this sort of character creation point cost, where the value of a trait level is the sum of all the levels that have come before it, the equation is:

y = (trait cost multiplier) /2 * (x^2 + x)
 
mgehl you are a super genius!! It works perfectly and resets my starting CP so that the default does not count the skills for starting at rank 2.
By the I have a BS in Art Education and have no idea what miracle you made happen in excel and I helped create a grade books system that my school used for nearly 5 years so I am bowing at your screen name right now in praise!

Thanks you rock!
 
So then the skills would look like this just to double check with what you have typed

The current script
<!-- Each skill point that is allocated by the user costs 2 CP -->
<eval index="2" phase="Traits" priority="10000">
<before name="Calc resLeft"/>
<after name="Bound trtUser"/><![CDATA[
~if this skill is not added directly to the hero (i.e. an advance), skip it entirely
if (origin.ishero = 0) then
done
endif

~adjust the resource appropriately
hero.child[resCP].field[resSpent].value += field[trtUser].value * 2
]]></eval>

The changed script

<!-- Each skill point that is allocated by the user costs the next rank in CP-->
<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 traitvalue as number

traitlevel = field[trtUser].value
traitcost = 1
finalvalue =traitcost / 2 * (traitlevel * traitlevel + traitlevel)
hero.child[resCP].field[resSpent].value += finalvalue
]]></eval>
 
I may have a typo in there so this is the "fixed version" though I am not sure what id mess up PS to everyone this is located in the traits.str file :)

<!-- Each skill point that is allocated by the user costs the next rank in CP-->

<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 = 1

finalvalue = traitcost / 2 * (traitlevel * traitlevel + traitlevel)

hero.child[resCP].field[resSpent].value += finalvalue
]]></eval>
 
Leave in the section (4 lines) that starts "~if this skill is not added directly..." Otherwise, when your character spends XP to learn a new skill later on, it will have to start with field[trtUser].value = 1, because that's the minimum value, and therefore, this script will charge character creation points, while the advancement mechanisms also charge XP.

This doesn't need to be in the attribute section, because you start with all the attributes - you can't add a new one during play.

I hadn't thought to take a look at the skills to see if there was anything else to that script.
 
Ouch I get an error

The data files could not be loaded due to the following errors:

Syntax error in 'eval' script for Component 'Skill' (Eval Script '#2') on line 15
-> One or more 'if' statements is missing the closing 'endif' statement
One or more timing errors were identified. Please review the timing report and correct the errors. You can access the report under the 'Develop' menu or by clicking this link.

I placed it as follows

<eval index="2" phase="Traits" priority="10000">
<before name="Calc resLeft"/>
<after name="Bound trtUser"/><![CDATA[
~if this skill is not added directly to the hero (i.e. an advance), skip it entirely
if (origin.ishero = 0) then
var traitlevel as number
var traitcost as number
var finalvalue as number

traitlevel = field[trtUser].value
traitcost = 1

finalvalue = traitcost / 2 * (traitlevel * traitlevel + traitlevel)

hero.child[resCP].field[resSpent].value += finalvalue

]]></eval>
 
Back
Top