Senior Member
Join Date: Nov 2017
Location: Trafford, PA, USA
Posts: 226
|
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 |
#1 |
Senior Member
Lone Wolf Staff
Join Date: May 2005
Posts: 13,213
|
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?
|
#2 |
Senior Member
Join Date: Nov 2017
Location: Trafford, PA, USA
Posts: 226
|
Quote:
|
|
#3 |
Senior Member
Join Date: Oct 2011
Posts: 6,793
|
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 |
#4 |
Senior Member
Join Date: Nov 2017
Location: Trafford, PA, USA
Posts: 226
|
That did the trick! Thanks Mathias!
|
#5 |
Senior Member
Join Date: Oct 2011
Posts: 6,793
|
Blinks owlishly
|
#6 |
Senior Member
Join Date: Nov 2017
Location: Trafford, PA, USA
Posts: 226
|
|
#7 |
Senior Member
Join Date: Oct 2011
Posts: 6,793
|
Thumbs up
|
#8 |
|
|