Senior Member
Join Date: Nov 2011
Location: South Riding, VA
Posts: 841
|
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] |
#1 |
Senior Member
Lone Wolf Staff
Join Date: May 2005
Posts: 13,213
|
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.
|
#2 |
Senior Member
Volunteer Data File Contributor
Join Date: Jan 2010
Location: Chicago, IL (USA)
Posts: 10,729
|
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 So in example: Code:
#applybonus[Bonus, hero.child[Attack], bon] Code:
~ Our Bonus is biggest of the two fields hero.child[Attack].field[Bonus].value = maximum(hero.child[Attack].field[Bonus].value,bon) Hero Lab Resources: Pathfinder - d20pfsrd and Pathfinder Pack Setup 3.5 D&D (d20) - Community Server Setup 5E D&D - Community Server Setup Hero Lab Help - Hero Lab FAQ, Editor Tutorials and Videos, Editor & Scripting Resources. Created by the community for the community - Realm Works kickstarter backer (Alpha Wolf) and Beta tester.- d20 HL package volunteer editor. |
#3 |
Senior Member
Join Date: Nov 2011
Location: South Riding, VA
Posts: 841
|
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.
|
#4 |
Senior Member
Join Date: Nov 2011
Location: South Riding, VA
Posts: 841
|
Ahh I think I see the problem. I need to add the bonus to child[attack].field[tAtk] not to Bonus
|
#5 |
Senior Member
Volunteer Data File Contributor
Join Date: Jan 2010
Location: Chicago, IL (USA)
Posts: 10,729
|
Quote:
I am lazy and like just copying code that works. Hero Lab Resources: Pathfinder - d20pfsrd and Pathfinder Pack Setup 3.5 D&D (d20) - Community Server Setup 5E D&D - Community Server Setup Hero Lab Help - Hero Lab FAQ, Editor Tutorials and Videos, Editor & Scripting Resources. Created by the community for the community - Realm Works kickstarter backer (Alpha Wolf) and Beta tester.- d20 HL package volunteer editor. |
|
#6 |
Senior Member
Join Date: Nov 2011
Location: South Riding, VA
Posts: 841
|
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. |
#7 |
|
|