• 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

Why are my competence bonuses stacking?

Bob G

Well-known member
They shouldn't, right?

Custom special has user select a skill, and gets a (level/2) competence bonus. Class gets a total of 5 of these over a 20 level progression, and each special is unique. However, some confer a bonus to the same skill. They are not supposed to stack with each other, so I chose a competence bonus. Script is identical for all specials:
Code:
if (field[xTotalLev].value <=1) then
     field[abValue].value += 1
     else
     field[abValue].value += round(field[xTotalLev].value/2,0,-1)
     endif
     hero.child[sk(Skill)].field[BonComp].value += field[abValue].value

So what is it that's allowing the competence bonus granted from two different custom specials to stack?
 
Where is your code snippet from?
I'm fairly sure there's a macro which will correctly apply a non-stacking bonus to a particular stat.
 
Code:
hero.child[sk(Skill)].field[BonComp].value += field[abValue].value

This is why it's stacking. You have multiple scripts pointing to the same skill and saying "increase the competence bonus by X". Instead, try this:

Code:
hero.child[sk(Skill)].field[BonComp].value = maximum(hero.child[sk(Skill)].field[BonComp].value ,field[abValue].value)

Or this macro which amounts to the same thing:

Code:
#applybonus[BonComp,hero.child[sk(Skill),field[abValue].value]

This means "set the competence bonus to X or the existing bonus, whichever is larger".
 
Great, thanks IG. For some reason, I thought that competence bonuses would just automatically not stack by default. I thought maybe there was something in the XML file that treated it differently than stacking bonuses. So I guess that regardless of the bonus type, I need to define in the script if the bonus stacks or doesn't.

I learned something today! Today is a good day.
 
Just use the #applybonus macro, since bonuses of the same type should never stack (except dodge).

You're original code was using the "+=" operator, which just adds your new value to the existing value.
 
I believe untyped bonuses stack, dodge bonuses stack, and circumstance bonuses stack if they're from different circumstances.

As well as penalties of those same types, such as two different penalties from unique circumstances or two different dodge penalties.

Aside from those exceptions, all bonuses (or penalties) only take the best (or worst) single condition.
 
Untyped bonuses do stack, yes. However, as far as I know all official penalties are untyped so they ALWAYS stack.
 
Back
Top