• 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

Adding bonus to saving throws

Bob G

Well-known member
Hi Folks,

Working on an ability that adds a bonus to Fort and Will saves at specific levels. I tried using ShadowChemosh's code that uses xCount, but the bonuses aren't adding correctly after the first instance.
Code:
field[abValue].value += field[xCount].value
     hero.child[svFort].field[Bonus].value += field[abValue].value
     hero.child[svWill].field[Bonus].value += field[abValue].value

So what am I missing here?
 
You've left out a lot of information, I'm afraid - first, where is this ability - the code you've posted will only work on a class special, but you just said "ability", so I'm not sure what sort of ability this is. Also, please be specific about "aren't adding correctly after the first instance" means - what numbers are you seeing?
 
More info

You've left out a lot of information, I'm afraid - first, where is this ability - the code you've posted will only work on a class special, but you just said "ability", so I'm not sure what sort of ability this is. Also, please be specific about "aren't adding correctly after the first instance" means - what numbers are you seeing?

Hi Mathias, thanks for responding! First, this is a class special. Next, the ability is bootstrapped at level 1, 7 and 14. At level 1, the bonus adds correctly as an untyped +1 bonus, but at level 7 the bonus calculates to +3, when it should be +2. At level 14, the bonus calculates to +5, when it should be +3.
 
What is happening is the 2nd and 3rd copies are adding 1 each, since they have an xCount of 1.

You need to add a stop so that only the first copy of the class special adds the bonus. Like so:

Code:
field[abValue].value += field[xCount].value

~only do this if we are the first copy
doneif (tagis[Helper.FirstCopy] = 0)

hero.child[svFort].field[Bonus].value += field[abValue].value
hero.child[svWill].field[Bonus].value += field[abValue].value
 
Back
Top