Senior Member
Join Date: Jul 2007
Location: Syracuse, NY (USA)
Posts: 213
|
I have a custom feat that grants +1 Morale Bonus to Melee Attack & Damage rolls. What script could I use to implement this?
|
#1 |
Senior Member
Lone Wolf Staff
Join Date: May 2005
Posts: 13,213
|
In the editor, press the help button. You'll be taken to the editor help page. Scroll down there to the "Reference Information" page. Scroll down until you come to the #applybonus[] macro - you'll be using that.
Now, scroll down some more to the "General Modifiers" section - you'll see that morale bonuses are "BonMorale" Scroll down some more to the "Attack Bonus" section - it tells you that Attack is hero.child[Attack]. So, putting those three things together, #applybonus[BonMorale,hero.child[Attack],3] will give you a +3 morale bonus to attack. Scroll down to the D's to find "Damage Bonus" - note that unlike attack, damage doesn't allow the generic modifiers - this is a bug that just hasn't been worth the trouble to fix yet. Since you can't set a morale bonus to damage, you'll set a generic bonus, using the damage pick's wDamBonus field. hero.child[Damage].field[tDamBonus].value += 3 will add a +3 generic bonus to damage. |
#2 |
Senior Member
Join Date: Jul 2007
Location: Syracuse, NY (USA)
Posts: 213
|
Thanks, but doesn't that grant this bonus to all attacks & damage rolls? My custom feat applies only to melee attacks & damage rolls.
|
#3 |
Senior Member
Lone Wolf Staff
Join Date: May 2005
Posts: 13,213
|
Oops, missed seeing the melee part.
In that case, the best way to handle it is probably to search through all the weapons, looking for those that are melee weapons and apply the bonus to weapon-specific fields on the weapons. Unfortunately, it's not a morale bonus, but hopefully you won't have to worry about the bonus stacking. foreach pick in hero from BaseWep where "wCategory.Melee" eachpick.field[wAttBonus].value += 3 eachpick.field[wDamBonus].value += 3 nexteach Last edited by Mathias; November 5th, 2009 at 04:04 PM. Reason: fixed a typo - thanks huntercc for pointing it out. |
#4 |
Senior Member
Join Date: Jul 2007
Location: Syracuse, NY (USA)
Posts: 213
|
Thanks - it was the melee part that was giving me trouble!
Just one thing to point out - in your script, you end the "foreach" with "endif" instead of "nexteach" |
#5 |
|
|