• 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

Iterative class features not adding bonuses properly

unforgivn

Well-known member
I'm trying to create bonuses for a couple of classes that increase at various set levels (ie +2 at 6th, +4 at 12th, +6 at 18th, or somesuch), and the system seems to not want to cooperate.

I started by copying the Sneak Attack feature and editing the script to display the text that I want. No biggie, and it works fine... so long as I'm only adding +1 per instance of the ability. If I try to do anything different like make the bonus +2 per instance (abValue += 2*xIndex instead of just abValue += xIndex, for example), the system ignores those changes completely.

I managed to get the bonus to add up correctly (don't know the exact code changes that I made since I'm at work), but the proper bonus displays on the first instance of the ability, and the later instances just read as flat +2's instead of keeping the proper running total.

Does anyone have an idea what I'm missing or doing wrong?
 
Code:
var bonus as number
bonus = field[xIndex].value * 2
field[listname].text = field[thingname].text & " +" & bonus
 
Code:
var bonus as number
bonus = field[xIndex].value * 2
field[listname].text = field[thingname].text & " +" & bonus

I'll try it that way when I get home. Any idea why it doesn't work when I'm assigning that value to abValue instead? That's how Sneak Attack had it scripted, and it worked fine.
 
Last edited:
And later on, when calculating abValue, you'll want to use xCount, rather than xIndex - xIndex is the ability's position in the list (the 6th level copy will have xIndex = 1, the 12th level copy will have xIndex = 2, etc.). xCount is the number of those abilities that have reached the correct level.

So, I think you're looking for:

Code:
field[abValue].value += field[xCount].value * 2
 
field[livename].text = field[thingname].text & " +" & field[abValue].value
 
And later on, when calculating abValue, you'll want to use xCount, rather than xIndex - xIndex is the ability's position in the list (the 6th level copy will have xIndex = 1, the 12th level copy will have xIndex = 2, etc.). xCount is the number of those abilities that have reached the correct level.

So, I think you're looking for:

Code:
field[abValue].value += field[xCount].value * 2
 
field[livename].text = field[thingname].text & " +" & field[abValue].value

Thanks, I'll try both of those when I get home. I just find it odd that the only change that I made to the code for Sneak Attack (which works just the way I want this ability to work) was to add the multiplication to the line assigning abValue.
 
All I've done is to move line 4 of sneak attack to the top, and insert a multiplier in-between xIndex and the display of xIndex (which requires using a variable as the temporary step inbetween), then apply a multiplier when deriving abValue from xCount.

I'm also using the field[thingname].text to look up the name of the ability, rather than having to retype "Sneak Attack" (or whatever your ability is called) - that makes the ability easier to copy when you're making your next ability after this - you don't have to retype the name for every ability you make that works like this.

Another note - sneak attack is unlike the vast majority of class specials in Pathfinder - it checks the "Use Own Level?" checkbox. Most abilities in Pathfinder, if they're made available by more than one class, like Wild Empathy on a Druid/Ranger, or Bardic Performance on a Bard/Pathfinder Chronicler, add the levels of all the classes together, then calculate the bonus, unlike sneak attack, which calculates each class' bonus, then adds the bonuses together.
 
All I've done is to move line 4 of sneak attack to the top, and insert a multiplier in-between xIndex and the display of xIndex (which requires using a variable as the temporary step inbetween), then apply a multiplier when deriving abValue from xCount.

I'm also using the field[thingname].text to look up the name of the ability, rather than having to retype "Sneak Attack" (or whatever your ability is called) - that makes the ability easier to copy when you're making your next ability after this - you don't have to retype the name for every ability you make that works like this.

Another note - sneak attack is unlike the vast majority of class specials in Pathfinder - it checks the "Use Own Level?" checkbox. Most abilities in Pathfinder, if they're made available by more than one class, like Wild Empathy on a Druid/Ranger, or Bardic Performance on a Bard/Pathfinder Chronicler, add the levels of all the classes together, then calculate the bonus, unlike sneak attack, which calculates each class' bonus, then adds the bonuses together.

Actually, I was apparently already using xCount and not xIndex like I said before. Here's the code copied directly from the thing:

Code:
      ~ If we're not shown, just get out now
      doneif (tagis[Helper.ShowSpec] = 0)
      
      field[abValue].value += 2 * field[xCount].value
      
      field[livename].text = field[thingname].text & " +" & field[abValue].value
      field[abSumm].text = "+" & field[abValue].value & " on Repair checks 
to perform temporary or jury-rigged repairs."
      field[listname].text = field[thingname].text & " +" & field[abValue].value

And here is how it comes out on the character (the Jury-Rig ability is the problematic one):

w8oqjq.jpg
 
Last edited:
You want to generate your listname before testing for ShowSpec, since no matter whether the ability is showing up on the special tab, you want the correct name on the list of class specials, and derive the listname from xIndex, livename from xCount. You're currently deriving both livename and listname from xCount.
 
On the class special tab, the listname is displayed.

On the special tab and printout, livename is displayed.
 
You want to generate your listname before testing for ShowSpec, since no matter whether the ability is showing up on the special tab, you want the correct name on the list of class specials, and derive the listname from xIndex, livename from xCount. You're currently deriving both livename and listname from xCount.

Code:
      var bonus as number
      field[abValue].value += 2 * field[xCount].value
      bonus += field[xIndex].value *2      

      field[livename].text = field[thingname].text & " +" & field[abValue].value
      field[abSumm].text = "+" & field[abValue].value & " on Repair checks 
to perform temporary or jury-rigged repairs."
      field[listname].text = field[thingname].text & " +" & bonus

That fixed it. Thanks!
 
BTW, the ShowSpec and FirstCopy tests (I saw the ShowSpec test on your first example), are things you should get in the habit of adding to class specials. Otherwise, when you try to create a class special that adds a bonus, you'll find that every copy is adding a bonus, whether or not it's reached the correct level. Sneak Attack is bad coding style, since it doesn't have them.
 
Back
Top