• 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

Getting race info

AndrewD2

Well-known member
I've got a template that needs to set some values based on the original CR of the target race. I know it's the rCR field but I'm not sure what transition to get there.

I'm thinking possibly parent.field[rCR].value but I figured I'd ask before getting involved in these templates too far.

Andrew
 
Great, I love learning new things! But I've realized that template CR is stored in an array and while I can easily find field names I'm not sure what the array is.
 
So you need to set some values in the template CR array based on the race's starting CR? Details, please.
 
This template halves a lot of the base races stuff, including CR so I would need to set the value that the CR is adjusted by = round(hero.findchild[BaseRace].field[rCR].value, 0, -1)

I've already got it for the natural armor, but since the CR uses an array I can't just put a number in and see what the field is.
 
The template CR field is an array, but you're not restricted to plugging your modifier in there. You could just as easily subtract it from the field on the race, which is not an array.

However, if you want to manipulate an array, you just have to know how to get to a certain row of the array. Here is an example from the Amulet of spell cunning:

Code:
            hero.child[cHelpWiz].field[cMemMax].arrayvalue[1] += 1
            hero.child[cHelpWiz].field[cCastMax].arrayvalue[1] += 1
            hero.child[cHelpWiz].field[cMemMax].arrayvalue[2] += 1
            hero.child[cHelpWiz].field[cCastMax].arrayvalue[2] += 1

The number in the final set of [] is the row of the array you transition to. So you could do something like:

Code:
var reducecr as number
reducecr = round(hero.findchild[BaseRace].field[rCR].value/2,0,-1)

field[tmCR].arrayvalue[0] -= reducecr

As always, no assurances on the code, modify it as necessary.
 
Code:
Hero Lab was forced to stop compilation after the following errors were detected:

Syntax error in 'eval' script for Thing 'tmRPAccurs' (Eval Script '#1') on line 7
  -> Non-existent field 'tmCR' used by script
 
Back
Top