• 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

Swashbuckler's Grace

bertg

Member
As I work on creating the Swashbuckler class from CW, I ran into a slight glitch. The Class ability Grace gives a +1 to Reflex saves at 2nd level, +2 at 11 and +3 at 20. I copied the Duelist's grace ability and followed Rob's instructions here.

Here's the eval script for Grace 1:


~ If we're carrying medium or heavy encumbrance, we're disabled.
if (hero.child[Totals].field[tEncumLev].value >= 2) then
var result as number
result = assign[Helper.SpcDisable]
done
endif

#competencebonus[hero.child[vRef], 1]


In the subsequent versions I change the bonus on the last line to 2 and 3. But the problem I'm having is that even though I put the correct Level Requirements at 11 and 20, it assigns the full +3 at 2nd level. What am I overlooking?
 
It's not well-documented, but ALL class abilities are added as soon as you take the class, they're just not shown.

I'd look at how an ability chain's are coded in the core files. Barbarian DR comes to mind - what they do is to put all the calculations on the lowest-level version of the ability. The higher-level versions don't have any scripts.

On the lowest-level version, you calculate the competence bonus from the level, put it in a variable, and use that in the #competencebonus[] statement.
 
bertg wrote:

> ~ If we're carrying medium or heavy encumbrance, we're disabled.
> if (hero.child[Totals].field[tEncumLev].value >= 2) then
> var result as number
> result = assign[Helper.SpcDisable]
> done
> endif
>
> #competencebonus[hero.child[vRef], 1]
>
>
> In the subsequent versions I change the bonus on the last line to 2 and
> 3. But the problem I'm having is that even though I put the correct
> Level Requirements at 11 and 20, it assigns the full +3 at 2nd level.
> What am I overlooking?


As Mathias mentioned, the way we generally do it is put all the bonuses
on the lowest level pick (because that way the scripts are easier to
write). So for this example, you would do it like this:

var bonus as number
if (field[xTotalLev].value < 11) then
bonus = 1
elseif (field[xTotalLev].value < 20) then
bonus = 2
else
bonus = 3
endif
#competencebonus[hero.child[vRef], bonus]


Hope this helps,

--
Colen McAlister (colen@wolflair.com)
Chief Engineer, Lone Wolf Development
http://www.wolflair.com/
 
bertg wrote:
>
>
> OK, I tried that, but when I hit the Test Now button I get a message saying:
>
> Reference to undeclared variable: 'bonus'


Before the code you just added, put the following:

var bonus as number

This tells the script that a variable named 'bonus' exists, and that
it's a number. If you don't do this, it doesn't know what 'bonus' is.


--
Colen McAlister (colen@wolflair.com)
Chief Engineer, Lone Wolf Development
http://www.wolflair.com/
 
Ah, I figured that out and changed my post, but I guess you read the old one before I could update it. Thanks anyway, that did the trick.
 
Back
Top