• 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

trying to get level dependant text on 'special' tab

psych777

Well-known member
i have a trait i'm trying to put in place that adds damage, variable on level like sneak attack. the damage is only added once per day, here is the text of it:

Once per day as a free action, if you use a spell or effect of the necromancy school, you can choose to add +1 to the DC of that spell’s or effect’s saving throw. If that subject fails its save against that spell or effect you deal an additional 1d6 points of damage for every 4 character levels you possess (to a maximum of +5d6 at 20th level).

i tried looking at sneak attack to get an idea how to get the d6 damage to show on the Special tab, but that just confused me more. haha.
since i couldn't really grasp what was going on, i tried just coping the 2 eval scripts i found in sneak attack and put them on my trait, but it errors when i add it to the hero. sneak attack scripts:

final 10000
field[abValue].value += field[xCount].value

render 10000
field[listname].text = "Sneak Attack " & signed(field[xIndex].value) & "d6"

and the error i get ('trKTDDvyJn' is unique ID of my trait):
Attempt to access field 'xCount' that does not exist for thing 'trKTDDvyJn'
Attempt to access field 'xIndex' that does not exist for thing 'trKTDDvyJn'
Attempt to access field 'listname' that does not exist for thing 'trKTDDvyJn'

i couldn't figure out where it was grabbing those values from in the sneak attack so i expected it not to work for me. but how do i get the text of the trait on the 'special' tab to show the increasing +d6 dmg like the sneak attack ability does?
 
thanks, will look into that with more detail after the usa game.
quick glance at xIndex and the sneak attack confuses me as i only see one bootstrap in sneak attack and its for aaSneakAtt ("Sneak Attack (Army Abil)"), not multiple bootstraps like his post seems to indicate...but will look more closely later
 
Traits are very different from Class abilities and fields like xCount are not going to be present. You will need to get the calculated level of the character from the hero instead of getting it from a field calculated on the class.

So a quick idea of xCount/xIndex is to tell the script how many times itself has been bootstrapped to a class. So Sneak Attack is bootstrapped several times to the class at the level it needs to increase.

You can't do that with a trait. Instead figure out your level and figure out the bonus based on the level which increases every 4 levels:

Post-Levels/10000
Code:
[COLOR="Green"][B]~ Calculate our bonus of +1 per 4 levels[/B][/COLOR]
field[abValue].value += round(herofield[[B][COLOR="Red"]LEVEL_FIELD[/COLOR][/B]].value/4,0,-1)

[B][COLOR="Green"]~ We can only have a max value of +5d6[/COLOR][/B]
field[abValue].value = minimum(field[abValue].value,5)

[B][COLOR="Green"]~ If we have a bonus then set the live name[/COLOR][/B]
If (field[abValue].value <> 0) Then
[B][COLOR="Green"]  ~ This makes it display "Trait Name +Xd6" where X is the bonus in abValue[/COLOR][/B]
  field[livename].text = field[name].text & " " & signed(field[abValue].value) & "d6"
Endif
The above script will work except for the fact you have to fill in the correct "LEVEL_FIELD". To figure this out go to "Develop->Floating Info Windows->Show Hero Fields". Then in the new window see if any of the fields make sense for getting the character's level.
 
awesome!
that has been my biggest problem trying to figure things out, when one type of thing (trait) is doing what another thing does. what you said makes sense.

the field i used for 'LEVEL_FIELD' was 'tTotLevel' and so far seems to be working perfectly.

just so i make sure i understand, the first code is setting the value of 'abValue' right?
in the second line you use the code 'minimum' when you describe setting a maximum...seems odd but i assume that is part of herolab's language?
the last line, when i look at the developer fields popup windows, i can't find 'livename' nor 'signed' anywhere. i've tried right clicking right on the entry in the Special tab of the trait and on the 'show hero fields'. is there somewhere different i would go to find these on my own?
 
awesome!
that has been my biggest problem trying to figure things out, when one type of thing (trait) is doing what another thing does. what you said makes sense.
This gets easier as you get use to the way HL does stuff.

the field i used for 'LEVEL_FIELD' was 'tTotLevel' and so far seems to be working perfectly.
Perfect! :)

just so i make sure i understand, the first code is setting the value of 'abValue' right?
The generic fields abValue, abValue2, abValue3, and abValue4 have been added to almost every Thing in HL. Its a work field that gives the benefit of allowing outside Things/Scripts to adjust your values.

So lets say you have a feat that gives a "+1" increase to this trait. Because we used abValue we can easily adjust the traits value by running the script on the feat at 9,000 instead of 10,000:
Post-Levels/9000
Code:
[B][COLOR="Green"]~ Increase dice damage by 1[/COLOR][/B]
#value[trKTDDvyJn] += 1
#value[] is a macro that just makes things easier to write. #value is the same as doing
Code:
hero.child[trKTDDvyJn].field[abValue].value += 1
Under the covers HL converts #value[] to the above for you.

in the second line you use the code 'minimum' when you describe setting a maximum...seems odd but i assume that is part of herolab's language?
This is more a programming thing not specific to HL. In this case the function "minimum()" is saying return the smallest value between abValue and 5. So in example if abValue is 2 then we get an answer of 2 as it is the smallest value (ie minimum). If abValue was 6 then it returns 5 as that is the smallest value.

Hope that makes sense. ;)

the last line, when i look at the developer fields popup windows, i can't find 'livename' nor 'signed' anywhere.
livename, name, and thingname are all fields that are always present but they don't display on the debug window. I know strange but its just how it is.

livename is the field that is finally displayed by HL at Render/99999999. So as long as we set it before then it will display what we tell it or it defaults to the name of the Thing.

Stuff that uses () are Language Intrinsics or functions. So signed(), maximum(), minimum() are functions that you can use to help your scripts. Signed() returns the value with a positive/negative sign in front. So signed(1) returns "+1".

You can find these on the Authoring Wiki.
 
Back
Top