• 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

Timing question

frumple

Well-known member
I am trying to add an ability that when activated adds the character's CHA modifer to attack rolls. I am having issues with the proper timing for the script.

Here is the code:
Code:
~ If we're not shown, just get out now
      doneif (tagis[Helper.ShowSpec] = 0)

~ If we're not enabled, get out now
      doneif (field[abilActive].value = 0)

var bon as number
bon = hero.child[aCHA].field[aModBonus].value

#applybonus[Bonus, hero.child[Attack], bon]

I have tried various timings (First/10000, Pre-Levels/5000, Post-Levels/5000, Post-Attributes/5000) but none seem to work.
 
You shouldn't use the #applybonus macro on the Bonus field - Bonus is for bonuses that DO stack with each other. Just use addition to add to Bonus.
 
Code:
~ If we're not shown, just get out now
doneif (tagis[Helper.ShowSpec] = 0)

~ If we're not enabled, get out now
doneif (field[abilActive].value = 0)

~ Give Cha bonus to attack
hero.child[Attack].field[Bonus].value += hero.child[aCHA].field[aModBonus].value

As Mathias said the #applybonus is not a good idea in this case. Inside the macro it is doing logic that only applies the BIGGEST value to the field.

So in example:
Code:
#applybonus[Bonus, hero.child[Attack], bon]
is really saying:
Code:
~ Our Bonus is biggest of the two fields
hero.child[Attack].field[Bonus].value = maximum(hero.child[Attack].field[Bonus].value,bon)
 
Ok. Thanks. However, the timing of the script still seems to be an issue. I can get the bonus in the Bonus field during Post-Attributes, but it doesn't propagate to the attack bonus.
 
Ahh I think I see the problem. I need to add the bonus to child[attack].field[tAtk] not to Bonus
Hmm not near HL but that seems wrong some how. Have you looked at the Paladins Smite Evil Class Special? It has a way to activate and give a Cha bonus to attack rolls. Check its timing and code.

I am lazy and like just copying code that works. :) :p
 
Yeah. That is how I figured it out. The Smite Good/Evil class feature is timed at Post-Attribute, but applies the bonus to tAtk.

I think the problem is that you need to be at Post-Attribute to get the attribute bonus, but the attack values are calculated before that.
 
Back
Top